Created
          September 6, 2021 19:33 
        
      - 
      
- 
        Save evilpie/ce3d7b90b0584202b5efc4fe39d1d663 to your computer and use it in GitHub Desktop. 
    Home Assistant Alarm Control Panel integration with zigbee2mqtt physical keypad
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | alias: Keypad Arm | |
| description: Arm Home Assistant alarm using the keypad. | |
| trigger: | |
| - platform: mqtt | |
| topic: zigbee2mqtt/Keypad | |
| condition: | |
| - condition: template | |
| value_template: '{{ trigger.payload_json.action_code == "9998" }}' | |
| - condition: template | |
| value_template: '{{ trigger.payload_json.action == "arm_all_zones" }}' | |
| action: | |
| - service: mqtt.publish | |
| data_template: | |
| topic: zigbee2mqtt/Keypad/set | |
| payload: |- | |
| { | |
| "arm_mode": | |
| {"transaction": "{{ trigger.payload_json.action_transaction }}", | |
| "mode": "arm_all_zones" | |
| } | |
| } | |
| - service: alarm_control_panel.alarm_arm_away | |
| target: | |
| entity_id: alarm_control_panel.ha_alarm | |
| mode: single | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | alias: Keypad Disarm (Wrong Code) | |
| description: '' | |
| trigger: | |
| - platform: mqtt | |
| topic: zigbee2mqtt/Keypad | |
| condition: | |
| - condition: template | |
| value_template: '{{ trigger.payload_json.action_code != "9999" }}' | |
| - condition: template | |
| value_template: '{{ trigger.payload_json.action == "disarm" }}' | |
| action: | |
| - service: mqtt.publish | |
| data_template: | |
| topic: zigbee2mqtt/Keypad/set | |
| payload: |- | |
| { | |
| "arm_mode": | |
| {"transaction": "{{ trigger.payload_json.action_transaction }}", | |
| "mode": "invalid_code" | |
| } | |
| } | |
| - service: notify.persistent_notification | |
| data: | |
| message: Wrong disarm code entered on keypad! | |
| mode: single | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | alias: Keypad Disarm | |
| description: Disarm the Home Assistant alarm using the keypad. | |
| trigger: | |
| - platform: mqtt | |
| topic: zigbee2mqtt/Keypad | |
| condition: | |
| - condition: template | |
| value_template: '{{ trigger.payload_json.action_code == "9999" }}' | |
| - condition: template | |
| value_template: '{{ trigger.payload_json.action == "disarm" }}' | |
| action: | |
| - service: mqtt.publish | |
| data_template: | |
| topic: zigbee2mqtt/Keypad/set | |
| payload: |- | |
| { | |
| "arm_mode": | |
| { | |
| "transaction": "{{ trigger.payload_json.action_transaction }}", | |
| "mode": "disarm" | |
| } | |
| } | |
| - service: alarm_control_panel.alarm_disarm | |
| target: | |
| entity_id: alarm_control_panel.ha_alarm | |
| mode: single | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | alias: Notify Armed Away | |
| description: '' | |
| trigger: | |
| - platform: state | |
| entity_id: alarm_control_panel.ha_alarm | |
| to: armed_away | |
| condition: [] | |
| action: | |
| - service: mqtt.publish | |
| data: | |
| topic: zigbee2mqtt/Keypad/set | |
| payload: '{ "arm_mode": { "mode": "arm_all_zones" } }' | |
| mode: single | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | alias: Notify Arming | |
| description: '' | |
| trigger: | |
| - platform: state | |
| entity_id: alarm_control_panel.ha_alarm | |
| to: arming | |
| condition: [] | |
| action: | |
| - service: mqtt.publish | |
| data: | |
| topic: zigbee2mqtt/Keypad/set | |
| payload: '{ "arm_mode": { "mode": "exit_delay" } }' | |
| mode: single | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | alias: Notify Disarmed | |
| description: '' | |
| trigger: | |
| - platform: state | |
| entity_id: alarm_control_panel.ha_alarm | |
| to: disarmed | |
| condition: [] | |
| action: | |
| - service: mqtt.publish | |
| data: | |
| topic: zigbee2mqtt/Keypad/set | |
| payload: '{ "arm_mode": { "mode": "disarm" } }' | |
| mode: single | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment