From 0d69ba6797720856c97f29594d6cfde3da793794 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Tue, 18 Jul 2023 23:43:11 +0200 Subject: [PATCH] Allow number to be zero in gardena bluetooth (#96872) Allow number to be 0 in gardena --- homeassistant/components/gardena_bluetooth/number.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/gardena_bluetooth/number.py b/homeassistant/components/gardena_bluetooth/number.py index ec7ae513a3e..c425d17621d 100644 --- a/homeassistant/components/gardena_bluetooth/number.py +++ b/homeassistant/components/gardena_bluetooth/number.py @@ -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: