Skip to content

Commit

Permalink
Add support for km/h speed unit
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcornil-git committed Oct 29, 2023
1 parent 4e17119 commit 5ad9a68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/sma_webbox/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ def set_sensor_attributes(self, unit) -> None:
self._attr_unit_of_measurement = UnitOfSpeed.METERS_PER_SECOND
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_device_class = SensorDeviceClass.WIND_SPEED
elif unit == WEBBOX_UNIT_KILOMETERS_PER_HOUR:
self._attr_unit_of_measurement = UnitOfSpeed.KILOMETERS_PER_HOUR
self._attr_state_class = SensorStateClass.MEASUREMENT
self._attr_device_class = SensorDeviceClass.WIND_SPEED
elif unit == WEBBOX_UNIT_OHMS:
self._attr_state_class = SensorStateClass.MEASUREMENT

Expand Down
1 change: 1 addition & 0 deletions custom_components/sma_webbox/sma_webbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
WEBBOX_UNIT_TEMP_FAHRENHEIT = "°F"
WEBBOX_UNIT_TEMP_KELVIN = "°K"
WEBBOX_UNIT_METERS_PER_SECOND = "m/s"
WEBBOX_UNIT_KILOMETERS_PER_HOUR = "km/h"

_LOGGER = logging.getLogger(__name__)

Expand Down

0 comments on commit 5ad9a68

Please sign in to comment.