Skip to content

Commit

Permalink
Set unit of unavailable data if unit is available in api response
Browse files Browse the repository at this point in the history
Close #5
  • Loading branch information
m-rossi committed Oct 14, 2024
1 parent d25f012 commit 71a860c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/dashboard_delbrueck/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def update(self):
self._attr_native_unit_of_measurement = UNIT_CONVERTER[data["unit"]]
except (ValueError, ConnectionError):
self._attr_native_value = None
if "unit" in data and data["unit"] in UNIT_CONVERTER:
self._attr_native_unit_of_measurement = UNIT_CONVERTER[data["unit"]]


def replace_umlauts(text: str) -> str:
Expand Down

0 comments on commit 71a860c

Please sign in to comment.