apeelvis Posted January 3, 2014 Posted January 3, 2014 Does anybody know if there is a simple way to run all programs in a folder? Say for instance that you have multiple programs that need to run all of the programs in a folder. And say there are a lot of programs in that folder. Is there a way to: If condition = state variable Then Run Folder ABC
apostolakisl Posted January 3, 2014 Posted January 3, 2014 What do you mean by running every program? You can certainly enable and disable all the programs in a folder like that, but you can't cause them to trigger. If you want them to trigger, then you need either include the state variable within the "if" section of each program, or have another program like this If state variable = x Then run program a if clause run program b if clause run program c if clause etc.
apeelvis Posted January 3, 2014 Author Posted January 3, 2014 So what I mean is this. Say you have a folder full of program like this one. If No Conditions Then Turn on livingroom lights and If No Conditions Then Turn on familyroom lights Let's say you have 50 rooms or 100 rooms and you want to run all the then statements if a condition in another program is true. But there are 20 other programs that could have the condition that would cause all of the 50 or 100 programs to run in that folder. Is there a way to simply call for all of those programs to run? Yes there is...... I figured it out while I was explaining the situation. Simply include a program that executes all the 'then' programs in the folder if a condition is true. Make that condition true and after all the programs run make it untrue. Duh! Nevermind.
apostolakisl Posted January 4, 2014 Posted January 4, 2014 So what I mean is this. Say you have a folder full of program like this one. If No Conditions Then Turn on livingroom lights and If No Conditions Then Turn on familyroom lights Let's say you have 50 rooms or 100 rooms and you want to run all the then statements if a condition in another program is true. But there are 20 other programs that could have the condition that would cause all of the 50 or 100 programs to run in that folder. Is there a way to simply call for all of those programs to run? Yes there is...... I figured it out while I was explaining the situation. Simply include a program that executes all the 'then' programs in the folder if a condition is true. Make that condition true and after all the programs run make it untrue. Duh! Nevermind. You are right, but what is the point. You could just as easily put all the "then" statements into the first program and be done with it. In other words why do this If whatever Then run then program a run then program b run then program c etc When you could get rid of the a, b, c, etc programs and simply do If whatever Then do whatever program a did do whatever program b did do whatever program c did etc Instead of a whole bunch of programs, you get 1.
larryllix Posted January 10, 2014 Posted January 10, 2014 If . whatever Then . run then program a . run then program b . run then program c . etc Is there a problem just running programs with no conditions defined from the (if) entrance? I have been running programs (if) as subroutines, without conditions, and all seems fine. Is this asking for trouble down the road?
apostolakisl Posted January 10, 2014 Posted January 10, 2014 If . whatever Then . run then program a . run then program b . run then program c . etc Is there a problem just running programs with no conditions defined from the (if) entrance? I have been running programs (if) as subroutines, without conditions, and all seems fine. Is this asking for trouble down the road? There is nothing wrong with programs that have a blank "if" clause. The main reason people do this is to avoid a re-trigger. In other words If status of light x is on Then call then program b Program b If -- blank Then Do something wait do something In the above example, if you had a then clause with a "wait" and the light status changed, the wait would terminate. Doing it this way the wait will finish.
larryllix Posted January 10, 2014 Posted January 10, 2014 If status of light x is on Then call then program b Program b If -- blank Then Do something wait do something In the above example, if you had a then clause with a "wait" and the light status changed, the wait would terminate. Doing it this way the wait will finish. Thanks! Just to clarify that: If a trigger condition changes and logic becomes negative, resulting in the "else" clause being invoked, the "then" clause wait timers (and following lines of code) get cancelled right where they are?
LeeG Posted January 10, 2014 Posted January 10, 2014 "Just to clarify that: If a trigger condition changes and logic becomes negative, resulting in the "else" clause being invoked, the "then" clause wait timers (and following lines of code) get cancelled right where they are?" The above is correct but not limited to If becoming False. A change in the trigger conditions cause the If to be reevaluated (while in Wait or Repeat statement) which may drive Then or Else clause.
larryllix Posted January 10, 2014 Posted January 10, 2014 "Just to clarify that: If a trigger condition changes and logic becomes negative, resulting in the "else" clause being invoked, the "then" clause wait timers (and following lines of code) get cancelled right where they are?" The above is correct but not limited to If becoming False. A change in the trigger conditions cause the If to be reevaluated (while in Wait or Repeat statement) which may drive Then or Else clause. I kind of figured that one after previous indications that timers were all retriggerable. Glad to have it stated another way, to pound it in a little deeper. Thanks!
apostolakisl Posted January 10, 2014 Posted January 10, 2014 An example of what Lee said. If status light x is not off Then do something wait x minutes do something This program will re-start the timer every time the light changes condition even if it never turns off. Like from 50% to 100%. Both are true, but the then clause would terminate and start over from scratch.
larryllix Posted January 11, 2014 Posted January 11, 2014 This program will re-start the timer every time the light changes condition even if it never turns off. Like from 50% to 100%. Both are true, but the then clause would terminate and start over from scratch. I haven't thought about "partial ONs" yet as I have no wall dimmers or switches but I have been aware of some of these "non black and white" states devices can have and trying to avoid the gotchas later with careful conditions code. Yeah? Who am I kidding? I change some code every day. I meant "every hour". Trying to reorganise my X10 addresses to accommodate TM751 RF modules around the house. X10 address movement is a grind with the ISY though. You make an address plan and then some MS won't reach that RF module. Plan G next. Thanks.
apostolakisl Posted January 11, 2014 Posted January 11, 2014 This program will re-start the timer every time the light changes condition even if it never turns off. Like from 50% to 100%. Both are true, but the then clause would terminate and start over from scratch. I haven't thought about "partial ONs" yet as I have no wall dimmers or switches but I have been aware of some of these "non black and white" states devices can have and trying to avoid the gotchas later with careful conditions code. Yeah? Who am I kidding? I change some code every day. I meant "every hour". Trying to reorganise my X10 addresses to accommodate TM751 RF modules around the house. X10 address movement is a grind with the ISY though. You make an address plan and then some MS won't reach that RF module. Plan G next. Thanks. It sounds like you will get your monies worth out of ISY. Just realize, that no matter what the trigger is, if a condition in the "if" section that is a trigger happens, the "then" or "else" stops all waits/repeats and starts over from scratch. It can happen other ways as well. IF control light x is switched on Then do something wait do something If the light is on, and you click "on" that program will restart. An "on" command is a trigger regardless of the current state of the device. So it was true, and it still is true, but it starts over. In contrast to this: IF status light x is on Then do something wait do something This program will not re-trigger since "status" is only a trigger if it changes. This program sits idle no matter how many times you click on the on paddle if it was already on.
larryllix Posted January 11, 2014 Posted January 11, 2014 It sounds like you will get your monies worth out of ISY. Just realize, that no matter what the trigger is, if a condition in the "if" section that is a trigger happens, the "then" or "else" stops all waits/repeats and starts over from scratch. It can happen other ways as well. IF control light x is switched on If the light is on, and you click "on" that program will restart. An "on" command is a trigger regardless of the current state of the device. So it was true, and it still is true, but it starts over. In contrast to this: IF status light x is on This program will not re-trigger since "status" is only a trigger if it changes. This program sits idle no matter how many times you click on the on paddle if it was already on. I noticed the two conditions right away. In HomeSeer, the timers were not retriggered but you could use a cancel_event command to retrigger them. Been too long for my old X10 system logic, now but they had one timer pending PER DEVICE. If . Time_is_late=true Then . Go_to_bed Else . pass_out Thanks for the education!
Recommended Posts