Example #1
0
async def async_setup_platform(hass, config, async_add_entities,
                               discovery_info=None):
    """Set up the Demo alarm control panel platform."""
    async_add_entities([
        ManualAlarm(hass, 'Alarm', '1234', None, False, {
            STATE_ALARM_ARMED_AWAY: {
                CONF_DELAY_TIME: datetime.timedelta(seconds=0),
                CONF_PENDING_TIME: datetime.timedelta(seconds=5),
                CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
            },
            STATE_ALARM_ARMED_HOME: {
                CONF_DELAY_TIME: datetime.timedelta(seconds=0),
                CONF_PENDING_TIME: datetime.timedelta(seconds=5),
                CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
            },
            STATE_ALARM_ARMED_NIGHT: {
                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),
            },
            STATE_ALARM_ARMED_CUSTOM_BYPASS: {
                CONF_DELAY_TIME: datetime.timedelta(seconds=0),
                CONF_PENDING_TIME: datetime.timedelta(seconds=5),
                CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
            },
            STATE_ALARM_TRIGGERED: {
                CONF_PENDING_TIME: datetime.timedelta(seconds=5),
            },
        }),
    ])
Example #2
0
async def async_setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    async_add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up the Demo alarm control panel platform."""
    async_add_entities([
        ManualAlarm(
            hass,
            "Alarm",
            "1234",
            None,
            True,
            False,
            {
                STATE_ALARM_ARMED_AWAY: {
                    CONF_ARMING_TIME: datetime.timedelta(seconds=5),
                    CONF_DELAY_TIME: datetime.timedelta(seconds=0),
                    CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
                },
                STATE_ALARM_ARMED_HOME: {
                    CONF_ARMING_TIME: datetime.timedelta(seconds=5),
                    CONF_DELAY_TIME: datetime.timedelta(seconds=0),
                    CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
                },
                STATE_ALARM_ARMED_NIGHT: {
                    CONF_ARMING_TIME: datetime.timedelta(seconds=5),
                    CONF_DELAY_TIME: datetime.timedelta(seconds=0),
                    CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
                },
                STATE_ALARM_ARMED_VACATION: {
                    CONF_ARMING_TIME: datetime.timedelta(seconds=5),
                    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: {
                    CONF_ARMING_TIME: datetime.timedelta(seconds=5),
                    CONF_DELAY_TIME: datetime.timedelta(seconds=0),
                    CONF_TRIGGER_TIME: datetime.timedelta(seconds=10),
                },
                STATE_ALARM_TRIGGERED: {
                    CONF_ARMING_TIME: datetime.timedelta(seconds=5)
                },
            },
        )
    ])