Round miles in myChevy sensors (#46879)

This commit is contained in:
Austin Mroczek 2021-03-07 09:46:14 -08:00 committed by GitHub
parent d3bd2378ba
commit 7050c71524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,6 +160,8 @@ class EVSensor(Entity):
"""Update state."""
if self._car is not None:
self._state = getattr(self._car, self._attr, None)
if self._unit_of_measurement == "miles":
self._state = round(self._state)
for attr in self._extra_attrs:
self._state_attributes[attr] = getattr(self._car, attr)
self.async_write_ha_state()