I’m trying to create an efficient piston that will see that the garage door has been opened. Then wait 10 minutes before sending a SMS to a number that it’s open. Then continue to send the text every 30 minutes after words until the state changes to closed. This is what I came up with. How did I do?
Making Efficient Piston
I believe your piston will send a message every 30 minutes regardless…
Try this one…
IF garage door changes to OPEN
Set variable Garagedoor = TRUE
Every 30 minutes
IF variable garage door IS TRUE
AND
IF garge door is OPEN
Send SMS "Garage door open"
IF garage door CHANGES TO CLOSE
Set variable Garagedoor = False
Decided to change it up again and send texts to the kids/wife and message to my app just once. If they don’t get the hint, then I’ll start spamming them with texts so thanks for the input.
LOL I love this haha…
But your new piston has some problems…
1 - Let’s say garage door just opened. As soon as it’s opened it will not wait 10 minutes because you need to change TASK CANCEL POLICY to NEVER.
2 - That won’t help either though because, as long as the door is OPEN your piston will RE-EXECUTE and your 10 minute wait will be no longer counting.
You will annoy them alright but your system will go insane/congested and that my friend will annoy you in return:))))
Just realized this still won’t work. I don’t want to send messages if the contact changes to closed within 10 minutes. That’s what I need to fix.
Struggling with this. I’ve not used variables before. Might be the kids making too much noise. Do you have an example?
Try this way…
IF garage door changes to OPEN
Set variable Garagedoor = TRUE
Every 30 minutes
IF variable garage door IS TRUE
AND
IF garge door is OPEN
Send SMS "Garage door open"
IF garage door CHANGES TO CLOSE
Set variable Garagedoor = False
[/quote]
And here is an article about variables…
https://wiki.webcore.co/Variable
Not a bad piston, @ike2018… but there may occasionally be false alarms…
For example, if the “Every 30 minutes” is firing at half past, and on each hour… If you open the door at 59 past the hour, you may get an alert a few seconds later…
If @AutoH-Guy is happy with a single alert, I might code it this way:
IF Sensor's contact stays open for X minutes
Then Send SMS notification "Door has been open for X minutes"
END IF
This timer will cancel each time the door closes, or reset itself each time the door opens…
Nope he wants to annoy the kids LOL
@AutoH-Guy, Wcmore is WAAAYY better than me, (he taough me a lot) so if he recommends stuff, I’d say listen to him not me:)
One other trick that I sometimes use for important alerts is changing a colored bulb (centrally located in your house) to a certain color. For example, in this case, if the door is open for X minutes, you can send SMS, but you can also make the kitchen light turn RED.
This makes for a great silent alert, and works well if you reserve certain colors for certain alerts. (and train the family, of course, LOL)
Possible, of course, but I do not usually recommend a loop to someone without first giving a bunch of warnings and disclaimers about them first, LOL
(this is why I only program loops for clients… never publicly)
Personally, I use loops quite rarely…
When I do use them, it is usually only for looping code… Not looping devices