From 7a9c9031af763cb0d6e3f08e91e976e30cd56933 Mon Sep 17 00:00:00 2001 From: Penny Wood Date: Thu, 18 Apr 2019 00:52:08 +0800 Subject: [PATCH] I think this is a potential bug (#23157) --- homeassistant/helpers/entity.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 4ef5513baf7..d69cdd3d997 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -241,9 +241,9 @@ class Entity: """Write the state to the state machine.""" start = timer() + attr = {} if not self.available: state = STATE_UNAVAILABLE - attr = {} else: state = self.state @@ -252,10 +252,8 @@ class Entity: else: state = str(state) - attr = self.state_attributes or {} - device_attr = self.device_state_attributes - if device_attr is not None: - attr.update(device_attr) + attr.update(self.state_attributes or {}) + attr.update(self.device_state_attributes or {}) unit_of_measurement = self.unit_of_measurement if unit_of_measurement is not None: