Using Aqara smart switch as Condition rather than a Trigger

Hello,

I would like to use the following

id: <redacted>
domain: deconz
platform: device
subtype: turn_on
type: remote_button_long_press

in my automation as a Condition in a repeat “Until” “remote_button_long_press” loop on my aqara smart switch. I can select differing button press events in the Trigger section but cannot select this as a “Condition” in the GUI, I can only select temperature or battery sensors for the aqara smart switch. Is there any particular reason why i cannot select this as a condition? Is this achievable in this way? I have tried to select it as a device or under state > entity in “Add Condition” but the options are missing compared to Trigger > Device > “Aqara Smart Switch”

Works under Triggers:

Fails under Conditions:

Thank you

You can only use a state in a condition.
The press of the button sends an event and is not a state.
You can create a input helper which you can set via automation by the aqara switch

1 Like

Thank you for your input. I have this working.

I created an automation to capture a “short press event” and then used the “current” attribute to use in the until repeat loop. Had to use numeric_state as normal state didn’t work as a condition using the “current” attribute.

automation.emergency_switch_input_helper

device_id: <redacted>
domain: deconz
platform: device
type: remote_button_short_press
subtype: turn_on

condition: []

action:
  - service: notify.living_room_tv
    data:
      message: Notice has been cancelled
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - stop: input helper for Bin Collection
mode: single

snippet condition to interrupt repeat / loop in new Bin collection automation.

automation.bin_collection

repeat:
  until:
    - condition: or
      conditions:
        - type: is_open
          condition: device
          device_id: <redacted>
          entity_id: binary_sensor.front_door_contact_sensor
          domain: binary_sensor
        - condition: template
          value_template: "{{ repeat.index == 10 }}"
        - condition: numeric_state
          entity_id: automation.emergency_switch_input_helper
          attribute: current
          above: 0