Skip to content

Commit

Permalink
Fix SPC (#17236)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Oct 8, 2018
1 parent 6671cbb commit 3a6eac2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions homeassistant/components/alarm_control_panel/spc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()])
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/binary_sensor/spc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/spc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3a6eac2

Please sign in to comment.