From f099aee69a90b4c275a4750a20cff120ced2ba77 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Tue, 11 Apr 2017 17:58:51 +0200 Subject: [PATCH] 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. --- homeassistant/components/light/lifx.py | 3 ++- requirements_all.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/light/lifx.py b/homeassistant/components/light/lifx.py index 76a2a9e907d..da09601c1bb 100644 --- a/homeassistant/components/light/lifx.py +++ b/homeassistant/components/light/lifx.py @@ -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) diff --git a/requirements_all.txt b/requirements_all.txt index 0fcba62c153..017df5e87dd 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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