Cron usage

I have some schedulers set using CRON settings. But each has been single use: either turn ON or turn OFF, not both. I THINK I have experimented with time range (2 20 * * *)>(14 20 * * * ) but the standard script seems to use this and send on and off commands EVERY SINGLE MINUTE OF OVERY SINGLE DAY, either on or off. That is crazy to me so I am trying to figure out a good script to just send the ON and send the OFF. I have learned to be reliable I need to send this multiple times to be sure the command gets thru.

So my ON or OFF uses cron like this: [ (15 6 * * *) : (16 6 * * *) : (17 6 * * *) ]

So I would like a script to send ON command only 3 times like this and also only send an OFF 3 times.

So like this?

[ (15 6 * * *) : (16 6 * * *) : (17 6 * * *) ] > [ (25 6 * * *) : (26 6 * * *) : (27 6 * * *) ]

But only want the scheduler to send 6 commands per above.

I’m not sure I understand your request.
To set the shutdown or the power on only once, I think you can use this script:

// Turn on, if previous minute was not in schedule (start occurrence range)
if (!$$.onPrevious())
// Turn off, if next minute won’t be in schedule (end occurrence range)
if ($$.onPrevious() && !$$.onNext())

It’s not possible to do this using single cron expression due to the nature and a purpose of cron. You should use separate cron schedules for separate actions. In your case you have 2 actions: turn ON and turn OFF.


And that works; it is how I have done my ArmON and ArmOFF for the last 6 months, and for last 2 days for my FanON an FanOFF. Just thought I could write a script to do it.

Thanks again.

Bounz, It would be great to understand DATE RANGE in scheduler better.

If I say turn ON at 8am and OFF at 9am, I believe I read that it will send an OFF command EVERY SINGLE MINUTE NOT BETWEEN 8-9AM, AND send an ON command EVERY SINGLE MINUTE BETWEEN 8:00 AND 9:00AM.

Can this be true?