Template Alarm Control Panel


The template integrations creates alarm control panels that combine integrations or adds pre-processing logic to actions.

There are several powerful ways to use this integration, including grouping existing integrations into a simpler integrations, or adding logic that Home Assistant will execute when accessed.

For example, if you want to expose a true alarm panel to Google Home, Alexa, or HomeKit - but limit its ability to disarm when there’s no one home, you can do that using a template.

Another use case could be grouping a series of sensors and services together to represent various “armed” and “disarmed” states and actions.

This can simplify the GUI and make it easier to write automations.

In optimistic mode, the alarm control panel will immediately change state after every command. Otherwise, the alarm control panel will wait for state confirmation from the template. Try to enable it, if experiencing incorrect operation.

Configuration

To enable a Template Alarm Control Panel in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
alarm_control_panel:
  - platform: template
    panels:
      safe_alarm_panel:
        value_template: "{{ states('alarm_control_panel.real_alarm') }}"
        arm_away:
          service: alarm_control_panel.alarm_arm_away
          data:
            entity_id: alarm_control_panel.real_alarm
            code: !secret alarm_code
        arm_home:
          service: alarm_control_panel.alarm_arm_home
          data:
            entity_id: alarm_control_panel.real_alarm
            code: !secret alarm_code
        disarm:
          - condition: state
            entity_id: device_tracker.paulus
            state: 'home'
          - service: alarm_control_panel.alarm_arm_home
            data:
              entity_id: alarm_control_panel.real_alarm
              code: !secret alarm_code

Configuration Variables

panels map Required

List of your panels.

alarm_control_panel_name map Required

The slug of the panel.

name string (Optional)

Name to use in the frontend.

Default:

Template Alarm Control Panel

unique_id string (Optional)

An ID that uniquely identifies this alarm control panel. Set this to a unique value to allow customization through the UI.

value_template template (Optional)

Defines a template to set the state of the alarm panel. Only the states armed_away, armed_home, armed_night, disarmed, pending, triggered and unavailable are used.

disarm action (Optional)

Defines an action to run when the alarm is disarmed.

arm_away action (Optional)

Defines an action to run when the alarm is armed to away mode.

arm_home action (Optional)

Defines an action to run when the alarm is armed to home mode.

arm_night action (Optional)

Defines an action to run when the alarm is armed to night mode.

code_arm_required boolean (Optional, default: false)

If true, the code is required to arm the alarm.

Considerations

If you are using the state of a integration that takes extra time to load, the Template Alarm Control Panel may get an unknown state during startup. This results in error messages in your log file until that integration has completed loading. If you use is_state() function in your template, you can avoid this situation.

For example, you would replace {{ states.switch.source.state == 'on' }} with this equivalent that returns true/false and never gives an unknown result: {{ is_state('switch.source', 'on') }}

Working without entities

If you use a template that depends on the current time or some other non-deterministic result not sourced from entities, the template won’t repeatedly update but will only update when the state of a referenced entity updates. For ways to deal with this issue, see Working without entities in the Template Binary Sensor integration.