Reduce precision in returned values to meaningful digits (#49382)

This commit is contained in:
Niels Mündler 2021-05-23 21:06:58 +02:00 committed by GitHub
parent 3cef96e78a
commit f0cd87e031
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -290,6 +290,8 @@ class FroniusTemplateSensor(SensorEntity):
"""Update the internal state."""
state = self.parent.data.get(self._name)
self._state = state.get("value")
if isinstance(self._state, float):
self._state = round(self._state, 2)
self._unit = state.get("unit")
async def async_added_to_hass(self):