Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Action wait and exit if variable changes
#1
I'm trying to mimic a wait routine in the ISY that when triggered will wait a period of time and if one of the trigger parameters change then the program will exit until triggered again.

The setup is this.

Var: GarageCameraMotion (bool)
Var: GarageDoorOpen (bool)

Trigger:

Is New field value for: GarageCameraMotion = False
Field value Equals: GarageDoorOpen = True

Trying to figure out the Action for waiting 5 minutes and then closing the garage door.  The difference is that during that 5 minute period if GarageCameraMotion changes to be True I want the Action to terminate (no error).
Reply
#2
That's what Devices::TimedFldWrite is for. Normally you use it to write a different first value from what the field currently is, but you can write the same value. So, when it happens, called timed field write on the garage door closer with open as the first value and closed as the second, and five minutes as the timeout. If you never write anything else to that field, then when five minutes is up, it will do the second value for you. If you want to cancel it just do a regular field write to the field (or if the driver sees it change state it will cancel as well.)

You will have to keep up with changes in the motion state of course.

Another option might be to set that motion sensor to have a 5 minute reset. Some motion sensors let you set how long it waits before it goes back to non-motion. If so, that would solve it automatically pretty much.
Dean Roddey
Explorans limites defectum
Reply
#3
(02-01-2020, 07:28 AM)Dean Roddey Wrote: That's what Devices::TimedFldWrite is for. Normally you use it to write a different first value from what the field currently is, but you can write the same value. So, when it happens, called timed field write on the garage door closer with open as the first value and closed as the second, and five minutes as the timeout. If you never write anything else to that field, then when five minutes is up, it will do the second value for you. If you want to cancel it just do a regular field write to the field (or if the driver sees it change state it will cancel as well.)

You will have to keep up with changes in the motion state of course.

Another option might be to set that motion sensor to have a 5 minute reset. Some motion sensors let you set how long it waits before it goes back to non-motion. If so, that would solve it automatically pretty much.

TimedFldWrite won't work as the ISYv2 Driver does not support Scenes or the IOLinc device (sensor/relay).  The ISYv1 driver doesn't work with the TimeFldWrite for the scene controls.  

The motion is from my NVR setting the variable via HTTP Trigger.  When there's motion it sets the variable true when motion ends it sets the variable false.

I have a few events setup where I'm having to use a HTTP Trigger from the ISY to set variables then have CQC react based on them and then use a CML Macro to do the HTTP Get back to the ISY to turn on/off the scenes as needed.
Reply
#4
You could always just create a MotionTimeout field in the variables driver as well, and do the timed write on it. So set it true when motion starts and with a five minute delay to write false back to it (and if you call timed field write again on another motion that'll just reset the timeout periods again.) If you write to it normally, that'll cancel the completion of the timed write.

Then trigger on that field going false.
Dean Roddey
Explorans limites defectum
Reply
#5
(02-01-2020, 10:34 AM)Dean Roddey Wrote: You could always just create a MotionTimeout field in the variables driver as well, and do the timed write on it. So set it true when motion starts and with a five minute delay to write false back to it (and if you call timed field write again on another motion that'll just reset the timeout periods again.) If you write to it normally, that'll cancel the completion of the timed write.

Then trigger on that field going false.

Perfect.  I think that will work.  You also got me thinking of finding (for now) an older Insteon Motion sensor that does the timeout properly and setting that up as a temp solution.  This variable with a time write I think will work well.
Reply
#6
You may need it to be an enumerated value. You need (active, timedout, and cancelled.) If you did a boolean and just cancelled the operation by writing false, that would cause the trigger to go out. If you have three states, you can handle all the scenarios. Only trigger if it goes to timedout (which will be the final value of the timed write.) To cancel just write cancelled to the field normally and the timed write will be dropped.
Dean Roddey
Explorans limites defectum
Reply
#7
Would I use a StringList for the variable then?
Reply
#8
No, just a string with an enumerated limit with those three values.
Dean Roddey
Explorans limites defectum
Reply
#9
(02-01-2020, 11:47 AM)Dean Roddey Wrote: No, just a string with an enumerated limit with those three values.

Ok.  I was checking the options for the variable is why I asked.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [FEATURE] Event Run Action simplextech 4 416 01-09-2020, 02:04 PM
Last Post: simplextech
  Display of an Extended Wait for User Image kblagron 4 600 09-20-2019, 02:21 PM
Last Post: kblagron
  Time formatting RunTime Time Variable? gReatAutomation 5 537 08-14-2019, 05:23 AM
Last Post: gReatAutomation
  GVar... Variable GVar... Already Exists gReatAutomation 3 356 08-13-2019, 01:15 PM
Last Post: Dean Roddey
  Creating a Variable Double_J 13 2,026 06-22-2019, 03:40 AM
Last Post: gReatAutomation
  Variable Error in Scheduled Task znelbok 3 772 03-22-2019, 09:30 AM
Last Post: Dean Roddey
  Can't Find a Couple of Documented Action Commands kblagron 7 2,044 10-02-2018, 05:47 PM
Last Post: kblagron
  Question on Formatting of Variable Text kblagron 2 1,475 09-07-2018, 08:52 PM
Last Post: kblagron
  How would I manually collect digits to enter into a variable ghurty 1 898 05-24-2018, 08:51 PM
Last Post: Dean Roddey
  Embedded Variable in Text zra 2 1,313 05-07-2018, 09:59 AM
Last Post: zra

Forum Jump:


Users browsing this thread: 1 Guest(s)