Dim/Brighten light on a single button long press

Hello,
I found in this wonderful forum a script that allows me to dim/brighten a light with hue dimmer v2.

this is the script:

Light UP
 
alias: Script Name
sequence:
  - service: light.turn_on
    target:
      device_id:
        - 8b968b12da6a0a68feed64xxxxxxxxxx
        - b076814025062710d58d64xxxxxxxxxx
    data:
      transition: 1
      brightness: >
        {% if not state_attr('light.nume_bec', 'brightness') == None %} {% set
        n = state_attr('light.nume_bec', 'brightness') + 25 %}  {% if n > 255
        %}
          255
        {% else %}
          {{ n }}
        {% endif %} {% else %}  25  {% endif %}
mode: single
 
Light Down
 
alias: Script Name
sequence:
  - service: light.turn_on
    target:
      device_id:
        - 8b968b12da6a0a68feed64xxxxxxxxxx
        - b076814025062710d58d64xxxxxxxxxx
    data:
      transition: 1
      brightness: >
        {% if not state_attr('light.nume_bec', 'brightness') == None %} {% set
        n = state_attr('light.nume_bec', 'brightness') - 25 %}  {% if n > 255
        %}
          255
        {% else %}
          {{ n }}
        {% endif %} {% else %}  0  {% endif %}
mode: single

I also own a Aqara mini switch and I was wondering how I could make a automation to switch between the two scripts by long pressing the aqara button. Basically what I want to do is:

long press = brighten
releases and
long press = dim

Thanks for any help!

1 Like

Not working :frowning:
image

You would think there are enough clues but yet your image shows action

Can you now please stop spamming the forum about your dimming not working?

1 Like