feat: add weather/environmental sensor device classes - #147
Draft
bluetoothbot wants to merge 1 commit into
Draft
Conversation
Add five Home Assistant SensorDeviceClass members that are missing from this mirror: ATMOSPHERIC_PRESSURE, IRRADIANCE, PRECIPITATION, PRECIPITATION_INTENSITY, and WIND_SPEED. These map to common BLE weather-station readings and were absent here while present upstream. Additive only; string values pinned with tests as the HA interop contract.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #147 +/- ##
==========================================
+ Coverage 94.37% 94.43% +0.05%
==========================================
Files 12 12
Lines 480 485 +5
Branches 5 5
==========================================
+ Hits 453 458 +5
Misses 26 26
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: Add five Home Assistant
SensorDeviceClassmembers that this mirror was missing:ATMOSPHERIC_PRESSURE,IRRADIANCE,PRECIPITATION,PRECIPITATION_INTENSITY,WIND_SPEED.Why: The library intentionally mirrors HA's device classes (the main feature work here, e.g. PM4 and the air-quality classes). These five are standard upstream device classes that map directly to common BLE weather-station / environmental readings, yet had no representation here — so a parser had no canonical device class to attach to those readings.
How: Additive enum members only, placed in roughly alphabetical position.
ATMOSPHERIC_PRESSUREis kept distinct from the existingPRESSUREto match HA (same units, different semantics). No units.py or library.py changes — device classes stand on their own, matching the many existing members without a convenienceSensorLibraryentry.Testing: New
tests/test_sensor_device_class_weather.pypins each string value (the HA interop contract) and assertsATMOSPHERIC_PRESSURE != PRESSURE. Full suite green (11 passed), ruff clean.Quality Report
Changes: 2 files changed, 39 insertions(+)
Code scan: clean
Tests: passed (11 passed)
Branch hygiene: clean
Generated by Kōan