A few weeks ago, I posted instructions for pairing the Ring Alarm Keypad v2 with Home Assistant using ZWaveJS2MQTT. A few folks asked for a Blueprint for the automations necessary to synchronize the keypad with an alarm_control_panel
. I’ve finally got that in a state I like, so here it is.
Note that this Blueprint specifically requires Alarmo, since it uses some events that as far as I know are Alarmo-specific. If you want to integrate with a different alarm_control_panel
implementation, it should be mostly portable.
This automation handles all of the keypad behaviors except for the three emergency buttons. I may put together a separate Blueprint to tie those in with Noonlight, but that seemed like not a great idea as a default requirement.
This is my first time putting together a Blueprint, so I’m happy to take suggestions if there’s better ways to do something.
blueprint:
name: Ring Keypad Automations
description: Automations to use the Ring Keypad with an Alarm Panel integration. See https://github.com/ImSorryButWho/HomeAssistantNotes/blob/main/RingKeypadV2.md for more information.
domain: automation
input:
keypad:
name: Keypad Device
description: The device entry for the Ring keypad
selector:
device:
manufacturer: Ring
integration: zwave_js
alarm:
name: Alarm Control Panel entity
description: The Alarm Control Panel to synchronize the keypad with
selector:
entity:
domain: alarm_control_panel
integration: alarmo
selected_action_police:
name: Selected Action Police
description: Select the action for Police Button
default: []
selector:
action:
selected_action_fire:
name: Selected Action Fire
description: Select the action for Fire Button
default: []
selector:
action:
selected_action_medical:
name: Selected Action Medical
description: Select the action for Medical Button
default: []
selector:
action:
variables:
alarm: !input alarm
mode: parallel
max: 10
trace:
stored_traces: 0
trigger:
- platform: event
event_type: "zwave_js_notification"
event_data:
command_class: 111
device_id: !input keypad
event_type: 2
id: code_entered
- platform: event
event_type: "zwave_js_notification"
event_data:
command_class: 111
device_id: !input keypad
event_type: 3
id: keypad_disarm
- platform: event
event_type: "zwave_js_notification"
event_data:
command_class: 111
device_id: !input keypad
event_type: 5
id: keypad_arm_away
- platform: event
event_type: "zwave_js_notification"
event_data:
command_class: 111
device_id: !input keypad
event_type: 6
id: keypad_arm_home
- platform: event
event_type: zwave_js_notification
event_data:
command_class: 111
device_id: !input 'keypad'
event_type: 16
id: keypad_fire
- platform: event
event_type: zwave_js_notification
event_data:
command_class: 111
device_id: !input 'keypad'
event_type: 17
id: keypad_police
- platform: event
event_type: zwave_js_notification
event_data:
command_class: 111
device_id: !input 'keypad'
event_type: 19
id: keypad_medical
- platform: event
event_type: "alarmo_failed_to_arm"
event_data:
reason: "invalid_code"
id: invalid_code
- platform: event
event_type: "alarmo_failed_to_arm"
event_data:
reason: "open_sensors"
id: need_bypass
- platform: state
entity_id: !input alarm
to: disarmed
id: alarm_disarmed
- platform: state
entity_id: !input alarm
to: arming
id: alarm_arming
- platform: state
entity_id: !input alarm
to: armed_away
id: alarm_armed_away
- platform: state
entity_id: !input alarm
to: armed_home
id: alarm_armed_home
- platform: state
entity_id: !input alarm
to: pending
id: alarm_pending
- platform: state
entity_id: !input alarm
to: triggered
id: alarm_triggered
condition:
condition: not
conditions:
- condition: template
value_template: "{{ ('from_state' in trigger) and (trigger.from_state.state == 'unknown') }}"
action:
choose:
- conditions:
- condition: trigger
id:
- code_entered
- keypad_disarm
sequence:
- service: alarmo.disarm
data:
entity_id: !input alarm
code: >
{% if trigger.event.data.event_data != none %}
{{ trigger.event.data.event_data }}
{% endif %}
- conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: trigger
id: keypad_arm_away
- condition: trigger
id: keypad_arm_home
- condition: state
entity_id: !input alarm
state: disarmed
sequence:
- service: alarmo.arm
data:
entity_id: !input alarm
mode: '{{ trigger.id.split("_")[2] }}'
force: false
code: >
{% if trigger.event.data.event_data != none %}
{{ trigger.event.data.event_data }}
{% endif %}
- wait_for_trigger:
- platform: event
event_type: zwave_js_notification
event_data:
command_class: 111
device_id: !input keypad
event_type: 2
event_data: null
timeout: '5'
continue_on_timeout: false
- service: alarmo.arm
data:
entity_id: !input alarm
mode: '{{ trigger.id.split("_")[2] }}'
force: true
code: >
{% if trigger.event.data.event_data != none %}
{{ trigger.event.data.event_data }}
{% endif %}
- conditions:
- condition: trigger
id:
- invalid_code
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "9"
property_key: "1"
value: 100
- conditions:
- condition: trigger
id: need_bypass
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "16"
property_key: "1"
value: 100
- conditions:
- condition: trigger
id: alarm_disarmed
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "2"
property_key: "1"
value: 100
- conditions:
- condition: trigger
id: alarm_armed_away
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "11"
property_key: "1"
value: 100
- conditions:
- condition: trigger
id: alarm_armed_home
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "10"
property_key: "1"
value: 100
- conditions:
- condition: trigger
id: alarm_arming
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "18"
property_key: "7"
value: "{{ state_attr(alarm, 'delay') }}"
- conditions:
- condition: trigger
id: alarm_pending
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "17"
property_key: "7"
value: "{{ state_attr(alarm, 'delay') }}"
- conditions:
- condition: trigger
id: alarm_triggered
sequence:
- service: zwave_js.set_value
target:
device_id: !input keypad
data:
command_class: "135"
endpoint: "0"
property: "13"
property_key: "1"
value: 100
- conditions:
- condition: trigger
id: keypad_fire
sequence: !input selected_action_fire
- conditions:
- condition: trigger
id: keypad_police
sequence: !input selected_action_police
- conditions:
- condition: trigger
id: keypad_medical
sequence: !input selected_action_medical