Automations in Lovelace not working for me

- id: '9572774725190'
  alias: Rise and Shine
  trigger:
  - at: '07:00:00'
    platform: time
  condition: []
  action:
  - data:
      brightness_pct: '100'
      entity_id: light.hue_color_lamp_2
      kelvin: '8000'
      transition: '150'
    service: light.turn_off
- id: '8553975421935'
  alias: Turn Out Lights Morning
  trigger:
  - at: '08:00:00'
    platform: time
  condition: []
  action:
  - data:
      entity_id: light.hue_color_lamp_2
    service: light.turn_on
- id: '1552775490759'
  alias: Turn On Evening Lights
  trigger:
  - event: sunset
    offset: '-00:45:00'
    platform: sun
  condition: []
  action:
  - data:
      brightness_pct: '90'
      color_name: red
      entity_id: light.bedroom
      transition: '10'
    service: light.turn_on

First off, super noob here, got my first bulb yesterday! So here’s my automations.yaml. I set it up in the GUI config but when my sunset automation didn’t trigger I adjusted them to work on a timeframe to see if they’d work that way to no avail. Have you guys got any suggestions on things I may try to get these automations working properly?

The second one the service probably should be light.turn_off
Check the entity_id is correct…

Hey @DavidFW1960, that’s correct I was just using that middle one to test after the automations didn’t go off, but I’ll edit it above to show my original. Thank you.

It looks like you may have manually added some lines and got the indenting incorrect. I think the first one should be this, assuming you want to use “light.turn_off” in the morning. :wink: All indenting should be only 2 spaces for yaml.

- id: '1552774765290'
  alias: Rise and Shine
  trigger:
  - at: '07:00:00'
    platform: time
  condition: []
  action:
  - data:
    brightness_pct: '100'
    entity_id: light.hue_color_lamp_2
    kelvin: '8000'
    transition: '150'
    service: light.turn_off

Thanks Bosborne, Rise and Shine worked perfectly this morning and I stuck around to make sure they got turned off afterward too and it worked great! Thank you guys

that’s not entirely correct…some subsections may need indented two more spaces.

I’m kind of surprised that it worked as you have it since the docs say you need to have the stuff under “data:” indented by two more spaces as you had it originally.

see here:

https://www.home-assistant.io/components/light/

and if I enter it into my config in the way you now have it according to the code above then I get errors when I do the config check.

Y=In your example, all indentations were 2 spaces. Each level is indented 2 spaces more than the one above.

You are correct. I thought it needed to be 2 spaces. I just checked the YAML specification. The indentation needs to be consistent though and there were a mix of 2 & 4 spaces in the first item. There are some enterprise software products using YAML that insist on 2 spaces.

https://yaml.org/spec/1.2/spec.html#id2777534

yes there were but that’s the way it is supposed to be.

for example in the “normal” layout with the way most people manually write the code and per the examples in the docs then the syntax would be:

action:
  - service: light.turn_off
    data:
      brightness_pct: '100'
      entity_id: light.hue_color_lamp_2
      kelvin: '8000'
      transition: '150'

compare that to the way it was written in the first post and you’ll see that the only difference is that the “service:” call is moved to the bottom but aside from that all of the indentation is the same (a mix of two and four spaces).

You forgot the "- " before data. That shifts data & below 2 more spaces.
Adding the missing dash & space, the level below should line up with the d in data.

No i didn’t. It isn’t supposed to have a dash in front of it.

the - is there to denote a list of something. in this case the list is of service calls. The service calls include a data config. So the data above is part of the service call. If I add a - in front of data the parser will think I’m starting a new list entry and give an error because i didn’t give any data for the first service call.

look at the link I posted above for the light component.