I have a really simple config to turn a light on and off at certain times of the day. I want to add more lights later, at the moment I have just one. My config:
# cat /home/homeassistant/.homeassistant/automations.yaml
- id: lights1
alias: lights on at dawn
trigger:
- at: 06:40
platform: time
condition: []
action:
- data: {}
entity_id: lightsgroup.living_room_lights
service: living_room_lights.turn_on
- id: lights2
alias: lights off before work
trigger:
- at: 08:30:00
platform: time
action:
- entity_id: lightsgroup.living_room_lights
service: living_room_lights.turn_off
condition: []
- id: lights3
alias: lights on at dusk
trigger:
- event: sunset
offset: -01:00:00
platform: sun
action:
- entity_id: lightsgroup.living_room_lights
service: living_room_lights.turn_on
- id: lights4
alias: lights off late
trigger:
- at: '23:00:00'
platform: time
action:
- entity_id: lightsgroup.living_room_lights
service: living_room_lights.turn_off
condition: []
If your lights are grouped in a group called living_room_lights. Otherwise you will have to specify the lights individually. I believe you also have to provide light data such as brightness.
Also, anything with a time or time offset (triggers/conditions) need the full time data (eg. '00:06:40') and must include the single quotes.
For the automations that don’t have any conditions, you can remove the line condition: []
I figured that was from the frontend. I’ve never used the frontend editor and personally I think it causes more confusion than is helpful. I always edit my files from a text editor.
From the rest of your configuration it looks like you have a switch not a light, so change your light. references in the automation to switch.. Then you don’t need to provide light data. also I’m not sure how the last part of your configuration works. does that manually define a group? Just for simplicity, I would try editing your automation and just call the switch directly since all you have is one right now. then once you add others, you can create a group and switch them all on/off.
One correction: there is no turn_on and turn_off service for groups. You need to use the services homeassistant.turn_on and homeassistant.turn_off instead.