Using multiple motion reports as a trigger?


#1

I want to turn our carport light on if my wife or I arrive home after the light’s scheduled off time of midnight. I created a piston to do this using our phones as presence sensors, but they often don’t report presence in a timely fashion.

I recently added a Zooz 4-in-1 sensor in the carport with a thought that we could use it to detect our arrivals. Before I have it control the light, though, I wanted to see how much motion it sees at night normally from birds, bats, bugs, etc. I created the piston below and see there is occasionally activity.

I also see “Piston waited at semaphore messages”, which I understand comes from the motion sensor being triggered repeatedly. I can trace these to times one of us was coming or going- basically, what I’d really like to use as the trigger for the light!

I am new to creating pistons. How could I alter this piston to say, “if motion sensor reports motion for N seconds”…

1/27/2019, 6:29:12 AM +671ms
+162ms	║Motion detected
1/26/2019, 7:48:47 PM +506ms
+10199ms	║Piston waited at a semaphore for 10087ms
1/26/2019, 7:21:47 PM +487ms
+10125ms	║Piston waited at a semaphore for 10031ms
1/26/2019, 6:56:56 PM +751ms
+10122ms	║Piston waited at a semaphore for 10021ms
1/26/2019, 1:57:44 PM +162ms
+10113ms	║Piston waited at a semaphore for 10019ms
1/26/2019, 8:03:29 AM +489ms
+10130ms	║Piston waited at a semaphore for 10020ms
1/24/2019, 7:14:18 AM +2ms
+160ms	║Motion detected
1/22/2019, 6:49:41 AM +425ms
+157ms	║Motion detected
1/21/2019, 1:04:42 AM +904ms
+162ms	║Motion detected
1/21/2019, 1:02:49 AM +400ms
+157ms	║Motion detected
1/21/2019, 12:40:07 AM +356ms
+146ms	║Motion detected
1/21/2019, 12:39:02 AM +385ms
+134ms	║Motion detected
1/21/2019, 12:29:02 AM +527ms
+248ms	║Motion detected
1/21/2019, 12:18:17 AM +746ms
+150ms	║Motion detected
1/21/2019, 12:06:14 AM +773ms
+148ms	║Motion detected
1/20/2019, 4:24:08 PM +701ms
+10166ms	║Piston waited at a semaphore for 10046ms
1/19/2019, 7:06:11 AM +270ms
+132ms	║Motion detected
1/19/2019, 5:29:37 AM +128ms
+177ms	║Motion detected
1/16/2019, 3:56:49 AM +68ms
+133ms	║Motion detected

#2

Hi @carlfisher

Try
IF motion sensor stays active N seconds…

But this might get a little interesting because, motions sensors have their on staying active period and each company is different…
Meaning,
X Company sensors - gets triggered and stays ACTIVE 15 seconds regardless of motion continues or not (15 seconds is a made up number)
Y Company sensors - gets triggered and stays ACTIVE 45 seconds regardless of motion continues or not

This works IF you want to check if there is motion LONGER period of times
IF motion sensor stays active 2 minutes (in this case that means there is a continius motion in front of the sensor)
But it also means you have to park your car, get out, walk around your car for 2 minutes, wave your hands LOL before the piston is TRIGGERED…

I have a couple of outside sensors with the same purpose (I also tried arrival sensor but wasn’t happy with the accuracy of it) and yes they pick up birds, leafs etc.
Since you mentioned carport, maybe you should try placing the sensor to the ceiling and looking down with 90 degree angle. In this case it will still pick up bird etc but they have to fly directly under the sensor inside the carport… so you might get less accidental triggers.

But i am also fairly new here I’ll be wathing this post to see if PROs have a way of doing this…


#3

I have a similar issue at my house where my phone does a pretty bad job of being a presence detector. It’s often several minutes late of when I actually arrive.

What I did was to put a sensor inside of my garage and just use that to detect that I’m home (or I’m politely turning on the lights for burglars). So that would work for putting a sensor up in the car port as has been suggested.

The other thing you could do would be to put in 2 sensors and only turn on the light if both of them turn on in the right order. To do that you would simply construct something in WC that would look like this:

IF Sensor2 motion changes to active
AND
Sensor1 motion is active
THEN

You’d then position the sensors such that Sensor1 would get triggered first when the car pulls up. So it would already be active by the time the 2nd sensor sees the car.

That would substantially cut down on the likelihood of getting false positives.


#4

The Zooz 4-in-1 sensor I’m using (with robertvandevoort custom device handler I think) appears to correctly answer requests for status down to the second, and @ike2018 's “active for N seconds” approach seems to work well.

Now it’s just a matter of determining the best value for N. :slight_smile: As he points out, the action doesn’t fire until after the N seconds has elapsed, so it should be less than the time it takes to pull in, stop, and open the car door. The greater N can be, the less likely to be triggered by nocturnal critters other than ourselves. I think I’m settling on about 6 seconds, obviously that can be adjusted if I see a lot more falses as we get into the warmer months.

Thanks all for the help!


#5

Lets know about the progress,
many people after us can read these
and i am also curious about it:)


#6

I’ve noticed this piston fires on any motion detection, 99+ percent of which are during the day, of course. This seems inefficient and wasteful of server resources.

Is there a way to make the piston only run between midnight and sunrise? I modified my piston as below, and now it doesn’t report anything except for the sensor’s active and inactive status changes, but it still reports them at all hours.

Can this be improved further, or should I not worry about minor things like this?

Thanks in advance!

2/1/2019, 7:44:36 PM +312ms
+1ms	╔Received event [Carport Multi-Sensor].motion = inactive with a delay of 51ms
+146ms	╚Event processed successfully (146ms)
2/1/2019, 7:44:23 PM +681ms
+1ms	╔Received event [Carport Multi-Sensor].motion = active with a delay of 41ms
+123ms	╚Event processed successfully (123ms)
2/1/2019, 7:44:14 PM +548ms
+1ms	╔Received event [Carport Multi-Sensor].motion = active with a delay of 42ms
+139ms	╚Event processed successfully (138ms)
2/1/2019, 7:43:35 PM +493ms
+2ms	╔Received event [Carport Multi-Sensor].motion = inactive with a delay of 47ms
+122ms	╚Event processed successfully (121ms)
2/1/2019, 7:43:25 PM +551ms
+1ms	╔Received event [Carport Multi-Sensor].motion = active with a delay of 55ms
+161ms	╚Event processed successfully (161ms)

#7

I am not that good with behind the scenes of webcore. So i don’t knwo for sure if this would be wasteful server resources?
My guess would be no, because motion sensors are probably the TOP USED devices and I am sure when they were writing webcore, they already considered that.

Here is the thing,
as long as you have motion sensor in a piston, everytime motion is triggered in real life, this will trigger your piston’s THAT BLOCK. Will it be executed?? that is entirely up to your conditions.
If there is a way to BLIND the motion sensors, where they don’t send signals to ST hub and WebCore, I personally don’t know about it…

One thing you can do is, pause the piston when - for sure - you don’t need it…
You need another piston for that…
lets say:
Piston #1 is pause and resume piston
Piston #2 is what you currently have.

Piston 1 would go like this:
Every day at sunrise (timer)
Pause piston #2

Every day at midnight (timer)
Resume piston #2

But i have feeling that pausing and resuming a piston would use even more resources (uneducated guess)