Turn on lights when I arrive but don't if someone else is already home

I have an automation that turns on a light when I get home if it is after dark.

My problem is I do not want it to fire if my wife is already home.
That is an easy fix as you can put an “and” statement with wife’s device is not home, but most of the time the reason my wife is not home is that she is in the car with me and she has home assistant on her phone as well for her automations. The problem is to home assistant if my wife enters home zone with me it wont fire the automation to turn on the lights.
Is there a setting to say “if wife’s device has not been home for more than 10 minutes then run the automation”?
Thank you for any help.

In your automation, you can add a condition that does that.

condition: not
conditions:
  - condition: state
    entity_id: device_tracker.wife
    state: 'home'
    for:
      hours: 0
      minutes: 10
      seconds: 0

This condition will only allow the automation to trigger if the device tracker “wife” has not been home for at least 10 minutes.
If she’s been home for > 10 min, the automation won’t run.
If she’s only been home for < 10 minutes, or arrives at the same time you do, the automation will run.

Ok thank you.

1 Like