Trigger every N days at a certain time.

Hi all,

I am trying to figure out the best way to trigger my sprinklers every N days at 9pm local time. Early in the spring when it rains a lot, N=3. Around this time of year, N=2. And from late fall to early spring I don’t want it to trigger at all. I am fine manually changing the value for N since the day that value changes isn’t constant year to year.

It looks like I might be able to use PLEG, but I couldn’t figure out from the instructions how I would write the expression.

If nothing exists, I am willing to write a plugin, but I figured I would ask before investing the time.

Thanks!

You really don’t need a plugin for this. All that’s required is a scene which is scheduled every day for the time that you want, and a one-liner piece of Lua code in the scene which only allows it to continue every third day. The invocation is:

return (os.date ("%j") % 3) == 0

Of course, you can make this a bit fancier and have the days read from a Variable Container if you don’t ever want to touch the code again.