I am going to write an easy holiday simulation script (JS) and like to hear some experts’ opinions/comments on the concept before starting to write the script.
As I do not want to make it too complicated, I have some personal prerequisites/preferences:
- maintan the whole simulation in one script
- define for a subset of my lights and rollershutters items a static plan as an
array
(one plan each for every third day) when to switch them on/off.
I am thinking about realizing in one of the two ways:
- The script will be triggered every 30 minutes and loops through the array. If it matches the correct name of day and the time to switch on/off a device is within the next 30 minutes, then `createTimer’
- run the script once per day and create all timers for the whole day
In total I will be switching on/off 5-10 devices per day (and only in the evening between 4-12 pm).
Number one is a bit more of work but I guess it is more “stable”, in case OH is restarting. Not sure if a timer “survives” a restart.
Anyway, that’s why I am asking for some general feedback from professionals.
Thanks in advance.