diff --git a/homeassistant/components/isy994.py b/homeassistant/components/isy994.py index f6ecebb9b2c..d3ee1008889 100644 --- a/homeassistant/components/isy994.py +++ b/homeassistant/components/isy994.py @@ -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. """