hass-core/homeassistant/components/alarm_control_panel/demo.py
Joe Lu 9c603d932d Add manual alarm_control_panel pending time per state (#9264)
* - Enhanced manual alarm_control_panel config so that you can specify different pending time for different alarm state

* - Fixed demo alaram control panel

* - Updated configuration structure for state specific pending times

* - Addressed comment

* Address code review comments

* - Fixed failing tests
- Updated demo alarm component to use new per state pending_time setting

* - Removing previously added comment which might have caused build to fail?

* - moved "copy.deepcopy(config)" out of loop so config is only copied once
2017-09-14 20:08:45 +02:00

30 lines
993 B
Python

"""
Demo platform that has two fake alarm control panels.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
import homeassistant.components.alarm_control_panel.manual as manual
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
STATE_ALARM_TRIGGERED, CONF_PENDING_TIME)
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Demo alarm control panel platform."""
add_devices([
manual.ManualAlarm(hass, 'Alarm', '1234', 5, 10, False, {
STATE_ALARM_ARMED_AWAY: {
CONF_PENDING_TIME: 5
},
STATE_ALARM_ARMED_HOME: {
CONF_PENDING_TIME: 5
},
STATE_ALARM_ARMED_NIGHT: {
CONF_PENDING_TIME: 5
},
STATE_ALARM_TRIGGERED: {
CONF_PENDING_TIME: 5
},
}),
])