Jump to content

Why isn't this program running?


johnnyt

Recommended Posts

I use the set of programs/variables apostolakisl contributed to the calendar cause (details at http://wiki.universal-devices.com/index.php?title=ISY-99i_Generic_Calendar_Using_Programs_and_Variables) 

to which I added a program called "Holiday Changed to 1" that's supposed to email me when the $iCal.Holiday variable is 1 but it doesn't run for some reason. Hasn't once emailed me and there have been several holidays since I added the program.

 

If I do a "run then" the program/email works fine, but it doesn't run when it's called as the last step in the "Holiday Reset" program. See attached screenshots.

 

I'm showing the "New Years Day" program that ran fine yesterday. I will also confirm that the variable $iCal.Holiday was seen to be 1 as expected yesterday.

 

What am I missing?

 

 

edit: deleted duplicate screenshot and added missing one

 

 

post-1785-0-88450400-1420227004_thumb.png

post-1785-0-66683500-1420227025_thumb.png

post-1785-0-73760300-1420229474_thumb.png

Edited by johnnyt
Link to comment

yes, I realize integer variable don't trigger but I'm explicitly calling that program from the other one.

 

I just realized I attached two of the same screenshot instead of the one that makes the explicit call. oops. here it is. see last line.

post-1785-0-17513200-1420229366_thumb.png

Link to comment

Assuming variable $iCal.Holiday is in fact being set = 1, perhaps the "Holiday Changed to 1" program is running before the program "New Years Day" completes.  Try putting a Wait of 5-10 seconds code line before the Run Program 'Holiday Changed to 1' (If) line in the "Holiday reset" program

Link to comment

What is triggering the "Holiday reset" program? It has no conditions.

 

Sent from my Nexus 7 using Tapatalk

This is one of a handful of programs triggered to run a few seconds after midnight each day. I think the wiki link provide in original post might explain how it all works. The key here is that the variable does get changed as it should so everything on that front works. It's only the email sending program that doesn't work.

 

 

Sent from my iPad using Tapatalk

Link to comment

Assuming variable $iCal.Holiday is in fact being set = 1, perhaps the "Holiday Changed to 1" program is running before the program "New Years Day" completes. Try putting a Wait of 5-10 seconds code line before the Run Program 'Holiday Changed to 1' (If) line in the "Holiday reset" program

Interesting suggestion. I'll try that and report.back. It will be a revealing experiment as I had trusted the FIFO order of execution was maintained in processing variables.

 

 

Sent from my iPad using Tapatalk

Link to comment

Interesting suggestion. I'll try that and report.back. It will be a revealing experiment as I had trusted the FIFO order of execution was maintained in processing variables.

 

 

Sent from my iPad using Tapatalk

 

No, that is not correct.  $ical.Holiday is getting set to 0 and the rest of the programs are being triggered simultaneously.  A "then" clause is "atomic" meaning that all items get set into motion simultaneously.  In my experimentation, variables get set instantly for all practical purposes so all of the "run" programs are seeing the variable as set in the same "then" clause.  You can put the "then" clause in any order you want and the results will be the same.  Of course a "wait" clause changes that.  Your program is running, it is just that it is running false because $ical.Holiday was still 0 because New Years Day program had not changed it yet.

 

The delay as mentioned should work.  Another option would be to change "$ical.Holiday" to a state variable (or have 2 versions of it, state and integer) and then the program "Holiday changed to 1" will trigger itself.

Edited by apostolakisl
Link to comment

Thanks for the explanation, apostolakisl. I've put in a 2 second delay before I run the program to send the email. I didn't bother creating a bogus holiday to test it as I'm confident it'll work now.

 

I'll have to keep an eye out for that in other programs as it wasn't how I thought things worked and it could explain unexpected/unexplained behavior.

Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...