Zigbee2MQTT - Control Alarmo via keypad

Yeah I have. It looks correct to me (see example output):

Zigbee2MQTT:info  2022-09-07 09:22:57: MQTT publish: topic 'zigbee2mqtt/Kitchen Door Keypad', payload '{"action":"arm_all_zones","action_code":"1234","action_zone":23,"battery":100,"battery_low":false,"contact":true,"linkquality":0,"occupancy":false,"tamper":false,"temperature":20,"voltage":6300}'

Great work.

Do you have entry delay working?
Got it more or less all working except the entry delay.

As said in my original post:

This is what I am seeing.
Ofcourse you should have set up Alarmo to have an entry delay as well.

Ok yesā€¦
I did not know it went in more detail in the sensor option.

Works great. Thanks

Thank you @neliss! I was just attempting to rewrite the blueprint from @AndrejDelany with alarmo and came across this post. I am using this with an XFINITY XHK1-UE and noticed that your blueprint didnā€™t include a night mode. I attempted to add it to your blueprint and it works well as long as you donā€™t have an exit_delay set for night mode in alarmoā€¦ Not sure why setting the alarm_night_zones doesnā€™t clear the exit_delayā€¦ not sure if it is a device issue or a z2m issue, or if itā€™s me. I thought Iā€™d share my edits:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Alarmo Keypad Sync (gremblin)
  description: Xfinity XHK1-UE Keypad sync with Alarmo edited by gremblin
  domain: automation
  input:
    state_topic:
      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'
      selector:
        text: {}
    set_topic:
      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'
      selector:
        text: {}
    entity:
      name: Alarmo entity
      description: An alarm control panel entity from alarmo.
      selector:
        entity:
          domain: alarm_control_panel
          integration: alarmo
          multiple: false
trigger:
- platform: state
  entity_id: !input entity
  to: disarmed
  id: to_state_disarmed
- platform: state
  entity_id: !input entity
  to: arming
  id: to_state_arming
- platform: state
  entity_id: !input entity
  to: armed_away
  id: to_state_armed_away
- platform: state
  entity_id: !input entity
  to: armed_home
  id: to_state_armed_home
- platform: state
  entity_id: !input entity
  to: armed_night
  id: to_state_armed_night
- platform: state
  entity_id: !input entity
  to: armed_vacation
  id: to_state_armed_away
- platform: state
  entity_id: !input entity
  to: armed_custom_bypass
  id: to_state_armed_away
- platform: state
  entity_id: !input entity
  to: pending
  id: to_state_pending
- platform: state
  entity_id: !input entity
  to: triggered
  id: to_state_triggered
- platform: mqtt
  topic: !input state_topic
  id: keypad_command
- platform: event
  event_type: alarmo_failed_to_arm
  id: event_arm_failure
- platform: event
  event_type: alarmo_command_success
  id: event_command_success
condition: []
action:
- choose:
  - conditions:
    - condition: trigger
      id: to_state_disarmed
    sequence:
    - service: mqtt.publish
      data_template:
        topic: !input set_topic
        payload: "{\n  \"arm_mode\": \n  {\n    \"mode\": \"disarm\"\n  }\n}"
  - conditions:
    - condition: trigger
      id: to_state_arming
    sequence:
    - service: mqtt.publish
      data_template:
        topic: !input set_topic
        payload: "{\n  \"arm_mode\": \n  {\n    \"mode\": \"exit_delay\"\n  }\n}"
  - conditions:
    - condition: trigger
      id: to_state_armed_away
    sequence:
    - service: mqtt.publish
      data_template:
        topic: !input set_topic
        payload: "{\n  \"arm_mode\": \n  {\n    \"mode\": \"arm_all_zones\"\n  }\n}"
  - conditions:
    - condition: trigger
      id: to_state_armed_home
    sequence:
    - service: mqtt.publish
      data_template:
        topic: !input set_topic
        payload: "{\n  \"arm_mode\": \n  {\n    \"mode\": \"arm_day_zones\"\n  }\n}"
  - conditions:
    - condition: trigger
      id: to_state_armed_night
    sequence:
    - service: mqtt.publish
      data_template:
        topic: !input set_topic
        payload: "{\n  \"arm_mode\": \n  {\n    \"mode\": \"arm_night_zones\"\n  }\n}"
  - conditions:
    - condition: trigger
      id: to_state_pending
    sequence:
    - service: mqtt.publish
      data_template:
        topic: !input set_topic
        payload: "{\n  \"arm_mode\": \n  {\n    \"mode\": \"entry_delay\"\n  }\n}"
  - conditions:
    - condition: trigger
      id: to_state_triggered
    sequence:
    - service: mqtt.publish
      data_template:
        topic: !input set_topic
        payload: "{\n  \"arm_mode\": \n  {\n    \"mode\": \"in_alarm\"\n  }\n}"
  - conditions:
    - condition: trigger
      id: keypad_command
    sequence:
    - choose:
      - conditions:
        - condition: template
          value_template: '{{ trigger.payload_json.action == "disarm"  }}'
        sequence:
        - service: alarmo.disarm
          data:
            entity_id: !input entity
            code: '{{ trigger.payload_json.action_code }}'
            context_id: '{{ trigger.payload_json.action_transaction }}'
      - conditions:
        - condition: template
          value_template: '{{ trigger.payload_json.action == "arm_all_zones"  }}'
        sequence:
        - service: alarmo.arm
          data:
            entity_id: !input entity
            mode: away
            code: '{{ trigger.payload_json.action_code }}'
            context_id: '{{ trigger.payload_json.action_transaction }}'
      - conditions:
        - condition: template
          value_template: '{{ trigger.payload_json.action == "arm_day_zones"  }}'
        sequence:
        - service: alarmo.arm
          data:
            entity_id: !input entity
            mode: home
            code: '{{ trigger.payload_json.action_code }}'
            context_id: '{{ trigger.payload_json.action_transaction }}'
      - conditions:
        - condition: template
          value_template: '{{ trigger.payload_json.action == "arm_night_zones"  }}'
        sequence:
        - service: alarmo.arm
          data:
            entity_id: !input entity
            mode: night
            code: '{{ trigger.payload_json.action_code }}'
            context_id: '{{ trigger.payload_json.action_transaction }}'
  - conditions:
    - condition: trigger
      id: event_arm_failure
    sequence:
    - choose:
      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.reason == ''invalid_code'' }}'
        sequence:
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: "{\n  \"arm_mode\": \n  {\n    \"transaction\": {{ trigger.event.data.context_id
              }},\n    \"mode\": \"invalid_code\"\n  }\n}"
      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.reason == ''open_sensors'' }}'
        sequence:
        # `not_ready` doesnt do anything, so modifying behavor to beep for 1 sec, then disarm
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: >-
              {\n \"arm_mode\": \n {\n \"transaction\": {{ trigger.event.data.context_id }},\n \"mode\": \"entry_delay\"\n}\n}
        - delay: 1
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: >-
              {\n \"arm_mode\": \n {\n \"transaction\": {{ trigger.event.data.context_id }},\n \"mode\": \"disarm\"\n }\n}
      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.reason == ''not_allowed'' }}'
        - condition: template
          value_template: '{{ trigger.event.data.command|lower == ''disarm'' }}'
        sequence:
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: >-
              {\n \"arm_mode\": \n {\n \"transaction\": {{ trigger.event.data.context_id }},\n \"mode\": \"already_disarmed\"\n }\n}
  - conditions:
    - condition: trigger
      id: event_command_success
    sequence:
    - choose:
      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.action == ''arm'' }}'
        - condition: template
          value_template: '{{ trigger.event.data.context_id != null }}'
        - condition: template
          value_template: '{{ trigger.event.data.mode == ''away'' }}'
        sequence:
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: >-
              {\n \"arm_mode\": \n {\n \"transaction\": {{ trigger.event.data.context_id }},\n \"mode\": \"arm_all_zones\"\n }\n}
      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.action == ''arm'' }}'
        - condition: template
          value_template: '{{ trigger.event.data.context_id != null }}'
        - condition: template
          value_template: '{{ trigger.event.data.mode == ''home'' }}'
        sequence:
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: >-
              {\n \"arm_mode\": \n {\n \"transaction\": {{ trigger.event.data.context_id }},\n \"mode\": \"arm_day_zones\"\n }\n}
      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.action == ''arm'' }}'
        - condition: template
          value_template: '{{ trigger.event.data.context_id != null }}'
        - condition: template
          value_template: '{{ trigger.event.data.mode == ''night'' }}'
        sequence:
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: >-
              {\n \"arm_mode\": \n {\n \"transaction\": {{ trigger.event.data.context_id }},\n    \"mode\": \"arm_night_zones\"\n  }\n}
      - conditions:
        - condition: template
          value_template: '{{ trigger.event.data.action == ''disarm'' }}'
        - condition: template
          value_template: '{{ trigger.event.data.context_id != null }}'
        sequence:
        - service: mqtt.publish
          data_template:
            topic: !input set_topic
            payload: >-
              {\n \"arm_mode\": \n {\n \"transaction\": {{ trigger.event.data.context_id }},\n \"mode\": \"disarm\"\n }\n}
mode: parallel
max: 10

2 Likes

If you scroll a few posts back you will find another version modified for the XHK1-UE as well: Zigbee2MQTT - Control Alarmo via keypad - #16 by jsdphilly.
Iā€™m intending to make an update to my original blueprint to achieve a one-fits-all but I must admit I didnā€™t take the effort yetā€¦

1 Like

Thanks for pointing that out. I missed that post. I just tested it and it is acting goofy on my XHK1-UE. When disarmed, the keypad temporally goes into arm_night_zones, and I think it went into that mode briefly when arming away.

1 Like

your edit is what i was looking for. I donā€™t mine not setting an exit delay for night mode.

1 Like

This blueprint works great for me, but my Alarmo state is not represented on my Xfinity XHK1-UE keypad. Are you on the dev branch of z2m

no. Iā€™m on the main production branch of z2mā€¦ I just updated the blueprint with some tweeks I did. It shouldnā€™t fix your problem though. Yours should sync in itā€™s previous state.

This works on the Centralite 3400 keypad, but it never lets the keypad know that it is indeed armed.

For example, the keypad remains with 2 green lights (disarmed state), and doesnā€™t have any of the armed mode buttons lit.

The keypad is able to arm/disarm Alarmo though.

Any idea what could be wrong?

Same. I can arm/disarm the alarm from the keypad, but the keypad always shows green LEDā€™s like itā€™s disarmed. Iā€™m not sure if Z2M has the ability to manage the ā€œstateā€ of the keypad. Anyone else figure this out? I know Centralite 3400 keypad works fine under ST and Hubitat, but not HomeAssistantā€¦ HA is supposed to be better, but it fails to work with a ridiculously old keypad, kinda sad.

Hi,
My keypad (KEYZB-110 from Frient/Develco) works - but not always. I also see a lot of errors which I believe come from this blueprint (or are the result of a wrong configuration somewhere?).

My set-up:

  • HA, zigbee2mqtt, mosquitto: all running in docker (so no HA supervised). Should all be latest versions.
  • Alarmo set-up and running

I have the feeling it was running more stable when on HA supervised - but that might just be a feelingā€¦

A subset of the errors. Anyone can give me ideas where to look at?

2023-03-08 16:22:31.682 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: pending
2023-03-08 16:22:31.683 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.battery }}'
2023-03-08 16:22:31.685 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.voltage }}'
2023-03-08 16:22:31.687 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.action_code }}'
2023-03-08 16:22:31.689 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.action_transaction }}'
2023-03-08 16:22:31.691 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.action_zone }}'
2023-03-08 16:22:31.693 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.action }}'
2023-03-08 16:22:31.695 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.linkquality }}'
2023-03-08 16:22:31.697 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.last_seen }}'
2023-03-08 16:22:31.699 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.battery_low }}'
2023-03-08 16:22:31.701 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: pending, template: {{ value_json.battery_low }})
2023-03-08 16:22:31.703 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.tamper }}'
2023-03-08 16:22:31.704 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: pending, template: {{ value_json.tamper }})
2023-03-08 16:22:31.706 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: pending, template: {{ value_json['update']['state'] == "available" }})
2023-03-08 16:22:31.708 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: pending, template: {{ value_json['update']['installed_version'] }})
2023-03-08 16:22:31.709 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: pending, template: {{ value_json['update']['latest_version'] }})
2023-03-08 16:22:31.723 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'payload_json' when rendering '{{ trigger.payload_json.action == "disarm"  }}'
2023-03-08 16:22:31.726 WARNING (MainThread) [homeassistant.helpers.script] Error in 'choose[0]' evaluation: In 'template' condition: UndefinedError: 'dict object' has no attribute 'payload_json'
2023-03-08 16:22:31.729 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'payload_json' when rendering '{{ trigger.payload_json.action == "arm_all_zones"  }}'
2023-03-08 16:22:31.731 WARNING (MainThread) [homeassistant.helpers.script] Error in 'choose[0]' evaluation: In 'template' condition: UndefinedError: 'dict object' has no attribute 'payload_json'
2023-03-08 16:22:31.732 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'payload_json' when rendering '{{ trigger.payload_json.action == "arm_day_zones"  }}'
2023-03-08 16:22:31.736 WARNING (MainThread) [homeassistant.helpers.script] Error in 'choose[0]' evaluation: In 'template' condition: UndefinedError: 'dict object' has no attribute 'payload_json'
2023-03-08 16:22:45.220 WARNING (MainThread) [custom_components.alarmo.alarm_control_panel] Wrong code provided.
2023-03-08 16:22:51.608 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: triggered
2023-03-08 16:22:51.613 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: triggered
2023-03-08 16:22:51.617 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: triggered
2023-03-08 16:22:51.619 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: triggered
2023-03-08 16:22:51.620 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: triggered
2023-03-08 16:22:51.621 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: triggered

I just started using this (bought a new zigbee dongle just to be able to add linkind kp as zigbee2mqtt).

Two nice features would be:

  • to have the delay in/out bips - I made them with a speaker, but not the same thing
  • to have the device light up once the delay entry is triggered
1 Like

Do you know if there is a current keyboard that works with this blueprint? I canā€™t find any for sale.

Thanks.

Hive KEYPAD001 works well

Thanks for the warning, Iā€™ve been looking for it but itā€™s not sold in Europe, letā€™s see if one appears on AliExpress.

I bought mine from Ebay a few days ago. Only cost me Ā£19

1 Like

Itā€™s amazing, no zigbee keyboard is sold in Europe! I am looking for one tooā€¦

Plenty of Hive KEYPAD001ā€™s on eBay ā€¦