Please correctly format your code
Corrected like you wished.
/Jerry
I think you’re missing a few lines in there, two automations have merged into one? And you might want to check some other examples from the forum as you seem to have indentations wrong. These are vitally important in YAML (eg the conditions in your example).
Take a look at my example below:
- alias: "Switch on kitchen lights at sunset if somone is home"
trigger:
- platform: sun
event: sunset
offset: "-00:30:00"
condition:
condition: and
conditions:
- condition: state #if smart lighting automations are enabled via the frontend
entity_id: input_boolean.smart_lighting
state: 'on'
- condition: state #if someone is actually home
entity_id: group.all_devices
state: 'home'
action:
- entity_id: light.piano_lamp
service: homeassistant.turn_on
- entity_id: light.kitchen_corner
service: homeassistant.turn_on
Thanks, will take a look at this.
also, conditions are logic ‘AND’ by default so you don’t need to include that code
I include it more for my own benefit… I’m often checking my own work months later to figure out why a complex automation is doing something the way it is and this helps me out
That’s very elegant!!!
Thanks for sharing