webCore - Window of opportunity

Hey all,

I’m just digging in to webCore to try and do something a bit more complicated than simple if-this-then scenarios.
I want to have my garage door open when I arrive and then, only for the next 10 minutes, have the garage door close if I turn off my garage light.
I hacked a way to maintain a global variable indicating that I’m “recently home” and it seemed to work in my tests (with lights instead of actual presence and garage door.) but now doesn’t seem to be working.
My hope is that I just made it too complicated and there is a more reasonable way to do something only within a time window of another event…

Here is the piston I came up with:

You might have more luck posting it in this thread :

As for your question, I think there is easier way to do it but I’m not pro.

Personally I would have made two pistons… One automating your arrival, the other to close the garage door. Something like

If garage light switch changes to off
And
Garage door was opened in the last 10 minutes

Then…

https://wiki.webcore.co/Functions#Integers And check out age(). That is the function you are looking for. That is the solution to your variable hack

1 Like