always sync unit_of_measurement (#44670)

pull/44680/head
Diogo Gomes 2020-12-30 23:39:14 +00:00 committed by GitHub
parent 687f90e164
commit b290a8b5a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -145,13 +145,7 @@ class UtilityMeterSensor(RestoreEntity):
):
return
if (
self._unit_of_measurement is None
and new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is not None
):
self._unit_of_measurement = new_state.attributes.get(
ATTR_UNIT_OF_MEASUREMENT
)
self._unit_of_measurement = new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
try:
diff = Decimal(new_state.state) - Decimal(old_state.state)