Fix LIFX unregister races (#6723)

* Fix LIFX unregister races

If the initial state request never got a response, we tried to unregister
a device that was not yet registered.

Also, aiolifx 0.4.2 has an "unregister" race fix.

* Update requirements
This commit is contained in:
Anders Melchiorsen 2017-03-21 07:17:58 +01:00 committed by Pascal Vizeli
parent 4ee8be52fe
commit ba3c9f9765
2 changed files with 8 additions and 7 deletions

View File

@ -25,7 +25,7 @@ import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['aiolifx==0.4.1.post1'] REQUIREMENTS = ['aiolifx==0.4.2']
UDP_BROADCAST_PORT = 56700 UDP_BROADCAST_PORT = 56700
@ -95,6 +95,7 @@ class LIFXManager(object):
@callback @callback
def unregister(self, device): def unregister(self, device):
"""Callback for disappearing bulb.""" """Callback for disappearing bulb."""
if device.mac_addr in self.entities:
entity = self.entities[device.mac_addr] entity = self.entities[device.mac_addr]
_LOGGER.debug("%s unregister", entity.ipaddr) _LOGGER.debug("%s unregister", entity.ipaddr)
entity.available = False entity.available = False

View File

@ -41,7 +41,7 @@ aiodns==1.1.1
aiohttp_cors==0.5.0 aiohttp_cors==0.5.0
# homeassistant.components.light.lifx # homeassistant.components.light.lifx
aiolifx==0.4.1.post1 aiolifx==0.4.2
# homeassistant.components.camera.amcrest # homeassistant.components.camera.amcrest
# homeassistant.components.sensor.amcrest # homeassistant.components.sensor.amcrest