This object is in archive! 

Switch on/off lights at random time in morning/evening

dimitri shared this question 7 years ago
Need Answer

Hi All,

I am trying to create a rule where i can have my living room light switched on at a random time between 04:45AM and 5:15AM and then off at 7:30AM and in the evening on between 6:15PM and 6:45PM and then off at 10PM. I used to have a rule working that'd switch the light on at 05:10AM and off at 6:45PM but they no longer work after the issues with the Virtual Weather Station.

Attached is a rule i've add to open my curtains at sunrise that does work and a non working rule regarding my lights. It seems that using the scheduler will only allow me to activate my lights as per Sunrise and Sunset since if i omit the the IF clause it will work but only at Sunrise/Sunset which is not what i need.

Any help is greatly appreciated!

Replies (3)


I use a virtual sensor (also possible with a virtual switch) that registers if it is night time. I use two rules that change the status of the virtual sensor/switch executed respectively at sunrise/sunset time. Then you can create a rule that is triggered every 15 minutes and check if time is between your range and if it is night time to randomly turn light on. Of course all is broken now oth virtual weather station.


Nice long rule. This will one of the reasons why I need ultrawide monitor...


Nice pointless addition to a thread :-).

Anyone with a more usefull answer ?

Leave a Comment
Attach a file