Skip to content

Commit

Permalink
Allow number to be zero in gardena bluetooth (home-assistant#96872)
Browse files Browse the repository at this point in the history
Allow number to be 0 in gardena
  • Loading branch information
elupus committed Jul 18, 2023
1 parent 727a72f commit 0d69ba6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions homeassistant/components/gardena_bluetooth/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ class GardenaBluetoothNumber(GardenaBluetoothDescriptorEntity, NumberEntity):
entity_description: GardenaBluetoothNumberEntityDescription

def _handle_coordinator_update(self) -> None:
if data := self.coordinator.get_cached(self.entity_description.char):
self._attr_native_value = float(data)
else:
data = self.coordinator.get_cached(self.entity_description.char)
if data is None:
self._attr_native_value = None
else:
self._attr_native_value = float(data)
super()._handle_coordinator_update()

async def async_set_native_value(self, value: float) -> None:
Expand Down

0 comments on commit 0d69ba6

Please sign in to comment.