mlennox Posted April 11, 2014 Posted April 11, 2014 In order to reduce repetition in my programs I have created a number of programs that I use as variables, which I call, as an example, isDaylightHours, isKitchenMotionOn Because they are programs they will get set to true or false as things change. I then use these programs in the IF clause for other programs, which seems to work fine. I have one particular program, though, where I use 2 of my state programs in the if clause, and in the THEN clause I do a repeat with a 1 second wait on each iteration. During the course of executing the THEN clause, if the control programs in the IF clause change values such that the result is False, the program does not seem to stop and re-evaluate to the ELSE clause. Is there some limitation with programs in the IF clause or with repeat loops that would prevent the program from halting and re-evaluating?
Michel Kohanim Posted April 11, 2014 Posted April 11, 2014 Hi mlennox, No, there's no time limitation. Are you certain this program is NOT being called explicitly? If so, if you go to program summary page, what's the state of this program (true or false)? With kind regards, Michel
mlennox Posted April 11, 2014 Author Posted April 11, 2014 Hi mlennox, No, there's no time limitation. Are you certain this program is NOT being called explicitly? If so, if you go to program summary page, what's the state of this program (true or false)? With kind regards, Michel The "state" program is working correctly, in that it changes from true to false and back at the right moments When the "state" program turns from true to false, the downstream program doesn't appear to be re-evaluating and running the else clause. Now to answer your question, I am testing this by explicitly calling the downstream program (IF clause). Is this why it's not working?
apostolakisl Posted April 11, 2014 Posted April 11, 2014 Copy and paste all the program to the forum. Please add the name of each program since the copy/paste doesn't include the name and we will need those names here.
mlennox Posted April 11, 2014 Author Posted April 11, 2014 Copy and paste all the program to the forum. Please add the name of each program since the copy/paste doesn't include the name and we will need those names here. Is there an easy way to do this (copy and paste program content)?
mlennox Posted April 12, 2014 Author Posted April 12, 2014 Here it is. https://gist.github.com/marclennox/1507 ... tfile1-txt
oberkc Posted April 12, 2014 Posted April 12, 2014 I am not sure that I am smart enough to figure out your intent by looking at the programs, but a couple of trends interest me. a) you initiate some programs (if path) from others, which is fine. Do you want those same programs to trigger themselves (in addition to being initiated externally)? For example, "kitchen light fade warning" IF PATH is called by "kitchen lights off". Do you want "kitchen light fade warning" to also be triggered conditions initiates this? how many of the individual devices listed in the condition of "iskitchenon" are part of the scene "allkitchenlights"? is it possible that when program "kitchen lights fade warning" turns off the kitchen lights scene, it triggers itself (false), and halts the repeat? What would happen if you disable the program "kitchen light fade warning"? Is it possible that it is already disabled? Are any of these programs in folders?
apostolakisl Posted April 12, 2014 Posted April 12, 2014 I was looking at the last program with the repeats. Why are you doing 20 dims separated by a second? Why don't you create a scene with those lights and have the dim rate happen over 19 seconds (which is the choice closest to 20 seconds)? Then you just have the "then" clause execute the scene. Of course this doesn't answer the question as to why the else isn't running when the "if" condition changes. I'll have to look closer, but I have to wonder if your else clause isn't doing something that makes the "if" clause true again. You can open the program summary page and watch the status of each program change as it happens.
mlennox Posted April 12, 2014 Author Posted April 12, 2014 I am not sure that I am smart enough to figure out your intent by looking at the programs, but a couple of trends interest me. a) you initiate some programs (if path) from others, which is fine. Do you want those same programs to trigger themselves (in addition to being initiated externally)? For example, "kitchen light fade warning" IF PATH is called by "kitchen lights off". Do you want "kitchen light fade warning" to also be triggered conditions initiates this? how many of the individual devices listed in the condition of "iskitchenon" are part of the scene "allkitchenlights"? is it possible that when program "kitchen lights fade warning" turns off the kitchen lights scene, it triggers itself (false), and halts the repeat? What would happen if you disable the program "kitchen light fade warning"? Is it possible that it is already disabled? Are any of these programs in folders? Good point, what I forgot to include in the program list is that most of the kitchen specific programs are disabled and only called by others. I have updated the GIST to reflect this. To answer your questions. a) Only the Kitchen Occupancy program is triggered from events, the other 3 are explicitly called by THEN or ELSE paths All the devices listed are in the scene. My intention is not to reset the scene to "full on" if you have made manual adjustments to any of them.
mlennox Posted April 12, 2014 Author Posted April 12, 2014 I was looking at the last program with the repeats. Why are you doing 20 dims separated by a second? Why don't you create a scene with those lights and have the dim rate happen over 19 seconds (which is the choice closest to 20 seconds)? Then you just have the "then" clause execute the scene. Of course this doesn't answer the question as to why the else isn't running when the "if" condition changes. I'll have to look closer, but I have to wonder if your else clause isn't doing something that makes the "if" clause true again. You can open the program summary page and watch the status of each program change as it happens. EDIT: I dont' know your scenes. But probably the lights in your last program are the same ones as "inkitchenon" program. Every time it does a "dim", it changes the status of those lights, which re-triggers that program, which causes it to keep re-calling your last program and starting it over. Yep, I could do that indeed. My intent was to not have multiple scenes with different ramp rates. When I click a scene controllers, I want the 2 second ramp. The long ramp is only acting as a warning that the lights are going to be turned off soon, so better activate the motion sensor to turn them back on. For your second question, I think I answered it in the last post, which is that only the "Kitchen Occupancy" scene is "active"
apostolakisl Posted April 12, 2014 Posted April 12, 2014 I was looking at the last program with the repeats. Why are you doing 20 dims separated by a second? Why don't you create a scene with those lights and have the dim rate happen over 19 seconds (which is the choice closest to 20 seconds)? Then you just have the "then" clause execute the scene. Of course this doesn't answer the question as to why the else isn't running when the "if" condition changes. I'll have to look closer, but I have to wonder if your else clause isn't doing something that makes the "if" clause true again. You can open the program summary page and watch the status of each program change as it happens. EDIT: I dont' know your scenes. But probably the lights in your last program are the same ones as "inkitchenon" program. Every time it does a "dim", it changes the status of those lights, which re-triggers that program, which causes it to keep re-calling your last program and starting it over. Yep, I could do that indeed. My intent was to not have multiple scenes with different ramp rates. When I click a scene controllers, I want the 2 second ramp. The long ramp is only acting as a warning that the lights are going to be turned off soon, so better activate the motion sensor to turn them back on. For your second question, I think I answered it in the last post, which is that only the "Kitchen Occupancy" scene is "active" You would be better off having 2 scenes. They both can have the same lights in them but different ramp rates. The 19 second ramp rate scene would be activated by your program, the 2 second ramp rate would be activated by the switches. This is a much better way to do that then the repeat dims.
apostolakisl Posted April 12, 2014 Posted April 12, 2014 I think I see the issue. Your last program is disabled. It won't trigger from the status of those 2 programs changing condition. That last program must be called by another program.
mlennox Posted April 12, 2014 Author Posted April 12, 2014 I think I see the issue. Your last program is disabled. It won't trigger from the status of those 2 programs changing condition. That last program must be called by another program. Yeah I just realized myself that might be the problem. So if I understand correctly, programs that are disabled won't re-evaluation the "IF" clause while they are being executed. So I'll need to change the dimmer program to be event based...
apostolakisl Posted April 12, 2014 Posted April 12, 2014 I think I see the issue. Your last program is disabled. It won't trigger from the status of those 2 programs changing condition. That last program must be called by another program. Yeah I just realized myself that might be the problem. So if I understand correctly, programs that are disabled won't re-evaluation the "IF" clause while they are being executed. So I'll need to change the dimmer program to be event based... Programs that are disabled never evaluate the if clause unless directed to do so by another program (or manually).
Recommended Posts