Allow number to be zero in gardena bluetooth (#96872)

Allow number to be 0 in gardena
This commit is contained in:
Joakim Plate 2023-07-18 23:43:11 +02:00 committed by GitHub
parent 727a72fbaa
commit 0d69ba6797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: