johnjces Posted April 21, 2017 Share Posted April 21, 2017 In searching the forum, Googling and reading up on ISY programming, I don't see a way to program a random day of the week with an event firing within a random time frame on this random day. Is there a way? Thanks! John Link to comment
larryllix Posted April 21, 2017 Share Posted April 21, 2017 Welcome to the forum! You haven't stated what firmware version you are running. V5 made a big jump in possibilities as far as making these things easier. In v5.0.9 alpha, I have periodically running time of day, and day of month, system parameter grabber programs that put DD.MM and hh.mm into decimal state variables. Triggers to look for random dates and random times could be created, easily, from the random arithmetic function built into ISY. Link to comment
johnjces Posted April 22, 2017 Author Share Posted April 22, 2017 (edited) Thanks for the reply! I am using the current stable version firmware 4.5.4. I never thought about doing such with a variable for the month / day and hour / minute. I would love to see an example to help me understand this if possible. Should I look at one of the Beta/Alpha versions? In looking at the beta forum area, where I guess one would find urls for beta firmware, I see nothing for anything above 4.5.4. Thanks! John Edited April 22, 2017 by johnjces Link to comment
stusviews Posted April 22, 2017 Share Posted April 22, 2017 There is no Beta newer Beta for 4+. The current version, 4,5,4, is an official release. There is no Beta for v5+. Since its onset, it's been in Alpha. Link to comment
oberkc Posted April 22, 2017 Share Posted April 22, 2017 johnjces, I am a little unclear on the details. Do you want this to "fire" only once per week, and no more than once per week? Seven day week? Five day? Something else? I believe this can be done on version 4.5.4. It would probably be a brute force approach, with several programs involved. Conceptually, one can create a program to generate a random variable value between 1-7 (alternatively, may be between 0-6, but I would have to investigate). At the beginning of each week I would run that program. Once the variable is set each week, I would create seven programs, one for each day of the week. Each program would check if the weekly variable matched the day of the week. If not, do nothing. If so, run a path which fires whatever event you desire at a random time. This is all experimental for me. These are program conditions and actions I don't use personally. Still, I think it has a good chance of working. Link to comment
apostolakisl Posted April 22, 2017 Share Posted April 22, 2017 (edited) You would use the "wait" and "random" feature 2 Copy - [ID 0153][Parent 0093] If On Sat Time is 1:00:00AM Then Wait 168 hours (Random) put whatever you want to happen here Else - No Actions - (To add one, press 'Action') There are 168 hours in a week. This program triggers once per week at the same time (makes no difference what day of week or time you pick), then it waits a random amount of time between 0 seconds and 168 hours (one week). The next line after the wait is where you put what you want to happen. Once it finishes the random wait time, it executes your desired action, then the program ends. The process restarts the random one week event starting at the "if" time. In summary, whatever your action item is, it will happen once per week at some random time during that week. Edited April 22, 2017 by apostolakisl 1 Link to comment
johnjces Posted April 23, 2017 Author Share Posted April 23, 2017 Thanks for the comments and thoughts! The random hour brought about by apostolakisl was something that I had played with as it was simple, but putting a random time within constraints, like between sunset and 2330 same day. I can see that a couple programs linked might be the answer. Once I get my random day start and get a random time between my parameters. ... and yes, once a week for a random day then my time. You guys have given me some direction and I will play with it! John Link to comment
apostolakisl Posted April 23, 2017 Share Posted April 23, 2017 (edited) If you want it to happen on a random day of week, but at a specified time you need 1) 2 programs 2) a variable The first program sets a variable to 1 at some random time during the week The second program runs only if the variable is 1 at sunset. It waits a random amount of time for 3 hours and executes. You can't do Sunset to a specific time because sunset to that time changes every day. You would need to think about the exact timing of setting the variable to 1. As it stands now, if it randomly sets to 1 after sunset on the 7th day, the program won't run that week. Also, you would want to adjust so that there is an equal probability of it being one at sunset all days of the week. 2 Copy - [ID 0153][Parent 0093] If On Sat Time is 1:00:00AM Then Wait 168 hours (Random) $Int_RandomDay = 1 Else - No Actions - (To add one, press 'Action') 2 Copy Copy - [ID 0154][Parent 0093] If Time is Sunset And $Int_RandomDay is 1 Then Wait 3 hours (Random) $Int_RandomDay = 0 Do your stuff here Else - No Actions - (To add one, press 'Action') Edited April 23, 2017 by apostolakisl Link to comment
apostolakisl Posted April 23, 2017 Share Posted April 23, 2017 Or, it would be cleaner to use enable/disable and avoid the variable 2 Copy - [ID 0153][Parent 0093] If On Sat Time is 1:00:00AM Then Wait 168 hours (Random) Enable Program '2 Copy Copy' Else - No Actions - (To add one, press 'Action') 2 Copy Copy - [ID 0154][Parent 0093][Not Enabled] If Time is Sunset Then Wait 3 seconds (Random) Do your stuff here Disable Program '2 Copy Copy' (this program) Else - No Actions - (To add one, press 'Action') Link to comment
Recommended Posts