Light brightness toggle increase, then decrease and vice versa

Hello everyone,

I’d like to create an automation that, each time when triggered, gradually increases the brightness of a lamp to the maximum (e.g., in 20% increments) and then decreases it by the same amount back to the minimum, and so on.

Is something like this possible?

Thank you so much for your help and tips!

Not sure if I described it unequivocally: my problem is that it has to be the exact same trigger (a physical switch).
:see_no_evil:

It should be possible, but it’s highly dependent on your hardware (switch or button) sending both a hold & a release event. Most devices support hold, but very few support release.

This blueprint does what you want…

If you use another switch, you could either adapt the blueprint, or you could ask an AI to create the automation from this blueprint :hugs:

Hi @aceindy ,

thank you for your tip, but following your link leads to blueprints actually using 2 (!) automations using 2 (!) buttons

One (button-up) triggering a button-up-loop-dimmer -action and another button (button-down) as button-down-loop-dimmer-action.

But as described I would need 1 (!) automation using only 1 (!) button dimming down and back up after reaching a defined minimum and then down again and so on…

Or in other words: „toggle through all brightness-levels up-and-down all time.“

Pretty sure this would need complex templating involving maybe a number helper entity. But this is far beyond my capabilities.

And that’s why I‘m asking as I couldn’t find anything comparable anywhere … :wink:

Thank you for your reply too, @ShadowFist !

Well, it is no standard button using an integration or so. When it’s pushed, It just triggers a HA webhook I could use as a trigger. There’s nothing else.

I could see this working.
Just add the button press as trigger

description: ""
mode: single
triggers: []
conditions: []
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.going_up
            state:
              - "on"
        sequence:
          - action: light.turn_on
            metadata: {}
            target:
              entity_id: light.light
            data:
              brightness: "{{ state_attr('light.light', 'brightness') | int + 51 }}"
          - condition: state
            state:
              - "255"
            entity_id: light.light
            attribute: brightness
          - action: input_boolean.turn_off
            metadata: {}
            target:
              entity_id: input_boolean.going_up
            data: {}
    default:
      - action: light.turn_on
        metadata: {}
        target:
          entity_id: light.light
        data:
          brightness: "{{ state_attr('light.light', 'brightness') | int - 51 }}"
      - condition: state
        state:
          - "0"
        entity_id: light.light
        attribute: brightness
      - action: input_boolean.turn_on
        metadata: {}
        target:
          entity_id: input_boolean.going_up
        data: {}

Each time you press it increases or decreases by some amount? And reverses when it hits 100% or zero?

Use an input binary to track direction?

Or is it press and hold a button and it changes until released?

If it doesn’t send another webhook when it’s released, then you will have to go with fixed brightness steps like the example @Hellis81 posted above.