I’ve got some pretty simple automation set up currently. A few scenes for watching movies (which aren’t technically automation) and an automation of some outside lights that turn on just before sunset and then turn off just after sunrise. This has been working quite well.
I’d like to set up another automation that turns a few lights on somewhere around sunset (that part is easy - the ‘Turn On’ would be essentially the same as in my existing automation), but then shut them off at a random time within a time window, say between 9:30 and 11 pm. I think I have setting a specific time to turn off, but I don’t want it to be a static time - I’d like it to be random within a window.
Is something like this possible, or would it be beyond HA capabilities?
This allows me to search the entire HA site by clicking the bookmark and then just putting my search criteria in after the site name. That’s how I found the item above.
I know the ‘Turn Lights Off’ belongs in Automation - I assume Get Random Time’ does as well?
I’m not quite sure how to interpret the ‘Get Random Time’ function. The ‘After: ‘21:00:00’’ is self explanatory, but how does the ‘input_slider.hour’ fit in? does that make the function ‘after 21:00, and before 22:00 and 23:00’? Or is it ‘After 21:00’ fo the main value, but then the random makes a selection between 22:00 and 23:00?
With the minute value, does the ‘(range(30, 45)’ mean somewhere between xx:30 and xx:45, so if I were to change it to, say, ‘(range(01, 59)’, would that mean the possible random value would be between 22:01 and 23:59?
From what I can see, yes. The GRT automation acts like a function and that value is used in the Lights Off automation.
Keeping in mind that this isn’t my automation - so get a second opinion from the author - it looks like the sliders are used to store the hour and minute values that are generated by the random function. Actually pretty cool, but he had it commented out so I’m not sure if it was just a thought experiment or he actually got it to work and then just put it aside to use it later.
I haven’t used this one yet. Future Ideas. I have just broken out the lights into interior and exterior lights so the random times will be the next step for the outdoor lights. Random colors might be next after that! I will update my github of course and try to revisit this thread when I have it working.