From 5fffe9b22fee2f8a1ebae08286972b485d216adb Mon Sep 17 00:00:00 2001 From: hesselonline Date: Thu, 24 Mar 2022 22:09:59 +0100 Subject: [PATCH] Wallbox remove unnecessary try..except (#68636) --- homeassistant/components/wallbox/sensor.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/wallbox/sensor.py b/homeassistant/components/wallbox/sensor.py index 57f2176febb..9a7fd1a21a3 100644 --- a/homeassistant/components/wallbox/sensor.py +++ b/homeassistant/components/wallbox/sensor.py @@ -169,14 +169,8 @@ class WallboxSensor(WallboxEntity, SensorEntity): def native_value(self) -> StateType: """Return the state of the sensor.""" if (sensor_round := self.entity_description.precision) is not None: - try: - return cast( - StateType, - round( - self.coordinator.data[self.entity_description.key], sensor_round - ), - ) - except TypeError: - _LOGGER.debug("Cannot format %s", self._attr_name) - return None + return cast( + StateType, + round(self.coordinator.data[self.entity_description.key], sensor_round), + ) return cast(StateType, self.coordinator.data[self.entity_description.key])