Skip to content

Instantly share code, notes, and snippets.

@yougotborked
Last active September 20, 2025 03:58
Show Gist options
  • Select an option

  • Save yougotborked/ee97cf733e5b655c1e3f96befe8ae291 to your computer and use it in GitHub Desktop.

Select an option

Save yougotborked/ee97cf733e5b655c1e3f96befe8ae291 to your computer and use it in GitHub Desktop.
######################################################################################################
## ZHA / Xfinity and Alarmo Synchronization ##
######################################################################################################
######################################################################################################
## This automation will integrate a ZHA ZigBee Wireless Keypad with the Alarmo HACS addon. ##
## It allows you to arm and disarm Alarmo via the keypad using the Alarmo passwords and not the ##
## Keypad password configured in ZHA. It will also sync the keypad state with Alarmo. ##
## ##
## Pre-requisites: ##
## ##
## 1) Alarmo Custom Integration installed and configured: ##
## - At least one 4-digit pincode configured, with code required for arming and disarming. ##
## - Armed Away, Armed Home, and Armed Night modes enabled if needed. ##
## 2) A ZigBee keypad enrolled in ZHA (e.g., Xfinity XHK1-UE). ##
## - In ZHA configuration, set the Master code to 00000 and set consecutive failed attempts ##
## to a high value (e.g., 1000). This blueprint does not use the keypad’s own password. ##
## 3) A properly configured notify service for optional alarm notifications. ##
## ##
## What the automation does: ##
## ##
## - Allows you to use the keypad to Arm/Disarm Alarmo with Alarmo’s own pin codes. ##
## - Allows Alarmo to mirror its states back to the keypad (disarmed, armed_away, etc.). ##
## - Sends notifications when the Alarm is armed, disarmed, or is arming. ##
## ##
## IMPORTANT: Ensure the keypad’s Master code is set to 00000 in ZHA config (ZHA → Devices → ##
## Configure). ##
######################################################################################################
# Blueprint metadata
blueprint:
name: ZHA Keypad & Alarmo Sync (Device Actions) — Fixed
description: >
Integrate a ZigBee Keypad (ZHA) with Alarmo. Keypad → Alarmo uses the user-typed code.
Alarmo → Keypad mirrors states using a static keypad master code. Includes optional notifications.
domain: automation
input:
# 1) Keypad IEEE & Device
keypad_ieee:
name: Keypad IEEE
description: >
Manually enter the IEEE address for your ZigBee Keypad (e.g., 00:0d:6f:00:10:fe:a1:75).
selector:
text:
zha_keypad_device:
name: ZHA Keypad Device
description: Select the ZHA device for your ZigBee keypad.
selector:
device:
integration: zha
# 2) Keypad Alarm Entity
keypad_entity:
name: Keypad Alarm Entity
description: Select the `alarm_control_panel` entity for your keypad.
selector:
entity:
domain: alarm_control_panel
# 3) Alarmo Device & Entity
alarmo_device:
name: Alarmo Device
description: Select the Alarmo device for device triggers/actions.
selector:
device:
alarmo_entity:
name: Alarmo Entity
description: Select the `alarm_control_panel` entity for Alarmo.
selector:
entity:
domain: alarm_control_panel
# 4) Codes & Notifications
keypad_master_code:
name: Keypad Master Code
description: >
Static code used when Alarmo mirrors state back to the keypad. Typically "00000" set in ZHA.
default: "00000"
selector:
text:
countdown_seconds:
name: Countdown Seconds (Arming/Pending)
description: Seconds to display on the keypad during EXIT/ENTRY delay.
default: 60
selector:
number:
min: 5
max: 300
step: 5
unit_of_measurement: s
notifications_enabled:
name: Enable Notifications
description: Toggle alarm state notifications via a notify service.
default: false
selector:
boolean:
notify_service:
name: Notify Service (service string)
description: >
A notify service name, e.g. `notify.notify` or `notify.mobile_app_andrews_iphone`.
Leave default if unsure.
default: notify.notify
selector:
text:
mode: parallel
max: 2
trigger:
# (A) Keypad → Alarmo (ZHA events)
- platform: event
event_type: zha_event
event_data:
device_ieee: !input keypad_ieee
args:
arm_mode_description: Disarm
id: disarm_keypad
- platform: event
event_type: zha_event
event_data:
device_ieee: !input keypad_ieee
args:
arm_mode_description: Arm_Day_Home_Only
id: arm_home_keypad
- platform: event
event_type: zha_event
event_data:
device_ieee: !input keypad_ieee
args:
arm_mode_description: Arm_All_Zones
id: arm_away_keypad
- platform: event
event_type: zha_event
event_data:
device_ieee: !input keypad_ieee
args:
arm_mode_description: Arm_Night_Sleep_Only
id: arm_night_keypad
# (B) Alarmo → Keypad (device/state triggers)
- platform: device
device_id: !input alarmo_device
domain: alarm_control_panel
entity_id: !input alarmo_entity
type: disarmed
id: alarmo_state_disarmed
- platform: device
device_id: !input alarmo_device
domain: alarm_control_panel
entity_id: !input alarmo_entity
type: arming
id: alarmo_state_arming # FIX: matches choose id
- platform: device
device_id: !input alarmo_device
domain: alarm_control_panel
entity_id: !input alarmo_entity
type: armed_away
id: alarmo_state_armed_away
- platform: device
device_id: !input alarmo_device
domain: alarm_control_panel
entity_id: !input alarmo_entity
type: armed_home
id: alarmo_state_armed_home
- platform: device
device_id: !input alarmo_device
domain: alarm_control_panel
entity_id: !input alarmo_entity
type: armed_night
id: alarmo_state_armed_night
- platform: device
device_id: !input alarmo_device
domain: alarm_control_panel
entity_id: !input alarmo_entity
type: armed_vacation
id: alarmo_state_armed_vacation
- platform: state
entity_id: !input alarmo_entity
to: pending
id: alarmo_state_armed_pending
- platform: device
device_id: !input alarmo_device
domain: alarm_control_panel
entity_id: !input alarmo_entity
type: triggered
id: alarmo_state_triggered # FIX: matches choose id
# Helper choose to gate notifications
variables:
_notify_on: !input notifications_enabled
_notify_srv: !input notify_service
action:
# (1) Keypad → Alarmo
- choose:
- conditions:
- condition: trigger
id: disarm_keypad
- condition: template
value_template: "{{ (trigger.event.data.args.code | string) | length >= 4 }}" # guard
sequence:
- service: alarmo.disarm
target:
entity_id: !input alarmo_entity
data:
code: "{{ trigger.event.data.args.code }}"
- conditions:
- condition: trigger
id: arm_home_keypad
- condition: template
value_template: "{{ (trigger.event.data.args.code | string) | length >= 4 }}"
sequence:
- service: alarmo.arm
target:
entity_id: !input alarmo_entity
data:
mode: home
code: "{{ trigger.event.data.args.code }}"
- conditions:
- condition: trigger
id: arm_away_keypad
- condition: template
value_template: "{{ (trigger.event.data.args.code | string) | length >= 4 }}"
sequence:
- service: alarmo.arm
target:
entity_id: !input alarmo_entity
data:
mode: away
code: "{{ trigger.event.data.args.code }}"
- conditions:
- condition: trigger
id: arm_night_keypad
- condition: template
value_template: "{{ (trigger.event.data.args.code | string) | length >= 4 }}"
sequence:
- service: alarmo.arm
target:
entity_id: !input alarmo_entity
data:
mode: night
code: "{{ trigger.event.data.args.code }}"
default: []
# (2) Alarmo → Keypad
- choose:
- conditions:
- condition: trigger
id: alarmo_state_disarmed
sequence:
- device_id: !input zha_keypad_device
domain: alarm_control_panel
entity_id: !input keypad_entity
type: disarm
code: !input keypad_master_code
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
message: "clear_notification"
data:
tag: alarmo
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Home alarm Disarmed."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_arming
sequence:
- service: zha.issue_zigbee_cluster_command
data:
cluster_type: out
ieee: !input keypad_ieee
endpoint_id: 1
cluster_id: 1281 # IAS ACE (0x0501)
command: 4 # panel_status_changed
command_type: client
params:
panel_status: 4 # Exit delay
seconds_remaining: !input countdown_seconds
audible_notification: 1
alarm_status: 0
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Home alarm is arming."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_armed_away
sequence:
- device_id: !input zha_keypad_device
domain: alarm_control_panel
entity_id: !input keypad_entity
type: arm_away
code: !input keypad_master_code
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
message: "clear_notification"
data:
tag: alarmo
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Home alarm Armed Away."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_armed_home
sequence:
- device_id: !input zha_keypad_device
domain: alarm_control_panel
entity_id: !input keypad_entity
type: arm_home
code: !input keypad_master_code
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
message: "clear_notification"
data:
tag: alarmo
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Home alarm Armed Home."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_armed_vacation
sequence:
- device_id: !input zha_keypad_device
domain: alarm_control_panel
entity_id: !input keypad_entity
type: arm_vacation
code: !input keypad_master_code
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
message: "clear_notification"
data:
tag: alarmo
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Home alarm Armed Vacation."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_armed_night
sequence:
- device_id: !input zha_keypad_device
domain: alarm_control_panel
entity_id: !input keypad_entity
type: arm_night
code: !input keypad_master_code
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
message: "clear_notification"
data:
tag: alarmo
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Home alarm Armed Night."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_armed_pending
sequence:
- service: zha.issue_zigbee_cluster_command
data:
cluster_type: out
ieee: !input keypad_ieee
endpoint_id: 1
cluster_id: 1281
command: 4
command_type: client
params:
panel_status: 5 # Entry delay
seconds_remaining: !input countdown_seconds
audible_notification: 1
alarm_status: 0
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Home alarm is pending."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_triggered
sequence:
- device_id: !input zha_keypad_device
domain: alarm_control_panel
entity_id: !input keypad_entity
type: trigger
code: !input keypad_master_code
- choose:
- conditions:
- condition: template
value_template: "{{ _notify_on }}"
sequence:
- service: "{{ _notify_srv }}"
data:
title: "Alarmo"
message: "Alarm has been triggered!"
data:
tag: alarmo
default: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment