2015-11-26 18:09:32 +00:00
|
|
|
"""
|
|
|
|
Demo platform that has two fake alarm control panels.
|
2016-02-24 09:38:06 +00:00
|
|
|
|
|
|
|
For more details about this platform, please refer to the documentation
|
|
|
|
https://home-assistant.io/components/demo/
|
2015-11-26 18:09:32 +00:00
|
|
|
"""
|
2017-12-03 12:52:31 +00:00
|
|
|
import datetime
|
2015-11-30 01:59:59 +00:00
|
|
|
import homeassistant.components.alarm_control_panel.manual as manual
|
2017-09-14 18:08:45 +00:00
|
|
|
from homeassistant.const import (
|
2017-12-03 12:52:31 +00:00
|
|
|
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_CUSTOM_BYPASS,
|
|
|
|
STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
|
|
|
|
STATE_ALARM_DISARMED, STATE_ALARM_TRIGGERED, CONF_DELAY_TIME,
|
|
|
|
CONF_PENDING_TIME, CONF_TRIGGER_TIME)
|
2015-11-26 18:09:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
2017-04-30 05:04:49 +00:00
|
|
|
"""Set up the Demo alarm control panel platform."""
|
2015-11-26 18:09:32 +00:00
|
|
|
add_devices([
|
2017-12-03 12:52:31 +00:00
|
|
|
manual.ManualAlarm(hass, 'Alarm', '1234', None, False, {
|
2017-09-14 18:08:45 +00:00
|
|
|
STATE_ALARM_ARMED_AWAY: {
|
2017-12-03 12:52:31 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_PENDING_TIME: datetime.timedelta(seconds=5),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
2017-09-14 18:08:45 +00:00
|
|
|
},
|
|
|
|
STATE_ALARM_ARMED_HOME: {
|
2017-12-03 12:52:31 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_PENDING_TIME: datetime.timedelta(seconds=5),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
2017-09-14 18:08:45 +00:00
|
|
|
},
|
|
|
|
STATE_ALARM_ARMED_NIGHT: {
|
2017-12-03 12:52:31 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_PENDING_TIME: datetime.timedelta(seconds=5),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
|
|
|
},
|
|
|
|
STATE_ALARM_DISARMED: {
|
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
2017-09-14 18:08:45 +00:00
|
|
|
},
|
2017-11-25 04:30:57 +00:00
|
|
|
STATE_ALARM_ARMED_CUSTOM_BYPASS: {
|
2017-12-03 12:52:31 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_PENDING_TIME: datetime.timedelta(seconds=5),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
2017-11-25 04:30:57 +00:00
|
|
|
},
|
2017-09-14 18:08:45 +00:00
|
|
|
STATE_ALARM_TRIGGERED: {
|
2017-12-03 12:52:31 +00:00
|
|
|
CONF_PENDING_TIME: datetime.timedelta(seconds=5),
|
2017-09-14 18:08:45 +00:00
|
|
|
},
|
|
|
|
}),
|
2015-11-30 01:59:59 +00:00
|
|
|
])
|