Merge remote-tracking branch 'fabaff/alarm-demo' into dev
This commit is contained in:
commit
dc2f3861c9
2 changed files with 39 additions and 18 deletions
38
homeassistant/components/alarm_control_panel/demo.py
Normal file
38
homeassistant/components/alarm_control_panel/demo.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
"""
|
||||
homeassistant.components.alarm_control_panel.demo
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Demo platform that has two fake alarm control panels.
|
||||
"""
|
||||
import homeassistant.components.alarm_control_panel.manual as Alarm
|
||||
from homeassistant.const import (STATE_ALARM_DISARMED,
|
||||
STATE_ALARM_ARMED_AWAY)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Sets up the Demo alarm control panels. """
|
||||
add_devices([
|
||||
|
||||
DemoAlarmControlPanel(hass, 'Front door', '1234', 2, 4,
|
||||
STATE_ALARM_DISARMED),
|
||||
DemoAlarmControlPanel(hass, 'Safe', '1234', 2, 4,
|
||||
STATE_ALARM_ARMED_AWAY),
|
||||
])
|
||||
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
class DemoAlarmControlPanel(Alarm.ManualAlarm):
|
||||
""" A Demo alarm control panel. """
|
||||
|
||||
def __init__(self, hass, name, code, pending_time, trigger_time, state):
|
||||
super().__init__(hass, name, code, pending_time, trigger_time)
|
||||
self._state = state
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
""" No polling needed for a demo panel. """
|
||||
return False
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
""" Returns the state of the device. """
|
||||
return self._state
|
|
@ -18,7 +18,7 @@ DEPENDENCIES = ['conversation', 'introduction', 'zone']
|
|||
|
||||
COMPONENTS_WITH_DEMO_PLATFORM = [
|
||||
'device_tracker', 'light', 'media_player', 'notify', 'switch', 'sensor',
|
||||
'thermostat', 'camera', 'binary_sensor']
|
||||
'thermostat', 'camera', 'binary_sensor', 'alarm_control_panel']
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
|
@ -55,23 +55,6 @@ def setup(hass, config):
|
|||
group.setup_group(hass, 'bedroom', [lights[0], switches[1],
|
||||
media_players[0]])
|
||||
|
||||
# Setup IP Camera
|
||||
bootstrap.setup_component(
|
||||
hass, 'camera',
|
||||
{'camera': {
|
||||
'platform': 'generic',
|
||||
'name': 'IP Camera',
|
||||
'still_image_url': 'http://home-assistant.io/demo/webcam.jpg',
|
||||
}})
|
||||
|
||||
# Setup alarm_control_panel
|
||||
bootstrap.setup_component(
|
||||
hass, 'alarm_control_panel',
|
||||
{'alarm_control_panel': {
|
||||
'platform': 'manual',
|
||||
'name': 'Test Alarm',
|
||||
}})
|
||||
|
||||
# Setup scripts
|
||||
bootstrap.setup_component(
|
||||
hass, 'script',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue