Plug file leak on LIFX unregister (#7031)

* Plug file leak on LIFX unregister

The aiolifx 0.4.4 release closes its socket when the unregister callback is
called. This plugs a file descriptor leak but also means that we must be
careful to not use the device after it goes unavailable.

Also, when a light reappears, it has a new device that must be used.

* Do not test self.available in service calls

The core will learn to handle that.
pull/7053/head
Anders Melchiorsen 2017-04-11 17:58:51 +02:00 committed by Paulus Schoutsen
parent 07bb64815d
commit f099aee69a
2 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['aiolifx==0.4.2']
REQUIREMENTS = ['aiolifx==0.4.4']
UDP_BROADCAST_PORT = 56700
@ -84,6 +84,7 @@ class LIFXManager(object):
entity = self.entities[device.mac_addr]
_LOGGER.debug("%s register AGAIN", entity.ipaddr)
entity.available = True
entity.device = device
self.hass.async_add_job(entity.async_update_ha_state())
else:
_LOGGER.debug("%s register NEW", device.ip_addr)

View File

@ -44,7 +44,7 @@ aiodns==1.1.1
aiohttp_cors==0.5.2
# homeassistant.components.light.lifx
aiolifx==0.4.2
aiolifx==0.4.4
# homeassistant.components.camera.amcrest
# homeassistant.components.sensor.amcrest