How to continue raising brightness with the button pressed?

alias: Arcoiris Up
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 908a92f4814ba968efd862bce702f87e
    type: action
    subtype: brightness_move_up
    discovery_id: 0x5c0272fffe83e769 action_brightness_move_up
condition: []
action:
  - device_id: ab087facff6156cb98bf04aecde13e87
    domain: light
    entity_id: light.arcoiris
    type: brightness_increase
mode: single

The way I have it, even if I keep it pressed it only goes up once.
I have to stop pressing (at that moment I received “brightness_stop”) and press again.

I Tried

alias: Arcoiris Up
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 908a92f4814ba968efd862bce702f87e
    type: action
    subtype: brightness_move_up
    discovery_id: 0x5c0272fffe83e769 action_brightness_move_up
condition: []
action:
  - device_id: ab087facff6156cb98bf04aecde13e87
    domain: light
    entity_id: light.arcoiris
    type: brightness_increase
  - repeat:
      until:
        - condition: state
          entity_id: sensor.boton_milor_action
          state: brightness_stop
          attribute: action
      sequence:
        - device_id: ab087facff6156cb98bf04aecde13e87
          domain: light
          entity_id: light.arcoiris
          type: brightness_increase
mode: single

But it crash HA… missing a break?

try adding a slight delay (250ms?) after the brightness increase action.

Thanks. I’m having a little trouble understanding yaml, especially spaces and tabulations… let’s see the new test.

alias: Arcoiris Up
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 908a92f4814ba968efd862bce702f87e
    type: action
    subtype: brightness_move_up
    discovery_id: 0x5c0272fffe83e769 action_brightness_move_up
condition: []
action:
  - device_id: ab087facff6156cb98bf04aecde13e87
    domain: light
    entity_id: light.arcoiris
    type: brightness_increase
  - repeat:
      until:
        - condition: state
          entity_id: sensor.boton_milor_action
          state: brightness_stop
          attribute: action
      sequence:
        - device_id: ab087facff6156cb98bf04aecde13e87
          domain: light
          entity_id: light.arcoiris
          type: brightness_increase
        - delay: 
            milliseconds: 500
mode: single

Unfortunately there was no end!

I have solved it with two scripts and three automation (although the brightness goes up or down very fast, it seems that it adds or subtracts 10 to 100 or 0)

alias: 'Arcoiris Brightness Up '
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 908a92f4814ba968efd862bce702f87e
    type: action
    subtype: brightness_move_up
    discovery_id: 0x5c0272fffe83e769 action_brightness_move_up
condition: []
action:
  - service: script.aumentar_brillo_de_acoiris
mode: single
alias: 'Arcoiris Brightness Down '
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 908a92f4814ba968efd862bce702f87e
    type: action
    subtype: brightness_move_down
    discovery_id: 0x5c0272fffe83e769 action_brightness_move_down
condition: []
action:
  - service: script.disminuir_brillo_de_acoiris
mode: single
alias: Arcoiris Brightness Stop
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: 908a92f4814ba968efd862bce702f87e
    type: action
    subtype: brightness_stop
    discovery_id: 0x5c0272fffe83e769 action_brightness_stop
condition: []
action:
  - service: script.turn_off
    target:
      entity_id: script.aumentar_brillo_de_acoiris
  - service: script.turn_off
    target:
      entity_id: script.disminuir_brillo_de_acoiris
mode: single
sequence:
  - repeat:
      count: '10'
      sequence:
        - device_id: ab087facff6156cb98bf04aecde13e87
          domain: light
          entity_id: light.arcoiris
          type: brightness_increase
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
mode: single
alias: Aumentar brillo de Acoiris
icon: mdi:brightness-7
alias: Disminuir brillo de Acoiris
sequence:
  - repeat:
      count: '10'
      sequence:
        - device_id: ab087facff6156cb98bf04aecde13e87
          domain: light
          entity_id: light.arcoiris
          type: brightness_decrease
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
mode: single
icon: mdi:brightness-7

I hope it can help someone. Both devices are zigbee and I use zigbee2mqtt with legasy: false

1 Like