This Blueprint allows the synchronisation of an alarm control panel with a Zigbee2MQTT keypad. This means that the status of the alarm control panel is transmitted to the keypad and vice versa.
Supportes Devices
- Linkind ZS130000078 (tested by me)
- Hive KEYPAD001 (not tested)
- Develco KEYZB-110 (tested by @paolo)
- Xfinity XHK1-UE (tested by @jds, see his post)
- Develco KEYZB-110 (tested by @hugospacep , see his post)
- Frient KEPZB-110, which is a whitelabel version of the Develco Keypad
- Other keypads may also work. Leave a message if you have tested another one.
Blueprint Overview
Step 1: Import the Blueprint
blueprint:
name: PIN-Keypads for Zigbee2MQTT
description: "This Blueprint allows the synchronisation of an alarm control panel with a Zigbee2MQTT keypad. This means that the status of the alarm control panel is transmitted to the keypad and vice versa. Additionally, you can set a custom action for two wrong PINs. This way you can perform actions by entering specific wrong PINs."
domain: automation
input:
z2m_keypad_path:
name: MQTT State Topic of your Zigbee2MQTT Keypad
description: "The State Topic is composed of your Zigbee2MQTT base_topic (see your Z2M Addon Configuration) and the Friendly Name of your keypad in Z2M. Example: zigbee2mqtt/Keypad"
z2m_keypad_path_set:
name: MQTT Set Topic of your Zigbee2MQTT Keypad
description: "This is the same as your State Topic, with the addition of /set. Example: zigbee2mqtt/Keypad/set"
pin:
name: Pincode
description: "The valid pin code to be accepted as correct by your alarm system. Example: 1234"
control_panel:
name: Control Panel
description: "An alarm control panel. Example: https://www.home-assistant.io/integrations/manual"
default: []
selector:
entity:
domain: alarm_control_panel
action_arming:
name: Action Arming
description: "An action to be performed when the alarm panel changes to the arming state."
default: []
selector:
action: {}
action_armed_home:
name: Action Armed Home
description: "An action to be performed when the alarm panel changes to the armed home state."
default: []
selector:
action: {}
action_armed_away:
name: Action Armed Away
description: "An action to be performed when the alarm panel changes to the armed away state."
default: []
selector:
action: {}
action_disarmed:
name: Action Disarmed
description: "An action to be performed when the alarm panel changes to the disarmed state."
default: []
selector:
action: {}
action_pending:
name: Action Pending
description: "An action to be performed when the alarm panel changes to the pending state."
default: []
selector:
action: {}
action_panic:
name: Action Panic
description: "An action to be performed when the panic / SOS button of the keypad is pressed."
default: []
selector:
action: {}
custpin1:
name: Custom PIN 1
default: 0000
description: "A custom PIN to trigger a custom action. Example: 0000"
action_cust1:
name: Action Custom 1
description: "An action to be performed when custom PIN 1 ist entered."
default: []
selector:
action: {}
custpin2:
name: Custom PIN 2
default: 1111
description: "A custom PIN to trigger a custom action. Example: 1111"
action_cust2:
name: Action Custom 2
description: "An action to be performed when custom PIN 2 ist entered."
default: []
selector:
action: {}
variables:
pin_var: !input 'pin'
pin_var_cust1: !input 'custpin1'
pin_var_cust2: !input 'custpin2'
trigger:
- platform: state
entity_id: !input 'control_panel'
to: arming
id: panel_arming
- platform: state
entity_id: !input 'control_panel'
to: armed_home
id: panel_armed_home
- platform: state
entity_id: !input 'control_panel'
to: disarmed
id: panel_disarmed
- platform: state
entity_id: !input 'control_panel'
to: armed_away
id: panel_armed_away
- platform: state
entity_id: !input 'control_panel'
to: pending
id: panel_pending
- platform: mqtt
topic: !input z2m_keypad_path
id: keypad_mqtt
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: panel_arming
sequence:
- choose:
- conditions:
- condition: state
entity_id: !input 'control_panel'
state: armed_home
attribute: next_state
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "arm_day_zones"
}
}
- conditions:
- condition: state
entity_id: !input 'control_panel'
state: armed_away
attribute: next_state
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "exit_delay"
}
}
default: []
- choose:
default: !input 'action_arming'
- conditions:
- condition: trigger
id: panel_armed_away
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "arm_all_zones"
}
}
- choose:
default: !input 'action_armed_away'
- conditions:
- condition: trigger
id: panel_disarmed
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "disarm"
}
}
- choose:
default: !input 'action_disarmed'
- conditions:
- condition: trigger
id: panel_armed_home
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "arm_day_zones"
}
}
- choose:
default: !input 'action_armed_home'
- conditions:
- condition: trigger
id: panel_pending
sequence:
- choose:
default: !input 'action_pending'
- conditions:
- condition: trigger
id: keypad_mqtt
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action_transaction != null and
trigger.payload_json.action_code == pin_var }}
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"transaction": "{{ trigger.payload_json.action_transaction }}",
"mode": "{{ trigger.payload_json.action }}"
}
}
- choose:
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action_transaction != null and
trigger.payload_json.action_code == pin_var_cust1 }}
sequence:
- choose:
default: !input 'action_cust1'
- choose:
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action_transaction != null and
trigger.payload_json.action_code == pin_var_cust2 }}
sequence:
- choose:
default: !input 'action_cust2'
- choose:
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action_code == pin_var and
trigger.payload_json.action == "arm_all_zones" }}
sequence:
- service: alarm_control_panel.alarm_arm_away
target:
entity_id: !input 'control_panel'
data:
code: !input 'pin'
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action_code == pin_var and
trigger.payload_json.action == "arm_day_zones" }}
sequence:
- service: alarm_control_panel.alarm_arm_home
target:
entity_id: !input 'control_panel'
data:
code: !input 'pin'
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action_code == pin_var and
trigger.payload_json.action == "disarm" }}
sequence:
- service: alarm_control_panel.alarm_disarm
target:
entity_id: !input 'control_panel'
data:
code: !input 'pin'
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action == "panic" }}
sequence:
- choose:
default: !input 'action_panic'
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action_code != pin_var and
trigger.payload_json.action_code | int(-1) != -1 }}
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"transaction": "{{ trigger.payload_json.action_transaction }}",
"mode": "invalid_code"
}
}
- conditions:
- condition: template
value_template: >-
{{ trigger.payload_json.action == None }}
sequence:
- choose:
- conditions:
- condition: state
entity_id: !input 'control_panel'
state: armed_away
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "arm_all_zones"
}
}
- conditions:
- condition: state
entity_id: !input 'control_panel'
state: armed_home
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "arm_day_zones"
}
}
- conditions:
- condition: state
entity_id: !input 'control_panel'
state: disarmed
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "disarm"
}
}
- conditions:
- condition: state
entity_id: !input 'control_panel'
state: arming
- condition: state
entity_id: !input 'control_panel'
state: armed_home
attribute: next_state
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "arm_day_zones"
}
}
- conditions:
- condition: state
entity_id: !input 'control_panel'
state: arming
- condition: state
entity_id: !input 'control_panel'
state: armed_away
attribute: next_state
sequence:
- service: mqtt.publish
data:
topic: !input 'z2m_keypad_path_set'
payload: |-
{
"arm_mode":
{
"mode": "arm_all_zones"
}
}
default: []
default: []
mode: parallel
max: 10
Step 2: Create an Alarm Control Panel
An example configuration could look like this:
alarm_control_panel: - platform: manual name: My Alarm Panel delay_time: 60 arming_time: 60 trigger_time: 120
For more information on how to configure an alarm panel have a look at the documentation. Alarm Panels provided by other integrations should work as well.
Step 3: Pair your Keypad in Zigbee2MQTT and check its configuration
You will need:
- A successfully paired keypad in Zigbee2MQTT. Donât panic if the keypads connection LED is still blinking. This is no issue and will be solved later.
- Rename the Keypad in Zigbee2MQTT and remember its name.
- Check the base_topic of Zigbee2MQTT you are using. You will find it in the addon configuration.
Step 4: Create a blueprint automation
Create an automation based on this blueprint and fill out all required fields.
If your alarm panel uses a pin code, it is important that the pin code of this automation is identical. Otherwise, this blueprint cannot change the status of the alarm panel.
The actions can be used to define additional actions that are executed when the state is changed. However, this is optional.
Step 5: Use your blueprint
You operate your keypad as follows: First press the button of the mode you want to set. Then enter the PIN. Finally, press the tick.
Changelog
- 2021-10-09 - 15:00 - Inital Release
- 2021-10-09 - 20:15 - Fixed handling of incorrect PINs
- 2021-10-15 - 15:40 - Support for Alarm Panels with Pincodes
- 2021-10-15 - 16:24 - Support for Panic/SOS-Button Actions
- 2023-07-25 - 14:00 - Add support for two actions triggered by entering wrong PINs
- 2023-07-26 - 13:30 - Updated data_template to data