[SOLVED] createTimer (tomorrow noon) in a rule

Yes, I have searched the forum :wink:

Q: How do I use createTimer() to create a timer for tomorrow, 11 o’clock ?

Background: I have a heatpump wich does get a lot of on-off cycles when it is not really cold outside. I switch it off when it cycled 10 times a day and want to re-activate it the next day at 11 o’clock. CreateTimer (now.plus) is not good since the time when the 10 cycles are reached is different for each day.

My rule now is:

rule "OFF"
when
    Item Vito_cycles changed  
then
if (Vito_cycles.deltaSince(now.withTimeAtStartOfDay) >10){
 
        Vito_ONOFF.postUpdate(1) // off
        VitoTimer=createTimer(now.plusMinutes(21)) [
                Vito_ONOFF.postUpdate(2)  // back to on.
                ]
  }
 end

Remove the timer and write a second rule with cron trigger at 11 o’clock that re-activates your pump.

@gitMiguel
That will trigger every day
I think the OP wants the option to trigger that on demand

@s0170071

See: DateTime Conversion Overview

How about
now.withTimeAtStartOfDay.plusHours(24+11)
That should do it, right?

1 Like

Yes but you’ll have problen with the daylight saving time changes:

now.withTimeAtStartOfDay.plusDays(1).plusHours(11)

will take care of that

1 Like

Thanks.

Please mark the thread as solved, thanks