Jump to content

Enable/Disable Multiple Programs at One Time?


eyost

Recommended Posts

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

Link to comment

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.

Link to comment

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
     ----

 

Link to comment
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. 

Link to comment

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....

  

Link to comment

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.

Link to comment
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

 

Link to comment
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.

Link to comment
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.

Link to comment
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.

 

Link to comment
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. 

Link to comment
  • 2 weeks later...
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

Link to comment
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.

Link to comment
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 ...

image.thumb.png.d7286e8a0e8bc3ba58121aafb71cff49.png

Link to comment
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 ...

image.thumb.png.d7286e8a0e8bc3ba58121aafb71cff49.png

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.

Link to comment
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 ...

image.thumb.png.d7286e8a0e8bc3ba58121aafb71cff49.png

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 ??)

Link to comment
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.

Link to comment
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......

 

 

Link to comment
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

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...