Dim/Brighten light on button Long Press

You might want to check out my last post: Dim/Brighten light on button Long Press - #40 by rankjie

Hi everyone,

When I long press on the 3rd button of my Zigbee remote, it doesn’t do anything until I release the button. Then the light brightness increases all the way to 100% and I cannot even turn off the light or decrease the brightness.

Can anyone help?

Thanks!

alias: Masterbdrm Remote Increase Brightness
description: β€œβ€
triggers:

  • device_id: ac9777598764b4946cd56c740b68bf87
    domain: zha
    type: remote_button_long_press
    subtype: button_3
    trigger: device
    id: hold
    conditions:
    actions:
  • repeat:
    sequence:
    - action: light.turn_on
    metadata: {}
    data:
    brightness_step_pct: 1
    target:
    entity_id: light.mss565_24f0_dimmer_switch
    while:
    - condition: trigger
    id:
    - hold
    mode: restart

Ok, I got it to work this way. Single click 3rd button for it to gradually increase brightness, and double click it (or any other button) to stop the increase. The 4th button works the same way for gradual decrease of brightness.

alias: Masterbdrm Light Dim/Bright Continuous
description: β€œβ€
triggers:

  • device_id: ac9777598764b4946cd56c740b68bf87
    domain: zha
    type: remote_button_short_press
    subtype: button_3
    trigger: device
    id: hold
  • device_id: ac9777598764b4946cd56c740b68bf87
    domain: zha
    type: remote_button_double_press
    subtype: button_3
    trigger: device
    id: stop
  • device_id: ac9777598764b4946cd56c740b68bf87
    domain: zha
    type: remote_button_short_press
    subtype: button_4
    trigger: device
    id: Dim
  • device_id: ac9777598764b4946cd56c740b68bf87
    domain: zha
    type: remote_button_double_press
    subtype: button_4
    trigger: device
    id: Dim stopped
  • device_id: ac9777598764b4946cd56c740b68bf87
    domain: zha
    type: remote_button_short_press
    subtype: button_1
    trigger: device
    id: button 1
  • device_id: ac9777598764b4946cd56c740b68bf87
    domain: zha
    type: remote_button_short_press
    subtype: button_2
    trigger: device
    id: button 2
    conditions:
    actions:
  • choose:
    • conditions:
      • condition: trigger
        id:
        • hold
          sequence:
      • repeat:
        sequence:
        - action: light.turn_on
        metadata: {}
        data:
        brightness_step_pct: 1
        target:
        entity_id: light.mss565_24f0_dimmer_switch
        - delay:
        hours: 0
        minutes: 0
        seconds: 0
        milliseconds: 250
        until:
        - condition: trigger
        id:
        - stop
        - Dim
        - Dim stopped
        - button 1
        - button 2
    • conditions:
      • condition: trigger
        id:
        • Dim
          sequence:
      • repeat:
        sequence:
        - action: light.turn_on
        metadata: {}
        data:
        brightness_step_pct: -1
        target:
        entity_id: light.mss565_24f0_dimmer_switch
        - delay:
        hours: 0
        minutes: 0
        seconds: 0
        milliseconds: 250
        until:
        - condition: trigger
        id:
        - hold
        - stop
        - Dim stopped
        - button 1
        - button 2
        mode: restart

I have been struggling to get my Shelly i4 to dim/brighten my wled in automations in HA. Got it working with a custom button card but wanted to use a momentary switch and this worked perfectly so thank you very much.