eyost Posted August 26, 2021 Posted August 26, 2021 Hi all, I have a batch of programs that is used when I go on vacation. Each device has multiple on/off programs. In totality I have about twenty programs that I enable or disable dependent upon if I am away on vacation or not. Currently I go to each program and enable it or disable it, but I was wondering if there is a way to enable or disable them in one step. Not sure if it is possible, but figured I'd ask. Thanks in advance, Ed
ronvond Posted August 26, 2021 Posted August 26, 2021 Ed, I had the same problem with all my Christmas programs. I placed all the programs in a folder called Christmas Programs. I then use a variable to enable / disable all programs in the folder. If $Christmas_Programs > 49 Then Allow the programs in this folder to run. 2
larryllix Posted August 26, 2021 Posted August 26, 2021 (edited) I use folder conditions also for some functions that do not get operated frequently. Some of the problems with folder conditions is that programs can get killed in the middle of an operation and leave devices, and/or variables in unknown states. Another problem with this technique is some programs may be dependent on multiple conditions and that can really confuse the logic outcome. Another problem is testing a program in a disabled folder. There was never any indication the folder is disabled when testing the program but they just do not run and you may start tearing your programs apart in desperation to repair a program or two. I created two variables called $sVacation and $sOccupied. I have programs that run only while the house is not occupied and also I am not on vacation. These are completely different functions. My HRV ventilation system does not run while on vacation but does run while not home. While on vacation my humidifier doesn't run but does while just away. While on vacation I send house alarms via both email and text message. While I am home I only have Alexa speakers announce the alarms. My $sOccupied is operated and controlled by about 13 MS units and my KPL security keypad. Mostly timers based on movement in the house just retriggers a programmable timer to a location dependent time delay. Areas close to doors count down from shorter times than internal zones where TV watching lowers the movements detected. My $sVacation variable is operated by my ecobee thermostat which is very reliable with schedules and can be set up years in advance with schedule. It is the boss. I tried it the other way but the stat is remote controllable and very reliable. Outside lights come on for later times dependent on not being on vacation but not being home. Programs just look like this (out of house but not on vacation) If $sVacation is $cFALSE <------------ permanently defined variables AND $sOccupied is $cFALSE <------------ permanently defined variable AND Whatever light is switched On Then do something Else ---- Edited August 26, 2021 by larryllix 2
LFMc Posted August 26, 2021 Posted August 26, 2021 12 hours ago, larryllix said: I created two variables called $sVacation and $sOccupied. I did like Larry for my programs to turn off during vacation. One variable that I toggle zero or one does the trick instantly. Of course you have to add the IF condition to the affected programs.
MrBill Posted August 26, 2021 Posted August 26, 2021 For vacation and Christmas things I use Folder Conditions. It doesn't create much load when the state is infrequently changed. On the other hand if many programs contain the condition $sVacation or $sOccupied. they all have to run when the value changes, and they all have to be evaluated whenever the IF is evaluated. There is a THIRD way! Also available is to create a program to enable/disable a list of other programs. IF $sVacation is 1 then Enable Program 'Living room light timer' Enable Program 'Bedside light timer' Enable Program 'Outside timer' etc..... else Disable Program 'Living room light timer' Disable Program 'Bedside light timer' Disable Program 'Outside timer' etc.... 3
larryllix Posted August 26, 2021 Posted August 26, 2021 Some programs are based on being enabled and disabled by other programs and double enabling them or double disabling them will not work with a complex arbitration program(s). Including a conditional line inside each program for $sVacation or $sOccupied, makes each program clear which factors influence the program instead of hidden parameters, and forgotten programs that most people forget to maintain every time they add a new program to do something. I have been down this rabbit hole many times before and trying to be lazy while programming will almost always bite you in the bum, sooner or later. Make it obvious and clear or you will pay.
lilyoyo1 Posted August 27, 2021 Posted August 27, 2021 (edited) 22 hours ago, larryllix said: Some programs are based on being enabled and disabled by other programs and double enabling them or double disabling them will not work with a complex arbitration program(s). Including a conditional line inside each program for $sVacation or $sOccupied, makes each program clear which factors influence the program instead of hidden parameters, and forgotten programs that most people forget to maintain every time they add a new program to do something. I have been down this rabbit hole many times before and trying to be lazy while programming will almost always bite you in the bum, sooner or later. Make it obvious and clear or you will pay. I don't think it's someone being lazy with their programming. I think for some people they recognize there is more than 1 way to accomplish something. Sometimes the simple solutions can work just as well (if not better) as the complex ones. It's about knowing when and where to use them. One way on here is easy to understand and troubleshoot by anyone while another is time consuming and easily forgotten about so when it is time to troubleshoot, you've wasted time just figuring out where to start... I just don't see how that's helpful to most people Edited August 27, 2021 by lilyoyo1 1
MrBill Posted August 27, 2021 Posted August 27, 2021 17 minutes ago, lilyoyo1 said: I don't think it's someone being lazy with their programming. I think for some people they recognize there is more than 1 way to accomplish something. Sometimes the simple solutions can work just as well (if not better) as the complex ones. It's about knowing when and where to use them. One way on here is easy to understand and troubleshoot by anyone while another is time consuming and easily forgotten about so when it is time to troubleshoot, you've wasted time just figuring out where to start... I just don't see how that's helpful to most people That's what i was thinking... exposing more options.... I also don't think using resource intensive state variables is wise for things that rarely change... like vacation and christmas. 1
larryllix Posted August 28, 2021 Posted August 28, 2021 (edited) 8 hours ago, MrBill said: That's what i was thinking... exposing more options.... I also don't think using resource intensive state variables is wise for things that rarely change... like vacation and christmas. According to the theory behind event based processing no state variable will ever get evaluated or processed unless it's state changes. Without any value change or even an event that affects the value of a state variable, no CPU time is taken to even test it's value, let alone process program conditions based on their values. That is the beauty of real event based processing, such as IMHO ISY uses. OTOH there could be some extra time taken using a few hundred state variables but should be nothing for a 100's of MegaHertz clocked CPU. Modern compilation techniques and addressing schemes don't use brute force scanning techniques anymore either. ISY uses predefined addresses also. I use hundreds of state variables already. If they don't change value, nothing gets evaluated and no CPU time is taken. ISY has been done by highly educated computer people and the techniques are well documented in the computer sciences journals. Edited August 28, 2021 by larryllix
MrBill Posted August 28, 2021 Posted August 28, 2021 8 hours ago, larryllix said: According to the theory behind event based processing no state variable will ever get evaluated or processed unless it's state changes. Without any value change or even an event that affects the value of a state variable, no CPU time is taken to even test it's value, let alone process program conditions based on their values. That is the beauty of real event based processing, such as IMHO ISY uses. OTOH there could be some extra time taken using a few hundred state variables but should be nothing for a 100's of MegaHertz clocked CPU. Modern compilation techniques and addressing schemes don't use brute force scanning techniques anymore either. ISY uses predefined addresses also. I use hundreds of state variables already. If they don't change value, nothing gets evaluated and no CPU time is taken. ISY has been done by highly educated computer people and the techniques are well documented in the computer sciences journals. Oh Ok, So there's no reason for anyone to consider any options other than the one that you insist that they use, and other suggestions are inherently wrong becuase you don't like using them! got it.
lilyoyo1 Posted August 28, 2021 Posted August 28, 2021 8 hours ago, larryllix said: According to the theory behind event based processing no state variable will ever get evaluated or processed unless it's state changes. Without any value change or even an event that affects the value of a state variable, no CPU time is taken to even test it's value, let alone process program conditions based on their values. That is the beauty of real event based processing, such as IMHO ISY uses. OTOH there could be some extra time taken using a few hundred state variables but should be nothing for a 100's of MegaHertz clocked CPU. Modern compilation techniques and addressing schemes don't use brute force scanning techniques anymore either. ISY uses predefined addresses also. I use hundreds of state variables already. If they don't change value, nothing gets evaluated and no CPU time is taken. ISY has been done by highly educated computer people and the techniques are well documented in the computer sciences journals. One thing I learned and kept with me from my days in the military was the KISS principle (keep it simple stupid)! Why? Because the more complicated you make something, invariably something will go wrong at the worse moment. For what the op wants, @MrBillexample can and will work without issues. Just like yours. The only thing I do different is separate my on programs from my off. That way I can easily test either state, and write other stuff in the future that will not impact the program. If he ever needs to troubleshoot, he knows exactly where to go. Your method requires a multitude of programs so when something goes wrong, where does he start? Not only do you have to create each variable, but you then have to create the program to trigger each variable, then you have to have each of the programs that actually need. Add those to all the other variables created for other stuff over the years and now a person is sitting on potentially hundred of variables and programs that the need to remember. Trying to use the amount of variables you use unnecessarily complicates things. It reminds me of those marble traps we built in physics, where the marble causes a chain reaction to pour a cup of water. Yeah, it worked but it was much simpler to simply pour the water yourself. WWith @MrBillmethod, double tap the away button and it triggers a single variable to start his vacation programs. When he comes home, he turns it off (or maybe door lock triggers it off) and it resets the variable stopping those programs from running. In, out, and over. Personally I've gotten away from worrying about a vacation mode. If the house is empty, everything triggers as if we're home for the dogs anyway. The only thing my vacation program adds is turning the TV's on and off, which if that doesn't happen so what. The less i have to remember to do when I'm leaving, the better. 3
eyost Posted September 9, 2021 Author Posted September 9, 2021 On 8/25/2021 at 10:09 PM, ronvond said: Ed, I had the same problem with all my Christmas programs. I placed all the programs in a folder called Christmas Programs. I then use a variable to enable / disable all programs in the folder. If $Christmas_Programs > 49 Then Allow the programs in this folder to run. Thanks for the info, this looks like this should do the trick. I tried it by creating a variable but am confused to what to enter under the INIT and Value columns. I assume that the Value would be what it tests. Thanks again, Ed
eyost Posted September 9, 2021 Author Posted September 9, 2021 Thanks everyone for your suggestions. Lots of good ones that shows that I need to learn about variables. Ed 1
larryllix Posted September 9, 2021 Posted September 9, 2021 7 minutes ago, eyost said: Thanks for the info, this looks like this should do the trick. I tried it by creating a variable but am confused to what to enter under the INIT and Value columns. I assume that the Value would be what it tests. Thanks again, Ed That is correct. The init_to value is the value that gets stuffed into the variable value as ISY boots up, before any variables get used in programs. Init_to value is not testable or otherwise usable. 1
eyost Posted September 9, 2021 Author Posted September 9, 2021 20 minutes ago, larryllix said: That is correct. The init_to value is the value that gets stuffed into the variable value as ISY boots up, before any variables get used in programs. Init_to value is not testable or otherwise usable. Thanks for the reply. So does the below look correct? I would then go and change the value in the variable if I want the folder programs to run? In other words, when I go away, I would go into the Away variable and change the value to 0 and leave the IF test on the folder to If Away = 1 then ...
larryllix Posted September 9, 2021 Posted September 9, 2021 15 minutes ago, eyost said: Thanks for the reply. So does the below look correct? I would then go and change the value in the variable if I want the folder programs to run? In other words, when I go away, I would go into the Away variable and change the value to 0 and leave the IF test on the folder to If Away = 1 then ... Yup! The main thing in programming is usually self-documenting code. That means, for variables, to gve them descriptive names that reading it later you know exactly what the value means. Typically and usually you would use a non-zero value (usually 1) for True, and a 0 value for False. You can manipulate the value later manually, or automatically from some device. I use the vacation setting from my ecobee thermostats with a syncing program. Logic = When the value changes in the stat, change the value in the variable. You could use a triple tap, or some other sequence, from a simple SwitchLinc wall switch. I use a sequence like that for my home security to enable/disable it. That can be explained later if desired. Just ask. You may want to set the init_to value to the same value in programs that set it. That way ISY will boot up with the last value you assigned it.
MrBill Posted September 9, 2021 Posted September 9, 2021 11 hours ago, eyost said: Thanks for the reply. So does the below look correct? I would then go and change the value in the variable if I want the folder programs to run? In other words, when I go away, I would go into the Away variable and change the value to 0 and leave the IF test on the folder to If Away = 1 then ... It looks like you created that as an "Integer" variable. Because you likely want to use the variable "Away" in the IF statement of a program you likely want to make it a "State" variable instead. Integer variables can be use in IF statements, but they act as Filters, whereas State variable are triggers. Not required, but a good practice due to the way the dropdowns elsewhere in the admin console work is to make the first character of your variable a telltale of its type. Many of us would name this variable "sAway" as a state variable or if it was an integer variable we might call something "iBeanCounter" (and @larryllix will be along shortly to tell you about using c for Constant with some of your integer variables ??)
larryllix Posted September 9, 2021 Posted September 9, 2021 11 minutes ago, MrBill said: It looks like you created that as an "Integer" variable. Because you likely want to use the variable "Away" in the IF statement of a program you likely want to make it a "State" variable instead. Integer variables can be use in IF statements, but they act as Filters, whereas State variable are triggers. Not required, but a good practice due to the way the dropdowns elsewhere in the admin console work is to make the first character of your variable a telltale of its type. Many of us would name this variable "sAway" as a state variable or if it was an integer variable we might call something "iBeanCounter" (and @larryllix will be along shortly to tell you about using c for Constant with some of your integer variables ??) LOL! All good suggestions and nice catch about the State vs Integer variable type. @eyostDefinitely use the 's' prefix. It will save you a lot of agro later when you wonder WTF did I do here? More self-documenting with your code writing. I was leaving the 'c' prefix for later, based on newbie post count and comments about variable familiarity.
LFMc Posted September 14, 2021 Posted September 14, 2021 On 9/9/2021 at 8:48 AM, larryllix said: I was leaving the 'c' prefix for later, Be sure to CC me when you explain this one. My curiosity is peeked. ? But I think I can envision your usage.
MrBill Posted September 14, 2021 Posted September 14, 2021 51 minutes ago, LFMc said: Be sure to CC me when you explain this one. My curiosity is peeked. ? But I think I can envision your usage. Interger Variables that don't change... used as Constants cTrue = 1 cFalse = 0 cBlue = 255 c30percent = 77 (30% of 255, used in dimming) Makes programs easier to read: If sAway = cTrue then......
larryllix Posted September 14, 2021 Posted September 14, 2021 Interger Variables that don't change... used as Constants cTrue = 1 cFalse = 0 cBlue = 255 c30percent = 77 (30% of 255, used in dimming) Makes programs easier to read: If sAway = cTrue then...... Make sure to set init-to to the same value so it never goes away.Also I found a bug that the last integer variable value gets cleared upon reboot. IIRC this was on ISY v5.3.4 so not likely fixed yet. I installed a dummy extra variable and it stopped disappearing.Sent from my SM-G781W using Tapatalk
MrBill Posted September 14, 2021 Posted September 14, 2021 10 minutes ago, larryllix said: IIRC this was on ISY v5.3.4 so not likely fixed yet. I installed a dummy extra variable and it stopped disappearing. I remember now!!... just yesterday I wondered why I had a variable named "iDummyLastVariable" 1
larryllix Posted September 14, 2021 Posted September 14, 2021 11 minutes ago, MrBill said: I remember now!!... just yesterday I wondered why I had a variable named "iDummyLastVariable" Nothing like self documenting code/variable names.
larryllix Posted September 14, 2021 Posted September 14, 2021 (edited) 2 hours ago, LFMc said: Be sure to CC me when you explain this one. My curiosity is peeked. ? But I think I can envision your usage. The z in the name is so these sort to the last position order when looking for a variable in programming. Edited September 14, 2021 by larryllix
kclenden Posted September 16, 2021 Posted September 16, 2021 On 9/14/2021 at 1:07 PM, larryllix said: The z in the name is so these sort to the last position order when looking for a variable in programming. What? Doesn't the preceding "c" make everything sort based on the "c", not the "Z"? 1
Recommended Posts