From 3a6eac216c8d03215bb364e1c090779f095e0682 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 8 Oct 2018 10:20:18 +0200 Subject: [PATCH] Fix SPC (#17236) --- homeassistant/components/alarm_control_panel/spc.py | 2 ++ homeassistant/components/binary_sensor/spc.py | 2 ++ homeassistant/components/spc.py | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/alarm_control_panel/spc.py b/homeassistant/components/alarm_control_panel/spc.py index 2345717d835ed..b4c49d4d190aa 100644 --- a/homeassistant/components/alarm_control_panel/spc.py +++ b/homeassistant/components/alarm_control_panel/spc.py @@ -36,6 +36,8 @@ def _get_alarm_state(area): async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the SPC alarm control panel platform.""" + if discovery_info is None: + return api = hass.data[DATA_API] async_add_entities([SpcAlarm(area=area, api=api) for area in api.areas.values()]) diff --git a/homeassistant/components/binary_sensor/spc.py b/homeassistant/components/binary_sensor/spc.py index 25baf50339924..baa25266804ad 100644 --- a/homeassistant/components/binary_sensor/spc.py +++ b/homeassistant/components/binary_sensor/spc.py @@ -26,6 +26,8 @@ def _get_device_class(zone_type): async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the SPC binary sensor.""" + if discovery_info is None: + return api = hass.data[DATA_API] async_add_entities([SpcBinarySensor(zone) for zone in api.zones.values() diff --git a/homeassistant/components/spc.py b/homeassistant/components/spc.py index 0771608f88e72..5aa987bd0a843 100644 --- a/homeassistant/components/spc.py +++ b/homeassistant/components/spc.py @@ -63,11 +63,11 @@ async def async_upate_callback(spc_object): # add sensor devices for each zone (typically motion/fire/door sensors) hass.async_create_task(discovery.async_load_platform( - hass, 'binary_sensor', DOMAIN)) + hass, 'binary_sensor', DOMAIN, {})) # create a separate alarm panel for each area hass.async_create_task(discovery.async_load_platform( - hass, 'alarm_control_panel', DOMAIN)) + hass, 'alarm_control_panel', DOMAIN, {})) # start listening for incoming events over websocket spc.start()