From 8ffd4cf0f900a867c3135ec9018c868282d0ce3d Mon Sep 17 00:00:00 2001 From: hesselonline Date: Fri, 10 Jun 2022 20:55:55 +0200 Subject: [PATCH] Fix wallbox sensor rounding (#73310) --- homeassistant/components/wallbox/manifest.json | 4 ---- homeassistant/components/wallbox/sensor.py | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/wallbox/manifest.json b/homeassistant/components/wallbox/manifest.json index 914adda980a..5c195b8bfce 100644 --- a/homeassistant/components/wallbox/manifest.json +++ b/homeassistant/components/wallbox/manifest.json @@ -4,10 +4,6 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/wallbox", "requirements": ["wallbox==0.4.9"], - "ssdp": [], - "zeroconf": [], - "homekit": {}, - "dependencies": [], "codeowners": ["@hesselonline"], "iot_class": "cloud_polling", "loggers": ["wallbox"] diff --git a/homeassistant/components/wallbox/sensor.py b/homeassistant/components/wallbox/sensor.py index c8ad3cb3a67..e3598ca7e07 100644 --- a/homeassistant/components/wallbox/sensor.py +++ b/homeassistant/components/wallbox/sensor.py @@ -167,8 +167,12 @@ class WallboxSensor(WallboxEntity, SensorEntity): @property def native_value(self) -> StateType: - """Return the state of the sensor.""" - if (sensor_round := self.entity_description.precision) is not None: + """Return the state of the sensor. Round the value when it, and the precision property are not None.""" + if ( + sensor_round := self.entity_description.precision + ) is not None and self.coordinator.data[ + self.entity_description.key + ] is not None: return cast( StateType, round(self.coordinator.data[self.entity_description.key], sensor_round),