[Midnight rules]

Hello,
i know that it’s an easy question but really don’t understand how to do.
I’d like to create a rules that every night (24.00) execute a command.
But don’t understand how to create it…
can u help me?
thanks in advance

Hi,

do you use OH 1.8.x, or 2.0 Beta? I ask because I recommend to use the appropriate designer; with + it has intellisense like features that help especially in the beginning.

Please have a look at the wiki @ https://github.com/openhab/openhab/wiki/Rules#time-based-triggers

If this does not help do ask again.

regards,
Patrik

There is a special Time trigger.

Time midnight

Or you can use the cron trigger.

Time "cron 0 0 0 * ? *"

You will need to double check that, typing from memory on my phone so I could have the quotes and/or the ? In the wrong place.

thanks to all!
i’m using OH 1.8.3
I’m not using OH 2.0 beacuse it’s really hard move all to the new OH and now i have just few hours on the weekend :frowning:
I’ll try it!
Thanks in advance!

I use this thread as it makes sense. I just wonder if I use days in the cron expression as well as midnight, will it be the midnight TO these days or what? For instance:

Time cron “0 0 0 ? * SAT-SUN”

Does that mean Saturday and Sunday midnight or actually Friday and Saturday midnight?

I guess this depends on what you are referring to as “midnight” :smile_cat: 0:00:00 is by definition the beginning of the next day. Your cron rule will hence be triggered midnight from Friday to Saturday and midnight from Saturday to Sunday.

You can easily check the meaning of a cron expression at: http://www.cronmaker.com