How to make porchlight ignore false presence events?

I have a motion sensor on the porch, and am using the porchlight app to turn on the light when someone comes onto the porch. Other than needing some better placement and tuning (our cat tends to set it off) it works pretty well.

We have presence sensors in each of our cars. I’d like the porchlight to come on when a car arrives, and stay on for 10 minutes. Eventually, I’ll want it to stay on for 10 minutes, or until the front door is opened and closed again… but there’s no sensor on the front door yet. :slight_smile:

Unfortunately, from the logs, it looks like the presence sensors have a lot of false entries. I have my truck’s sensor set to notify me on my iPhone, and a couple times each night, it’ll send a message saying the truck left, then somewhere between 5 seconds and 5 minutes later, it’ll say it’s back.

Can anyone help me with the code I’d need to manage this?

Here’s the pseudocode:

if one of the two presence sensors arrives:
if the same sensor left more than 5 minutes ago:
turn on the light, and schedule it to shut off in 10 minutes.
else if motion sensor sees motion
turn on the light, and schedule it to shut off in 5 minutes, resetting any existing schedule

Any suggestions? I’m happy to crib code, and the porchlight code is easy enough to understand, but the “more than 5 minutes ago” part for the presence sensors is harder, and I’ve not found any examples yet.



Take a look at the code of the Ridiculously Automatic Garage Door Opener. It has a threshold built in where a presence sensor needs to be gone for x-amount of minutes before the app will do anything upon a return of that presence sensor.

I’m using a modified version of this app myself for my garage doors and it works quite well. I go get false coming and going occasionally and never had either of my doors open because of this.

Thanks, I’ll take a look tonight!


Did this end up working for you?

I have a similar issue that I am attempting to work around.
Every hour or so 2 of my iPhone presence sensors “leave” and “return”, within 1-2 minutes.
Basically I would like to configure a porch light to only come on if:

  1. It is night time (Hello home night)
  2. A presence has returned however it has been gone for >10 minutes.

Getting greedy, I would like it to:

  1. Turn on for 4 hours after sunset, then off
    along with
    Turn on if:
  2. It is night time (Hello home night)
  3. A presence has returned however it has been gone for >10 minutes.