Trigger light if it's the first time someone has come home after dark

Trying to get the front door light to turn on if my partner comes home after dark, but it keeps running during the night, I think I need a way to keep it from running (with a condition)unless she’s been away for more than a certain amount of time.

alias: Marie Home After Dark
description: >-
  Turns on the Front Door Light for 5 mins after Marie gets home if it's after
  dark
trigger:
  - platform: state
    entity_id: person.marie
    to: home
condition:
  - condition: sun
    after: sunset
action:
  - type: turn_on
    device_id: 133071d745861110adf8bf49885ec9e9
    entity_id: light.lifx_white_60b2a7_front_door_light
    domain: light
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 133071d745861110adf8bf49885ec9e9
    entity_id: light.lifx_white_60b2a7_front_door_light
    domain: light
mode: single

I’m guessing this is because you are using Marie’s phone GPS location. Once inside the the GPS no longer functions and the location depends on cell tower triangulation which is a lot less accurate. So her phone location may randomly wander outside your defined home zone.

There are a number of ways to combat this:

  1. Increase the size of the home zone
  2. Conditions
  3. Use a different location service or trigger

For option 3, you could set up a trigger that occurs whenever Marie’s phone connects to your local wifi, if it extends outside your house.

Or if your wifi does not extend outside use option 2. If Marie’s phone is connected to your local wifi then she is already inside.

I am actually using Nmap Tracker and her GPS, but her phone isn’t very good, and drops from the wifi regularly for a couple of mins at a time.

You can change the consider away delay for both those integrations.

1 Like

I’m not actually sure how to do that, I’ve looked and haven’t seen anything yet.

NMAP:

GPS:

1 Like

OMG I am a dunce, idk how I missed that option.

1 Like