zsima Posted February 7 Posted February 7 Hi I am trying to run a series of command ( ie lights on/off) to run randomly between sunset and sunrise. What would be the best way to program this? Thanks
Geddy Posted February 7 Posted February 7 @zsima Lots of ways to do this, but the best is to start with the "IF" for being from Sunset to Sunrise (next day), You can also make a folder with folder conditions that would only allow the folder to be "true" from Sunset to Sunrise (next day) and then programs inside there to turn lights on and off at set times. Random-On-Example If From Sunset To Sunrise (next day) Then - No Actions - (To add one, press 'Action') Else - No Actions - (To add one, press 'Action') What you can then do is add waits and turn lights on then more waits and turn off. I do this some with programs to run when out of town to randomly turn lights on and off. I add a fixed wait time then a random wait time to at least get some difference for the starting time and/or the time between when lights are turned off. Note, since random really is just that I add the fixed time to be sure the lights are on for at least 2 hours. You could alter/adjust to fit what you're trying to do. Like this: Random-On-Example2 If From Sunset To Sunrise (next day) Then Wait 2 hours Wait 21 minutes (Random) Set 'Backdoor' On Set 'Front Door' On Set 'Table' On Wait 2 hours Wait 1 hour and 21 minutes (Random) Set 'Backdoor' Off Wait 1 hour and 21 minutes (Random) Set 'Front Door' Off Wait 1 hour and 21 minutes (Random) Set 'Table' Off Else - No Actions - (To add one, press 'Action') Folder conditions setting: (Note, folder conditions are special and should not be set on the root folder ("My Programs"). Any folder condition controls all programs within THAT folder. If the Folder is "False" nothing in that folder will trigger.) Tests - Folder Conditions for 'Tests' If From Sunset To Sunrise (next day) Then Allow the programs in this folder to run.
zsima Posted February 8 Author Posted February 8 Thanks you Geddy for your program. That is pretty much what I am looking for. If I would want the sequence to run several times (not a fixed amount of times because it would depend on the random wait periods) in the 24 hour period how would I loop back to the beginning of the sequence? Thanks again for your help
Geddy Posted February 8 Posted February 8 @zsima you could use the "Repeat" function in the program. I don't typically use repeat; therefore, I don't have much experience with it. Know that any change in the "IF" statement will cause the program to re-evaluate might stop the wait and/or repeat portion. You can read more about programming in the ISY Cookbook found in the UD wiki. While it was written in the ISY994 days (and some even before) much is still applicable today. It can get even more advanced by using deactivated programs that are called by other programs. Options are limitless. Just have to "play" and learn what works for what you're trying to achieve. Note: To test the program disable the program (so the "if" isn't evaluated), right click the program and select "RUN THEN". That should run the lights and waits that you setup. If I do this I'll reset all the waits to something like 10-20 seconds so the lights cycle quicker than waiting hours.
Andy P Posted March 1 Posted March 1 (edited) My approach is to create a folder called "random lights" and set the condition for that folder to a variable that gets set by a button on a scene controller so I can turn it on as I leave the house if I am going to be gone for a couple days. Then inside that folder there are a series of programs for each room I want to randomize - like Random Kitchen, Random Office, etc. I found it easier to just create a program for each room. Here is one example program that uses Repeat: Random Mudroom - [ID 0028][Parent 0023] If Time is Sunset + 30 minutes Then Repeat 5 times Wait 45 minutes (Random) Set 'Main Hallway' On 20% Wait 1 hour (Random) Set 'Main Hallway' Off Else - No Actions - (To add one, press 'Action') Edited March 1 by Andy P
Recommended Posts