Subscribed isy994 component to EVENT_HOMEASSISTANT_STOP event to clean itself up before quitting.

This commit is contained in:
Ryan Kraus 2015-04-25 01:10:41 -04:00
parent f77b3dbd0a
commit f130ad6c27

View File

@ -16,7 +16,8 @@ from homeassistant.helpers import validate_config
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.const import (
CONF_HOST, CONF_USERNAME, CONF_PASSWORD, EVENT_PLATFORM_DISCOVERED,
ATTR_SERVICE, ATTR_DISCOVERED, ATTR_FRIENDLY_NAME)
EVENT_HOMEASSISTANT_STOP, ATTR_SERVICE, ATTR_DISCOVERED,
ATTR_FRIENDLY_NAME)
# homeassistant constants
DOMAIN = "isy994"
@ -73,6 +74,9 @@ def setup(hass, config):
if not ISY.connected:
return False
# listen for HA stop to disconnect
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop)
# Load components for the devices in the ISY controller that we support
for comp_name, discovery in ((('sensor', DISCOVER_SENSORS),
('light', DISCOVER_LIGHTS),
@ -87,6 +91,11 @@ def setup(hass, config):
return True
def stop(event):
""" Cleanup the ISY subscription. """
ISY.auto_update = False
class ISYDeviceABC(ToggleEntity):
""" Abstract Class for an ISY device within home assistant. """