Presence Based Automation

I’m pretty new to this so please forgive me if this has already been covered somewhere, I can’t seem to find it.

I’ve set up an automation to turn on my garage lights for 10 minutes when arriving after dark. The automation works fine with a single device being tracked ( my phone via asuswrt ) as soon as I add in more tracked devices such as my wifes phone it will no longer trigger. I would like the automation to function reagardeless of the other devices state. If i’m home and my wife arrives later in the evening I would still like the lights to come on. I’m hoping I’ve missed something easy.

There are no errors in the logs, it just doesn’t fire.

alias: 'Turn Garage Light when I arrive after sunset'
trigger:
  platform: state
  entity_id: group.all_devices
  from: 'not_home'
  to: 'home'
condition:
  condition: and
  conditions:
    - condition: sun
      after: sunset
      after_offset: "-0:30:00"
    - condition: state
      entity_id: group.garage_lights
      state: 'off'
    - condition: state
      entity_id: input_boolean.automation_override
      state: 'off'
action:
  service: homeassistant.turn_on
  entity_id: "script.get_home_sunset"


get_home_sunset:
  alias: "get home"
  sequence:
    # Cancel old off timer
    - service: script.turn_off
      data:
        entity_id: "script.garage_off"
    - service: homeassistant.turn_on
      data:
        entity_id: 
          - group.garage_lights
    - service: script.turn_on
      data:
        entity_id: "script.garage_off"



    garage_off:
      alias: "Turn off garage lights after 10 minutes"
      sequence:
        - delay:
            minutes: 10
        - service: homeassistant.turn_off
          data:
            entity_id:
              - group.garage_lights
1 Like

“removed after I fixed the perforated text in the first post”

Change your trigger from the group to

device_tracker.mine, device_tracker.hers

That way it will trigger when either hers or mine goes from not home to home.

Thank you very much, I knew it had to be something simple.

Wait, can you actually use more than one entity in the trigger?

As in:

trigger:
  platform: state
  entity_id: device_tracker.mine, device_tracker.hers
  from: 'not_home'
  to: 'home'

or did I misunderstand?

Its shown that way in the getting started documentation (scroll down to state trigger)

Also, I found out today you can have multiple triggers under an automation.

for example:

trigger:
  - platform: zone
    entity_id: device_tracker.mine
    zone: zone.home
    event: leave
  - platform: zone
    entity_id: device_tracker.hers
    zone: zone.home
    event: leave