jmed999 Posted June 3, 2015 Posted June 3, 2015 I use a remotelinc to put my house in vacation mode (and other modes). It sets a variable =1 when in vacation mode. I'm trying to write a program to turn some lights on & off while on vacation at certain times and send me an e-mail when they turn on and when they turn off each day. The problem is the "Else" part. It runs even if we aren't on vacation. ie. I wrote the program last night but we do not go on vacation for a few more days. After I wrote the program ~10PM, I got 3 "Vaca lights off" e-mails at 2AM, 5AM, and at sunrise. If $s.Home.Away is 1 And ( From Sunset To 2:00:00AM (next day) Or From 5:00:00AM To Sunrise (same day) ) Then Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Send Notification to 'My e-mail' content 'Vaca Lights on' Else Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Send Notification to 'My e-mail' content 'Vaca Lights off' How should the program(s) look to do what I'm trying to accomplish? BTW, the redundancy in the "then" and "else" is in case I have a comm error. Comm issues are rare on those lights but do happen every once in a while. ie. I don't want a light burning all day do to a comm issue while I'm on vacation hence the reason for turning them off twice...just extra insurance I guess. BTW, could I make the Driveway Primary and Secondary (they have a 3 way switch) turn on and off randomly during the times in the "If" statement but leave the other 2 lights (landscape lights, and Front CFL) on continuously? Any idea on how to program this? Thanks in advance for any suggestions!
bipto Posted June 3, 2015 Posted June 3, 2015 You have two conditions in the IF clause. Whenever either changes, the IF is reevaluated. So whenever your state variable, or the schedule causes the IF to evaluate to false, your ELSE is firing. Your IF clause needs to be broken up, or alternatively you could put a program with just the schedule condition in a folder that enables when your vacation state variable is true...
jmed999 Posted June 3, 2015 Author Posted June 3, 2015 Thanks for the reply. I know why this isn't working but not sure how the program(s) would look to do what I need. I was hoping someone could write how the program(s) should look to make this work. Thanks in advance!
bipto Posted June 3, 2015 Posted June 3, 2015 (edited) Sure... I'm on the clock at moment, but if no one chimes in by this evening I'll post them up for you... --Bill Edited June 3, 2015 by bipto
jmed999 Posted June 3, 2015 Author Posted June 3, 2015 Thanks! Looking forward to it. ANyone else want to chime in with ideas? It's always good to have more than one way to skin the cat
bipto Posted June 3, 2015 Posted June 3, 2015 (edited) Ok, so breaking the program in to two conditionals could be done like this... RUN_AWAY_LIGHTING If From Sunset To 2:00:00AM (next day) Or From 5:00:00AM To Sunrise (same day) Then Run Program 'AWAY_LIGHTING' (If) AWAY_LIGHTINGIf $s.Home.Away is 1 Then Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Send Notification to 'My e-mail' content 'Vaca Lights on' Else Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Send Notification to 'My e-mail' content 'Vaca Lights off' Note that as shown you would either have to disable the 'AWAY_LIGHTING' program or change 's.Home.Away' variable from a State to an Integer variable to prevent the program from running immediately when you set 's.Home.Away' ... Alternatively you could take the 'AWAY_LIGHTING' as-is and save it under an 'AWAY_DARK_PROGRAMS' folder and use your schedule condition to enable that folder. That would be my preference... --Bill Edited June 3, 2015 by bipto
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 Thanks! Any idea on how to get only the driveway CFLs to turn on and off randomly during this time?
larryllix Posted June 4, 2015 Posted June 4, 2015 (edited) Ok, so breaking the program in to two conditionals could be done like this... RUN_AWAY_LIGHTING If From Sunset To 2:00:00AM (next day) Or From 5:00:00AM To Sunrise (same day) Then Run Program 'AWAY_LIGHTING' (If) AWAY_LIGHTING If $s.Home.Away is 1 Then Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Send Notification to 'My e-mail' content 'Vaca Lights on' Else Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Send Notification to 'My e-mail' content 'Vaca Lights off' Note that as shown you would either have to disable the 'AWAY_LIGHTING' program or change 's.Home.Away' variable from a State to an Integer variable to prevent the program from running immediately when you set 's.Home.Away' ... Alternatively you could take the 'AWAY_LIGHTING' as-is and save it under an 'AWAY_DARK_PROGRAMS' folder and use your schedule condition to enable that folder. That would be my preference... --Bill I don't think that is going to do what you want. There is no trigger that can turn your lights off. You need an Else clause in the first program to trigger on the end nodes of the time frames. ie. 2:00 AM and Sunrise. And be aware that your lights will turn off every day whether away or not at the same times. That may not be a bad thing but may bite you down the road when other programs are written and you wonder why. ------------ RUN_AWAY_LIGHTING If From Sunset To 2:00:00AM (next day) Or From 5:00:00AM To Sunrise (same day) Then Run Program 'AWAY_LIGHTING' (If) Else Run Program 'AWAY_LIGHTING' (Else) <---no condition needed. You just want them off no matter what. --------------- I like timers better but you are dealing with external events (like sunrise) Edited June 4, 2015 by larryllix
larryllix Posted June 4, 2015 Posted June 4, 2015 Off topic somewhat: I am just starting to trust ISY more for state variable triggering programs. I spent a lot of time writing industrial control stuff on real time systems like ISY (but bigger) and I am just beginning to realise the power of letting the ISY engine do the dirty work for me. The only trouble is that all the programs involved can be obscure to find when you make function changes. It does simplify programming a lot. Not so many subroutine calls. ahhhh! *** Feature request for Admin Console to make a list on command of all programs that use a given variable. Not a search with one on each result but rather a list of all programs using it. *** Maybe right click on a variable in the variable page and a menu to select, or just a list of programs pops up???
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 And be aware that your lights will turn off every day whether away or not at the same times. That may not be a bad thing but may bite you down the road when other programs are written and you wonder why. Shoot this will be a bad thing because when the home is not set to vacation mode those lights are operated by other programs (Home mode) and I wouldn't want the vacation programs turning the Home mode programs off. I hope that makes sense.
oberkc Posted June 4, 2015 Posted June 4, 2015 I would probably take a slightly different approach, assuming I understand what you want. first program: If $s.Home.Away is 1 then enable second program else disable second program second program If From Sunset To 2:00:00AM (next day) Or From 5:00:00AM To Sunrise (same day) Then Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Send Notification to 'My e-mail' content 'Vaca Lights on' Else Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Send Notification to 'My e-mail' content 'Vaca Lights off'
builderb Posted June 4, 2015 Posted June 4, 2015 ahhhh! *** Feature request for Admin Console to make a list on command of all programs that use a given variable. Not a search with one on each result but rather a list of all programs using it. *** Maybe right click on a variable in the variable page and a menu to select, or just a list of programs pops up??? I'd love to see something like this. I pictured it much like how nodes currently list what scenes they are controllers / responders for when you click on them. Sort of a "this variable is an 'if' for AB&C, a 'then' for DE&F, and an 'else' for XY&Z. " Sent from my iPad using Tapatalk
larryllix Posted June 4, 2015 Posted June 4, 2015 I'd love to see something like this. I pictured it much like how nodes currently list what scenes they are controllers / responders for when you click on them. Sort of a "this variable is an 'if' for AB&C, a 'then' for DE&F, and an 'else' for XY&Z. " Nice!
builderb Posted June 4, 2015 Posted June 4, 2015 Since you mention it, I'd also like the ability to organize variables in a folder structure (this goes for network resources too). My variable page is a hot mess right now, but I'm so used to them being ordered by variable ID that I just leave it alone. And speaking of folders, regarding the OP's question, one possibility is putting your vacation programs in a folder that only runs when vacation = true. I have some vacation timers and other programs I run that way. You just have to plan how the transition between states affects running programs, other schedules, devices that are on, etc., Sent from my iPad using Tapatalk
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 And speaking of folders, regarding the OP's question, one possibility is putting your vacation programs in a folder that only runs when vacation = true. The problem with this is I need the lights to turn off and if they are part of an "else" in a program the folder would not allow the "else" to run.
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 I would probably take a slightly different approach, assuming I understand what you want. first program: If $s.Home.Away is 1 then enable second program else disable second program second program If From Sunset To 2:00:00AM (next day) Or From 5:00:00AM To Sunrise (same day) Then Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Wait 15 seconds Set 'Driveway CFLs Primary' Fast On Set 'Driveway CFLs Secondary' Fast On Set 'Front CFL Floods' Fast On Set 'Landscape Lights' Fast On Send Notification to 'My e-mail' content 'Vaca Lights on' Else Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Wait 15 seconds Set 'Driveway CFLs Primary' Fast Off Set 'Driveway CFLs Primary' Fast Off Set 'Front CFL Floods' Fast Off Set 'Landscape Lights' Fast Off Send Notification to 'My e-mail' content 'Vaca Lights off' If I come in the house and turn vacation mode off while "then" is running in the 2nd program, what would turn the lights off?
oberkc Posted June 4, 2015 Posted June 4, 2015 Great question. As you recognized, nothing would turn the lights off. The question I had, when contemplating this problem, was whether you WANTED the lights to turn off after arriving home, or whether you had other programs that ran during times when you were home. I had, unfortunately, assume the latter. There are, however, solutions if you still want the ELSE path to run, whether home or away.
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 Thanks for sticking with this thread and for your help! When the $s.Home.Away is 0 the house is in “Home Mode”. This is a normal mode for regular day to day activities. We have lights, thermostats, etc. that are controlled by programs while in Home mode. When the $s.Home.Away is 1 the house is in “Vacation Mode”. This is used when we are out of town. I only have 2 programs that use this currently. Each program is used for a thermostat (1 for the downstairs stat and 1 for the upstairs stat). Now I would like to add a program to turn the driveway lights on and off randomly and the landscape and front CFLs on and off continuously. So Vacation mode is for economical thermostat settings, and burglar deterrent lighting. I may even have it turn the hot water recirculation pump and water heater off while in this mode but I digress. When we come home (could be when some vacation mode programs are running true, etc) I would like them to turn the vacation mode lights off, set the stats to a comfortable setting, turn the water pump and heater on, etc. By turning Vacation mode off ($s.Home.Away=0) the Home programs will hopefully run which will should turn the appropriate lights on like usual when we are home. Some of these Home lights are used in the Vacation mode. Hope this helps!
chrishick Posted June 4, 2015 Posted June 4, 2015 The problem with this is I need the lights to turn off and if they are part of an "else" in a program the folder would not allow the "else" to run. I don't know why the else wouldn't run when contained in a folder. I'm not the best programmer, so maybe I'm missing something? You also have to disable all of your "Home Mode" programs otherwise they will conflict with your "Vacation Mode" programs. My feeble brain thinks it would be quite easy to do what you are asking with 3 simple things. 1) Create a folder for Home Mode enabled by $.Home.Away=0. Put all of your normal programs inside. 2) Create a folder for Vacation Mode enabled by $.Home.Away=1. Put vacay programs in here. 3) Create a program that is triggered by the OFF control of the remote link. This program will set $.Home.Away=0 and also insert any clean up commands such as turning off certain lights or adjusting set points on T-stats. I'm sure all of the ISY gurus will shoot my idea full of holes on why this wouldn't work, so shoot away guys.........
apostolakisl Posted June 4, 2015 Posted June 4, 2015 (edited) Thanks for sticking with this thread and for your help! When the $s.Home.Away is 0 the house is in “Home Mode”. This is a normal mode for regular day to day activities. We have lights, thermostats, etc. that are controlled by programs while in Home mode. When the $s.Home.Away is 1 the house is in “Vacation Mode”. This is used when we are out of town. I only have 2 programs that use this currently. Each program is used for a thermostat (1 for the downstairs stat and 1 for the upstairs stat). Now I would like to add a program to turn the driveway lights on and off randomly and the landscape and front CFLs on and off continuously. So Vacation mode is for economical thermostat settings, and burglar deterrent lighting. I may even have it turn the hot water recirculation pump and water heater off while in this mode but I digress. When we come home (could be when some vacation mode programs are running true, etc) I would like them to turn the vacation mode lights off, set the stats to a comfortable setting, turn the water pump and heater on, etc. By turning Vacation mode off ($s.Home.Away=0) the Home programs will hopefully run which will should turn the appropriate lights on like usual when we are home. Some of these Home lights are used in the Vacation mode. Hope this helps! So just make a program that says If $s.Home.Away=0 (I assume the s means it is a state variable) Then Run else for all programs for being on vacation wait 10 seconds Run then or if on all programs for being at home (you'll have to decide if the then or if statement is more appropriate depending on the program details) Else Run else for all programs for being at home wait 10 seconds Run then/if on all programs for being on vacation I also assume you have all your vacation and home programs that get activated or deactivated in folders that get activated or deactivated depending on the $s.Home.Away value. Edited June 4, 2015 by apostolakisl
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 (edited) I do have the home programs in a folder set to Home.Away =0 and I have all the vacation programs in a vacation folder set to Home.away =1. The problem has been when home.away changes to 1, the program "else" commands in the home folder never activate...ie. a light program in the home folder may have an "else" to turn the light off but this would never happen since the folder is no longer active. So with this in mind, I removed the folder home.away conditions but included the variable in each program within those folders. I could change this back. Your program may just do the trick but "Run else for all programs for being at home" part of your program has me concerned. Depending on the time of day for example I may or may not want some home folder programs to run "else". Edited June 4, 2015 by jmed999
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 I don't know why the else wouldn't run when contained in a folder. I'm not the best programmer, so maybe I'm missing something? You also have to disable all of your "Home Mode" programs otherwise they will conflict with your "Vacation Mode" programs. My feeble brain thinks it would be quite easy to do what you are asking with 3 simple things. 1) Create a folder for Home Mode enabled by $.Home.Away=0. Put all of your normal programs inside. 2) Create a folder for Vacation Mode enabled by $.Home.Away=1. Put vacay programs in here. 3) Create a program that is triggered by the OFF control of the remote link. This program will set $.Home.Away=0 and also insert any clean up commands such as turning off certain lights or adjusting set points on T-stats. I'm sure all of the ISY gurus will shoot my idea full of holes on why this wouldn't work, so shoot away guys......... As of now remotelinc button b "On" sets home.away =1 and when button b is "Off" it sets home.away = 0.
jmed999 Posted June 4, 2015 Author Posted June 4, 2015 (edited) I don't know why the else wouldn't run when contained in a folder. I'm not the best programmer, so maybe I'm missing something? If the Home folder only works if home.away =0 then once in vacation mode (home.away = 1) the home folder stops working so the else commands in programs in the home folder will not be triggered. This will cause issues but I'm sure there's a way around it. Edited June 4, 2015 by jmed999
chrishick Posted June 4, 2015 Posted June 4, 2015 Yes, when a folder condition is no longer true the programs within will terminate and not allow the else statement to run. So just attach whichever commands you need to the remote link off or on buttons. In other words, whatever else commands do not activate just have them run when you press the away button of the remote link.
Recommended Posts