From 38c9f7a37a149abf2b05dc47fc087710c27cc673 Mon Sep 17 00:00:00 2001 From: MartinHjelmare Date: Mon, 1 Feb 2016 02:11:16 +0100 Subject: [PATCH] Fix 'unavailable' entity * Report friendly_name, icon and customized attributes for 'unavailable' entities. --- homeassistant/helpers/entity.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 2127cc0f465..e41f7755e9e 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -135,17 +135,17 @@ class Entity(object): state = str(self.state) attr = self.state_attributes or {} - if not self.available: - state = STATE_UNAVAILABLE - return self.hass.states.set(self.entity_id, state) - - if ATTR_FRIENDLY_NAME not in attr and self.name is not None: - attr[ATTR_FRIENDLY_NAME] = str(self.name) - if ATTR_UNIT_OF_MEASUREMENT not in attr and \ self.unit_of_measurement is not None: attr[ATTR_UNIT_OF_MEASUREMENT] = str(self.unit_of_measurement) + if not self.available: + state = STATE_UNAVAILABLE + attr = {} + + if ATTR_FRIENDLY_NAME not in attr and self.name is not None: + attr[ATTR_FRIENDLY_NAME] = str(self.name) + if ATTR_ICON not in attr and self.icon is not None: attr[ATTR_ICON] = str(self.icon)