update unit_of_measurement even if unit_of_measurement is known (#69699)
This commit is contained in:
parent
de26df0c6d
commit
852eaa062c
1 changed files with 5 additions and 4 deletions
|
@ -196,10 +196,11 @@ class IntegrationSensor(RestoreEntity, SensorEntity):
|
|||
# or device_class.
|
||||
update_state = False
|
||||
|
||||
if self._unit_of_measurement is None:
|
||||
unit = new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
if unit is not None:
|
||||
self._unit_of_measurement = self._unit_template.format(unit)
|
||||
unit = new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||
if unit is not None:
|
||||
new_unit_of_measurement = self._unit_template.format(unit)
|
||||
if self._unit_of_measurement != new_unit_of_measurement:
|
||||
self._unit_of_measurement = new_unit_of_measurement
|
||||
update_state = True
|
||||
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue