2019-04-03 15:40:03 +00:00
|
|
|
"""Demo platform that has two fake alarm control panels."""
|
2017-12-03 12:52:31 +00:00
|
|
|
import datetime
|
2019-11-25 23:42:53 +00:00
|
|
|
|
2019-03-24 03:22:35 +00:00
|
|
|
from homeassistant.components.manual.alarm_control_panel import ManualAlarm
|
2017-09-14 18:08:45 +00:00
|
|
|
from homeassistant.const import (
|
2020-04-23 22:07:07 +00:00
|
|
|
CONF_ARMING_TIME,
|
2019-11-25 23:42:53 +00:00
|
|
|
CONF_DELAY_TIME,
|
|
|
|
CONF_TRIGGER_TIME,
|
2019-07-31 19:25:30 +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,
|
|
|
|
)
|
2015-11-26 18:09:32 +00:00
|
|
|
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
2017-04-30 05:04:49 +00:00
|
|
|
"""Set up the Demo alarm control panel platform."""
|
2019-07-31 19:25:30 +00:00
|
|
|
async_add_entities(
|
|
|
|
[
|
|
|
|
ManualAlarm(
|
|
|
|
hass,
|
|
|
|
"Alarm",
|
|
|
|
"1234",
|
|
|
|
None,
|
|
|
|
True,
|
|
|
|
False,
|
|
|
|
{
|
|
|
|
STATE_ALARM_ARMED_AWAY: {
|
2020-04-23 22:07:07 +00:00
|
|
|
CONF_ARMING_TIME: datetime.timedelta(seconds=5),
|
2019-07-31 19:25:30 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
|
|
|
},
|
|
|
|
STATE_ALARM_ARMED_HOME: {
|
2020-04-23 22:07:07 +00:00
|
|
|
CONF_ARMING_TIME: datetime.timedelta(seconds=5),
|
2019-07-31 19:25:30 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
|
|
|
},
|
|
|
|
STATE_ALARM_ARMED_NIGHT: {
|
2020-04-23 22:07:07 +00:00
|
|
|
CONF_ARMING_TIME: datetime.timedelta(seconds=5),
|
2019-07-31 19:25:30 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
|
|
|
},
|
|
|
|
STATE_ALARM_DISARMED: {
|
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
|
|
|
},
|
|
|
|
STATE_ALARM_ARMED_CUSTOM_BYPASS: {
|
2020-04-23 22:07:07 +00:00
|
|
|
CONF_ARMING_TIME: datetime.timedelta(seconds=5),
|
2019-07-31 19:25:30 +00:00
|
|
|
CONF_DELAY_TIME: datetime.timedelta(seconds=0),
|
|
|
|
CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
|
|
|
|
},
|
|
|
|
STATE_ALARM_TRIGGERED: {
|
2020-04-23 22:07:07 +00:00
|
|
|
CONF_ARMING_TIME: datetime.timedelta(seconds=5)
|
2019-07-31 19:25:30 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
2019-11-13 15:37:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
|
|
|
"""Set up the Demo config entry."""
|
|
|
|
await async_setup_platform(hass, {}, async_add_entities)
|