Automating Morning Lights

So I wanted to automate that my lights will slowly turn on at a specified time. My code to turn the brightness of the lights slowly on is:

alias: increasing_brightness_full
  service: light.turn_on
        condition: numeric_state
        below: 255
          entity_id: light.kuchenlampe
          transition: '1'
          brightness: >
            {% set n = states.light.kuchenlampe.attributes.brightness + 25 %} {% if
            n > 255 %}
            {% else %}
              {{ n }}
            {% endif %}
          delay: 2
mode: single

If I try to save it it gives me the error message:

Message malformed: extra keys not allowed @ data[‘sequence’][0][‘service’]

Anyone knows how to solve this?

That doesn’t look quite right.

  • Your while loop is just testing the condition endlessly without doing anything.
  • You’re calling light.turn_on without passing any data to it.
  • You can use brightness_step_pct in your service call so no if required: service docs
  • You should use states('light.kuchenlampe') instead of states.light.kuchenlampe to avoid errors

Have a look at the example for a while loop.

Also, you might want to use an “until” loop instead. docs

This might get you there, although I haven’t tested it:

alias: increasing_brightness_full
  - alias: Turn up the brightness until it hits 255
        - service: light.turn_on
            entity_id: light.kuchenlampe
            transition: 1
            brightness_step_pct: 25
        - delay: 2
        - condition: state
          entity_id: light.kuchenlampe
          attribute: brightness
          state: 255
mode: single

If your light supports transition: you can just call that with a higher value and completely remove the automation :thinking:

Thx for the response.
Somehow I managed to get my code working. I’ll try yours too.