I want it to announce motion once, and wait about 2 minutes before announcing again (if motion is detected again). The.way my garage is set up, I get more than 1 announcement within a minute or so of original motion detection.
Need advice on using Echo with motion sensor
I think there are a couple of ways to do that. You can put a wait after the message, but you will need to have the Task Cancellation Policy set to Never cancel task. If not then the trigger will halt the wait and it will give you the message again.
Another way would be to use a date/time variable. Set it to $now when the message is spoken. You would then put an additional IF around the message command.
If $now after addminutes(yourvarible,2) then
[edit]Actually the TCP does not work as I thought it did. So probably using the variable method is best. Something like this
one other way would be using a global variable and a second piston.
This longer way is not needed for your purpose but it’s good to know the possibilities.
Piston 1 -
IF global variable MOTIONGARAGE changes to TRUE
Then
Wait 2 minutes
Set variable MOTIONGARAGE to FALSE
Piston 2 -
IF motion changes to ACTIVE
AND
IF global variable MOTIONGARAGE is TRUE
Then
Do this do that
The piston I posted works. So maybe start with that. And then add your additional stuff to figure out where your problem is.
Maybe post a copy of what you have.
Using your Piston, still nothing. No Detection Announced.
Logs are from physical test of the Piston.
What I want to happen is exactly this:
Motion is Detected > Announce Motion Detected > Wait 2 minutes before Announcing Motion is Detected again.
In other words, 2 minute cooldown on repeating motion is detected again, IF motion is detected again within the 2 minute cooldown period.
I have edited all of your pictures @001jeff so they now reside here on the forums.
(instead of using an outside site)
For future reference, you can upload pics here using this button:
You probably have to initialize the MessageSent variable. I probably should have mentioned that.
Before you run it, just edit the variable in the variable section beside the log section. Just click on the edit(pencil) next to the MessageSent variable and set it to your current time.
You could create code to initialize it if it’s null but once you run it once then your good.
It’s getting to be over my head. I don’t see a pencil symbol on my edit screen…
Screenshot Motion Detected Piston https://imgur.com/gallery/K34hOoB
Its not actually in the edit screen it’s in the screen where you test the piston, look at your logs, etc. If you click the area pointed to, you can change the value of the variable.
I’ve been busy, haven’t had time to follow up. Iet still doesn’t work as I want it to… getting multiple announcements with no two minute wait.
I would suggest something like this:
if motion changes to active
then
send announcement
end if
While motion is active
wait 2 minutes <--never cancel tasks
send announcement
end while
The only issue will be if the motion ca=hanges to inactive and back to active within the two minutes. Blocking that would require more complex logic.
Therein lies the problem… the idea is to prevent multiple announcements, due to the location of the sensor. The Sensor will definitely change from active to inactive to active to inactive multiple times when someone is moving about the garage. It seems like a 2 minute cooldown period would be a simple thing, but so far it isn’t.