I think this is a potential bug (#23157)

This commit is contained in:
Penny Wood 2019-04-18 00:52:08 +08:00 committed by Paulus Schoutsen
parent 6a40a712cd
commit 7a9c9031af

View File

@ -241,9 +241,9 @@ class Entity:
"""Write the state to the state machine.""" """Write the state to the state machine."""
start = timer() start = timer()
attr = {}
if not self.available: if not self.available:
state = STATE_UNAVAILABLE state = STATE_UNAVAILABLE
attr = {}
else: else:
state = self.state state = self.state
@ -252,10 +252,8 @@ class Entity:
else: else:
state = str(state) state = str(state)
attr = self.state_attributes or {} attr.update(self.state_attributes or {})
device_attr = self.device_state_attributes attr.update(self.device_state_attributes or {})
if device_attr is not None:
attr.update(device_attr)
unit_of_measurement = self.unit_of_measurement unit_of_measurement = self.unit_of_measurement
if unit_of_measurement is not None: if unit_of_measurement is not None: