diff --git a/custom_components/nissan_carwings/sensor.py b/custom_components/nissan_carwings/sensor.py index 83c9023..0fd7928 100644 --- a/custom_components/nissan_carwings/sensor.py +++ b/custom_components/nissan_carwings/sensor.py @@ -78,6 +78,10 @@ def native_value(self) -> str | None: if self.coordinator.data[DATA_BATTERY_STATUS_KEY] is None: return None + # 0% SOC is not a valid value + if self.coordinator.data[DATA_BATTERY_STATUS_KEY].battery_percent == 0: + return None + return round(self.coordinator.data[DATA_BATTERY_STATUS_KEY].battery_percent) @property @@ -124,6 +128,9 @@ def native_value(self) -> float | None: else: ret = data.cruising_range_ac_off_km + if ret is None: + return None + if self.hass.config.units is US_CUSTOMARY_SYSTEM: ret = DistanceConverter.convert(ret, UnitOfLength.KILOMETERS, UnitOfLength.MILES)