Skip to content

Commit

Permalink
Fix handle ConnectionError and ValueError differently
Browse files Browse the repository at this point in the history
Close #6
  • Loading branch information
m-rossi committed Oct 14, 2024
1 parent 71a860c commit 38a0d20
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/dashboard_delbrueck/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def update(self):
else:
self._attr_native_value = data["value"]
self._attr_native_unit_of_measurement = UNIT_CONVERTER[data["unit"]]
except (ValueError, ConnectionError):
except ConnectionError:
self._attr_native_value = None
except ValueError:
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"]]
Expand Down

0 comments on commit 38a0d20

Please sign in to comment.