Skip to content

Instantly share code, notes, and snippets.

@yougotborked
Last active January 2, 2025 00:30
Show Gist options
  • Save yougotborked/ee97cf733e5b655c1e3f96befe8ae291 to your computer and use it in GitHub Desktop.
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)
description: >
Integrate a ZigBee Keypad with Alarmo using device triggers and device actions.
- Keypad → Alarmo: ZHA events use the user-typed code to arm/disarm Alarmo.
- Alarmo → Keypad: Alarmo state changes update the keypad using a static master code.
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: >
The static code to disarm/arm the keypad from Alarmo → Keypad sequences.
Typically "00000" in ZHA config.
default: "00000"
selector:
text:
notify_service:
name: Notify Service
description: "Choose a `notify.*` entity for alarm state messages."
default: notify.notify
selector:
entity:
domain: notify
# Concurrency controls
mode: parallel
max: 2
# Triggers
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 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
- 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_trigger
# Actions
action:
# (1) Keypad → Alarmo
- choose:
- conditions:
- condition: trigger
id: disarm_keypad
sequence:
- service: alarmo.disarm
target:
entity_id: !input alarmo_entity
data:
code: "{{ trigger.event.data.args.code }}"
- conditions:
- condition: trigger
id: arm_home_keypad
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
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
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
- service: !input notify_service
data:
message: "clear_notification"
data:
tag: alarmo
- service: !input notify_service
data:
title: "Alarmo"
message: "Home alarm Disarmed."
data:
tag: alarmo
- conditions:
- condition: trigger
id: alarmo_state_armed_arming
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: 4
seconds_remaining: 60
audible_notification: 1
alarm_status: 0
- service: !input notify_service
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
- service: !input notify_service
data:
message: "clear_notification"
data:
tag: alarmo
- service: !input notify_service
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
- service: !input notify_service
data:
message: "clear_notification"
data:
tag: alarmo
- service: !input notify_service
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
- service: !input notify_service
data:
message: "clear_notification"
data:
tag: alarmo
- service: !input notify_service
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
- service: !input notify_service
data:
message: "clear_notification"
data:
tag: alarmo
- service: !input notify_service
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
seconds_remaining: 60
audible_notification: 1
alarm_status: 0
- service: !input notify_service
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
- service: !input notify_service
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