mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Wallbox remove unnecessary try..except (#68636)
This commit is contained in:
parent
a566d3943c
commit
5fffe9b22f
@ -169,14 +169,8 @@ class WallboxSensor(WallboxEntity, SensorEntity):
|
|||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
if (sensor_round := self.entity_description.precision) is not None:
|
if (sensor_round := self.entity_description.precision) is not None:
|
||||||
try:
|
return cast(
|
||||||
return cast(
|
StateType,
|
||||||
StateType,
|
round(self.coordinator.data[self.entity_description.key], sensor_round),
|
||||||
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, self.coordinator.data[self.entity_description.key])
|
return cast(StateType, self.coordinator.data[self.entity_description.key])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user