Fix thread termination on exit.

This commit is contained in:
pavoni 2016-04-01 15:27:50 +01:00
parent 5aa04de006
commit 6ee086c0bb
4 changed files with 14 additions and 6 deletions

View file

@ -7,12 +7,13 @@ https://home-assistant.io/components/sensor.loop_energy/
import logging
from homeassistant.helpers.entity import Entity
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
_LOGGER = logging.getLogger(__name__)
DOMAIN = "loopenergy"
REQUIREMENTS = ['pyloopenergy==0.0.4']
REQUIREMENTS = ['pyloopenergy==0.0.5']
def setup_platform(hass, config, add_devices, discovery_info=None):
@ -45,6 +46,13 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
gas_secret
)
def stop_loopenergy(event):
"""Shutdown loopenergy thread on exit."""
_LOGGER.info("Shutting down loopenergy.")
controller.terminate()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_loopenergy)
sensors = [LoopEnergyElec(controller)]
if gas_serial:

View file

@ -16,7 +16,7 @@ from homeassistant.const import (
from homeassistant.helpers.entity import Entity
from homeassistant.loader import get_component
REQUIREMENTS = ['pyvera==0.2.8']
REQUIREMENTS = ['pyvera==0.2.10']
_LOGGER = logging.getLogger(__name__)

View file

@ -9,7 +9,7 @@ import logging
from homeassistant.components import discovery
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
REQUIREMENTS = ['pywemo==0.3.23']
REQUIREMENTS = ['pywemo==0.3.24']
DOMAIN = 'wemo'
DISCOVER_LIGHTS = 'wemo.light'

View file

@ -183,7 +183,7 @@ pyfttt==0.3
pyicloud==0.7.2
# homeassistant.components.sensor.loopenergy
pyloopenergy==0.0.4
pyloopenergy==0.0.5
# homeassistant.components.device_tracker.netgear
pynetgear==0.3.2
@ -235,10 +235,10 @@ python-wink==0.6.4
pyuserinput==0.1.9
# homeassistant.components.vera
pyvera==0.2.8
pyvera==0.2.10
# homeassistant.components.wemo
pywemo==0.3.23
pywemo==0.3.24
# homeassistant.components.thermostat.radiotherm
radiotherm==1.2