I will keep the original post intact but this is no longer supported as the initial implementation in deCONZ has fundamentally changed, nearly everything is available directly from the keypad entity now rather than needing to combine the entity state with the alarm event.
This is a simple blueprint to combine Home Assistant automations with keypads paired to deCONZ. deCONZ Alarm control panel support in Home Assistant was introduced with release 2021.05, deCONZ support is still in alpha but will be released before summer 2021.
It works by making deconz_alarm_event
interact with the alarm panel control entity. Validating the user input code before changing entity state.
Setting up an automation based on the blueprint the user will specify the device and one or more four digit code in a free form text field. When the user uses any arm/disarm command on the keypad the automation will validate the code and update the state of the alarm control panel entity. Other automations can then be used to do alarm logic based on the entity state.
blueprint:
name: deCONZ Simple Alarm Control Panel
description: |
Provide a mechanism to validate user input code prior to setting entity state.
The Automation will:
1. Trigger on a ´deconz_alarm_event´.
2. Verify code is an allowed code.
3. Update device state to reflect event.
domain: automation
input:
alarm_panel:
name: Alarm control panel
description: Alarm panel to control
selector:
device:
entity:
integration: deconz
domain: alarm_control_panel
allowed_codes:
name: Allowed codes
description: Four digit codes to allow with user input
selector:
text:
multiline: true
mode: single
variables:
alarm_panel_device_id: !input alarm_panel
user_code: !input allowed_codes
trigger:
platform: event
event_type: deconz_alarm_event
event_data:
device_id: !input alarm_panel
condition:
- condition: template
value_template: '{{ trigger.event.data.code in user_code }}'
action:
- variables:
event: '{{ trigger.event.data.event }}'
- choose:
- conditions:
- '{{ event == "armed_away" }}'
sequence:
- service: alarm_control_panel.alarm_arm_away
target:
device_id: '{{ alarm_panel_device_id }}'
- conditions:
- '{{ event == "armed_night" }}'
sequence:
- service: alarm_control_panel.alarm_arm_night
target:
device_id: '{{ alarm_panel_device_id }}'
- conditions:
- '{{ event == "armed_home" }}'
sequence:
- service: alarm_control_panel.alarm_arm_home
target:
device_id: '{{ alarm_panel_device_id }}'
- conditions:
- '{{ event == "disarmed" }}'
sequence:
- service: alarm_control_panel.alarm_disarm
target:
device_id: '{{ alarm_panel_device_id }}'