mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Fix wallbox sensor rounding (#73310)
This commit is contained in:
parent
a82a1bfd64
commit
8ffd4cf0f9
@ -4,10 +4,6 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/wallbox",
|
"documentation": "https://www.home-assistant.io/integrations/wallbox",
|
||||||
"requirements": ["wallbox==0.4.9"],
|
"requirements": ["wallbox==0.4.9"],
|
||||||
"ssdp": [],
|
|
||||||
"zeroconf": [],
|
|
||||||
"homekit": {},
|
|
||||||
"dependencies": [],
|
|
||||||
"codeowners": ["@hesselonline"],
|
"codeowners": ["@hesselonline"],
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["wallbox"]
|
"loggers": ["wallbox"]
|
||||||
|
@ -167,8 +167,12 @@ class WallboxSensor(WallboxEntity, SensorEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Return the state of the sensor."""
|
"""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:
|
if (
|
||||||
|
sensor_round := self.entity_description.precision
|
||||||
|
) is not None and self.coordinator.data[
|
||||||
|
self.entity_description.key
|
||||||
|
] is not None:
|
||||||
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),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user