Automation to turn of lights when no one's home not triggering

Not sure why this isn’t working. Do I need a “from” as well?

- alias: "No one home -> lights off"
#  initial_state: False
  trigger:
    platform: state
    entity_id: group.devices
    to: 'not home'
    state: 'not home'
    for:
      minutes: 5
  action:
    - service: light.turn_off
      entity_id: group.all_lights

2 things:

  • leave out state: 'not home'
  • change to: 'not home' to to: 'not_home'
1 Like

ah, I can’t see how I missed that. I have another automation that uses not_home.

Thank you!

1 Like

“to” and “state” are the same thing, so no need to duplicate that in your config.

Anyways, looking at your config, change group.devices to group.all_devices and change not home to not_home and it should work. If you made a custom group of group.devices that may work as well, but I’m not sure how groups get their state so I’m not sure.