mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +00:00
update unit_of_measurement even if unit_of_measurement is known (#69699)
This commit is contained in:
parent
1c6e5ea844
commit
205a8fc752
@ -196,10 +196,11 @@ class IntegrationSensor(RestoreEntity, SensorEntity):
|
|||||||
# or device_class.
|
# or device_class.
|
||||||
update_state = False
|
update_state = False
|
||||||
|
|
||||||
if self._unit_of_measurement is None:
|
|
||||||
unit = new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
unit = new_state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||||
if unit is not None:
|
if unit is not None:
|
||||||
self._unit_of_measurement = self._unit_template.format(unit)
|
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
|
update_state = True
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user