Z2H Aqara long press automation isn't triggering

I got one of the new Aqara action buttons. Got it added to Z2H and the single ‘click’ works great but when I try to use the “long” press (hold/release) I can’t get the automation to trigger. At first I had a single automation but for debugging purposes here is a single single action:

alias: Aqara Switch - Long Hold Turn Off All and Turn On lr_small_light
description: >-
  Turns off all lights in the living room and turns on lr_small_light on a long
  hold.
triggers:
  - entity_id: sensor.aqara_lr_lights_aqara_lr_lights_click
    attribute: click
    to: hold
    trigger: state
conditions: []
actions:
  - data:
      message: Long hold triggered
      level: info
    action: system_log.write
  - target:
      entity_id: switch.livingroom_small_light
    action: switch.toggle
    data: {}
mode: single

LR Small Light is a tasmota switch (switch.livingroom_small_light).

Looks like the trigger is not triggering as I don’t see the log entry.

Have you read the breaking changes in Z2M 2.0.0 and greater? The link you posted even says that the click event is deprecated and that you should use the action event (which is also not enabled by default in Z2M >2.0)

I’m still on v1 ( Zigbee2MQTT version
1.27.0-dev commit: 36a4754)

This automation works for the “single” click but not for the “hold/release” (what I’m calling long-press):

alias: >-
  Aqara Switch - Toggle Lights on Single Click, Turn Off All and Turn On
  lr_small_light on Long Press
description: >
  Single click toggles all lights in the living room. Long press turns off all
  lights and turns on lr_small_light.
triggers:
  - entity_id: sensor.aqara_lr_lights_aqara_lr_lights_click
    attribute: click
    to: single
    id: single_click
    trigger: state
  - entity_id: sensor.aqara_lr_lights_aqara_lr_lights_click
    attribute: click
    to: hold
    id: long_press_hold
    trigger: state
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: single_click
        sequence:
          - action: light.toggle
            data: {}
            target:
              area_id: living_room
          - action: switch.toggle
            metadata: {}
            data: {}
            target:
              area_id: living_room
      - conditions:
          - condition: trigger
            id: long_press_hold
        sequence:
          - target:
              entity_id: light.lr_small_light
            action: light.turn_on
            data: {}
mode: single

Check the Z2M debug logs to see what event your button is sending on hold

It’s “hold” and “release” I believe. I can see that in the Device → State window.

You trying the listing event?
Long press is a different code than a short one

Go to developer tools - event - select button - select start listen- press button long. See what you get. Press short see what you get.

I held the button for about 2 seconds … Looks like ‘hold’ and ‘release’ in the payload.

from Z2M:

info 2025-02-24 11:38:57MQTT publish: topic 'zigbee2mqtt/aqara_lr_lights', payload '{"action":"hold","battery":99,"click":null,"device_temperature":26,"last_seen":"2025-02-24T16:38:57.251Z","linkquality":255,"power_outage_count":12,"voltage":3195}'
info 2025-02-24 11:38:57MQTT publish: topic 'zigbee2mqtt/aqara_lr_lights', payload '{"action":"","battery":99,"click":null,"device_temperature":26,"last_seen":"2025-02-24T16:38:57.251Z","linkquality":255,"power_outage_count":12,"voltage":3195}'
info 2025-02-24 11:38:57MQTT publish: topic 'zigbee2mqtt/aqara_lr_lights/action', payload 'hold'
debug 2025-02-24 11:38:57Received Zigbee message from 'aqara_lr_lights', type 'attributeReport', cluster 'genMultistateInput', data '{"presentValue":255}' from endpoint 1 with groupID null
info 2025-02-24 11:38:57MQTT publish: topic 'zigbee2mqtt/aqara_lr_lights', payload '{"action":"release","battery":99,"click":null,"device_temperature":26,"last_seen":"2025-02-24T16:38:57.710Z","linkquality":255,"power_outage_count":12,"voltage":3195}'
info 2025-02-24 11:38:57MQTT publish: topic 'zigbee2mqtt/aqara_lr_lights', payload '{"action":"","battery":99,"click":null,"device_temperature":26,"last_seen":"2025-02-24T16:38:57.710Z","linkquality":255,"power_outage_count":12,"voltage":3195}'
info 2025-02-24 11:38:57MQTT publish: topic 'zigbee2mqtt/aqara_lr_lights/action', payload 'release'

Tried this, but subscribing to “button” doesn’t seem to catch any events, and “*” catches so many that it’s impossible to find this specific event.

Can you post the code that does work for the “single” action?

Just click above link and get your info from your device.

Like below. (Hold is long cklik) (single is tap)

@d921

The single action of this works, working on the “hold”

alias: >-
  Aqara Switch - Toggle Lights on Single Click, Turn Off All and Turn On
  lr_small_light on Long Press
description: >
  Single click toggles all lights in the living room. Long press turns off all
  lights and turns on lr_small_light.
triggers:
  - entity_id: sensor.aqara_lr_lights_aqara_lr_lights_click
    attribute: click
    to: single
    id: single_click
    trigger: state
  - entity_id: sensor.aqara_lr_lights_aqara_lr_lights_click
    attribute: click
    to: hold
    id: long_press_hold
    trigger: state
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: single_click
        sequence:
          - action: light.toggle
            data: {}
            target:
              area_id: living_room
          - action: switch.toggle
            metadata: {}
            data: {}
            target:
              area_id: living_room
      - conditions:
          - condition: trigger
            id: long_press_hold
        sequence:
          - target:
              entity_id: light.lr_small_light
            action: light.turn_on
            data: {}
mode: single
``

Can you be more specific as to which link?

I’m honestly not sure why the single press seems to work. I’m also not sure how exactly to do it using the HA entity, because I don’t use the Z2M HA integration.

But as an alternative, I think you could use an MQTT trigger like this:

- trigger:  mqtt
  topic: "zigbee2mqtt/aqara_lr_lights/action"
  payload: "hold"