Dimm Zwave lights through Xiaomi Zigbee button - endless loop

Hello,
I’m pretty new with HA. I just finished the integration of all my hardware and start now with automation.
YAML coding is pretty new too, and I would like to ask for help since I do not get what’s going wrong with my code.
I want to use a Xiaomi switch button to dim my outside light which hangs on a qubino zwave modul.
My automation works for turn on and turn of. As soon as I activate following code which was intended for dimming, I can not turn of the light anymore, it turns of for a second or two and turns on immediatly.
What am I doing wrong?
Thanks for your help:

 alias: Lumière terrasse - variateur
description: ""
trigger:
  - device_id: 5ea13cb36902efde507b28fcfd9548f4
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: button
  - device_id: 5ea13cb36902efde507b28fcfd9548f4
    domain: zha
    platform: device
    type: remote_button_long_release
    subtype: button
    id: trigger_01
condition:
  - condition: device
    type: is_off
    device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
    entity_id: light.qubino_variateur_01
    domain: light
action:
  - type: turn_on
    device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
    entity_id: light.qubino_variateur_01
    domain: light
    brightness_pct: 5
  - repeat:
      sequence:
        - device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
          domain: light
          entity_id: light.qubino_variateur_01
          type: brightness_increase
      until:
        - condition: trigger
          id: trigger_01
mode: single

@lio0909 you need to add a trigger ID to your button press trigger and make sure that your turn on action has that as a condition otherwise when your release trigger occurs you’ll also be causing the turn on action to occur.

Thank you @timnolte
I made changes accordingly but this doesn’t really help. I’ve put a timer in the dimm loop and now I can see that even I have released button the routine still goes on. When I turn off the light, it starts again to dim it up back to 100%.
Why is the remote_button_long_release not breaking the until loop? What do I miss?
Thanks for your help

My code looks like this:

alias: Lumière terrasse - variateur
description: ""
trigger:
  - device_id: 5ea13cb36902efde507b28fcfd9548f4
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: button
    id: trigger_start
  - device_id: 5ea13cb36902efde507b28fcfd9548f4
    domain: zha
    platform: device
    type: remote_button_long_release
    subtype: button
    id: trigger_stop
condition:
  - condition: device
    type: is_off
    device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
    entity_id: light.qubino_variateur_01
    domain: light
action:
  - type: turn_on
    device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
    entity_id: light.qubino_variateur_01
    domain: light
    brightness_pct: 5
  - repeat:
      sequence:
        - device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
          domain: light
          entity_id: light.qubino_variateur_01
          type: brightness_increase
        - delay:
            seconds: 1
        - condition: trigger
          id: trigger_start
      until:
        - condition: trigger
          id: trigger_stop
mode: single

@lio0909 that automation doesn’t look quite right. Take a look through this thread as I think it has some examples to help you out.

I’ll take a look later tonight to see if I can refactor yours to what should work.

THanks for the thread, I found out what was wrong: mode needed to be set on restart and now it works, my code looks like this:

alias: Lumière terrasse - variateur
description: ""
trigger:
  - device_id: 5ea13cb36902efde507b28fcfd9548f4
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: button
    id: trigger_start
  - device_id: 5ea13cb36902efde507b28fcfd9548f4
    domain: zha
    platform: device
    type: remote_button_long_release
    subtype: button
    id: trigger_stop
condition: []
action:
  - condition: trigger
    id: trigger_start
  - type: turn_on
    device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
    entity_id: light.qubino_variateur_01
    domain: light
    brightness_pct: 5
    enabled: true
  - repeat:
      sequence:
        - device_id: 5151c83a7bb55476c4a8e54ae1f2ff18
          domain: light
          entity_id: light.qubino_variateur_01
          type: brightness_increase
        - delay:
            seconds: 1
      until:
        - condition: trigger
          id: trigger_stop
mode: restart

From my understanding without mode restart the automation wasn’t processed again when second trigger (release button) was fired.

1 Like