From c3155651e4aad6714852b87cd18a4acfc65c03e6 Mon Sep 17 00:00:00 2001 From: andythigpen Date: Sat, 21 Feb 2015 15:02:08 -0600 Subject: [PATCH 1/2] Fix issue with some bulbs missing 'xy' attribute. Philips Lux bulbs (as well as other dimmable bulbs that work with the Hue hub) do not have an 'xy' attribute. --- homeassistant/components/light/hue.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/light/hue.py b/homeassistant/components/light/hue.py index 6efce68d031052..e53fd1fa25d8f5 100644 --- a/homeassistant/components/light/hue.py +++ b/homeassistant/components/light/hue.py @@ -159,7 +159,8 @@ def state_attributes(self): if self.is_on: attr[ATTR_BRIGHTNESS] = self.info['state']['bri'] - attr[ATTR_XY_COLOR] = self.info['state']['xy'] + if 'xy' in self.info['state']: + attr[ATTR_XY_COLOR] = self.info['state']['xy'] return attr From 8819aa70790b5e89c0147ef9a7a53df84dff25e4 Mon Sep 17 00:00:00 2001 From: andythigpen Date: Sat, 21 Feb 2015 15:17:43 -0600 Subject: [PATCH 2/2] Fix issue in Timer thread caused by variable name. threading.Thread already contains a _stop() function which is called in threading._after_fork(). Assigning an Event object to _stop caused periodic exceptions to be thrown. This renames the _stop variable to _stop_event to prevent a naming collision. --- homeassistant/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/__init__.py b/homeassistant/__init__.py index 9894626d920b9a..9752790f91be0a 100644 --- a/homeassistant/__init__.py +++ b/homeassistant/__init__.py @@ -776,7 +776,7 @@ def __init__(self, hass, interval=None): self.daemon = True self.hass = hass self.interval = interval or TIMER_INTERVAL - self._stop = threading.Event() + self._stop_event = threading.Event() # We want to be able to fire every time a minute starts (seconds=0). # We want this so other modules can use that to make sure they fire @@ -790,7 +790,7 @@ def run(self): """ Start the timer. """ self.hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, - lambda event: self._stop.set()) + lambda event: self._stop_event.set()) _LOGGER.info("Timer:starting") @@ -799,7 +799,7 @@ def run(self): calc_now = dt.datetime.now interval = self.interval - while not self._stop.isSet(): + while not self._stop_event.isSet(): now = calc_now() # First check checks if we are not on a second matching the