Automation, if light is on then turn light off

I have light that is dimmable, and for turn it on i must set brightnes…

I have automation set like this now.

  action:
  - data:
      brightness: '10'
      entity_id: light.luc_pod_pultom
    service: light.turn_on

I want have if option. like this, if light is on then turn it off.
But if light is off turn on brightness to 10 (like it set now)

Maybe is even option to incresse brigthness every time is autiomation triggered?

condition:

To increase brightness;

service: light.turn_on
entity_id: light.yourlight
data_template:
  brightness: '{{states.light.yourlight.attributes.brightness + 10}}'

Problem is that is light is off then i can not see valute that is 0

That’s why you need to use a condition as @Vennerberg (the man of few words :joy: ) suggested

1 Like

Does anyome have example of this automation with similar condition?
Sorry I am a little noob at this :slight_smile:

That’s so cool…

If you check the docs you get it.

      - condition: state
        entity_id: light.room1
        state: 'on'

Not exactly like this, but I hope you get the point