mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Subscribed isy994 component to EVENT_HOMEASSISTANT_STOP event to clean itself up before quitting.
This commit is contained in:
parent
f77b3dbd0a
commit
f130ad6c27
@ -16,7 +16,8 @@ from homeassistant.helpers import validate_config
|
|||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST, CONF_USERNAME, CONF_PASSWORD, EVENT_PLATFORM_DISCOVERED,
|
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
|
# homeassistant constants
|
||||||
DOMAIN = "isy994"
|
DOMAIN = "isy994"
|
||||||
@ -73,6 +74,9 @@ def setup(hass, config):
|
|||||||
if not ISY.connected:
|
if not ISY.connected:
|
||||||
return False
|
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
|
# Load components for the devices in the ISY controller that we support
|
||||||
for comp_name, discovery in ((('sensor', DISCOVER_SENSORS),
|
for comp_name, discovery in ((('sensor', DISCOVER_SENSORS),
|
||||||
('light', DISCOVER_LIGHTS),
|
('light', DISCOVER_LIGHTS),
|
||||||
@ -87,6 +91,11 @@ def setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def stop(event):
|
||||||
|
""" Cleanup the ISY subscription. """
|
||||||
|
ISY.auto_update = False
|
||||||
|
|
||||||
|
|
||||||
class ISYDeviceABC(ToggleEntity):
|
class ISYDeviceABC(ToggleEntity):
|
||||||
""" Abstract Class for an ISY device within home assistant. """
|
""" Abstract Class for an ISY device within home assistant. """
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user