Has someone an Idea of making a rule that checks the time in an presence management heating rule

  • Platform information:
    • Hardware: _AMD64 8 Core/32GB RAM/ 128GB SSD OS/10 TB Storage
    • OS: Ubuntu Server 16.04.4 LTS
    • Java Runtime Environment: Oracle Java 1.8.0.161
    • openHAB version: 2.2.0
  • Issue of the topic: I wrote a rule that worked so far so good. But today We (I and my girlfriend came home late) noticed that our heating controles are not right for the time we had. I realised at the moment my rule is not checking the time. I worte a rule that checks presence management but not checks the time at the moment we arived at home.

Here is the rule:

rule “Badezimmer_Anwesend_Tagestemperatur”
when
Item vAlleAusserHaus changed to OFF or Time cron “0 0 5 1/1 * ? *”
then
if( vAlleAusserHaus.state==OFF ) {
logInfo(“Rule”,"–> Badezimmer_Anwesend_Tagestemperatur, 22.0")
Bathroom_Heating.sendCommand(22.0)
Bathroom_Heating.postUpdate(22.0)
} else {
logInfo(“Rule”,"–> Badezimmer_Abwesend_Nachttemperatur, 19.0")
Bathroom_Heating.sendCommand(19.0)
Bathroom_Heating.postUpdate(19.0)
}
end

rule “Badezimmer_Abwesend_Nachttemperatur”
when
Item vAlleAusserHaus changed to ON or Time cron “0 0 22 1/1 * ? *”
then
logInfo(“Rule”,"–> Badezimmer_Abwesend_Nachttemperatur, 19.0")
Bathroom_Heating.sendCommand(19.0)
Bathroom_Heating.postUpdate(19.0)
end

rule “Badezimmer_Tagestemperatur_prüfen”
when
Time cron “0 5 5 1/1 * ? *”
then
if( vAlleAusserHaus.state==OFF ) {
if( Bathroom_Heating.state==20.0 ) {
logInfo(“Rule”,"–> Badezimmer_Anwesend_Tagestemperatur, 20.0 war im ersten Anlauf erfolgreich")
} else {
Bathroom_Heating.sendCommand(20.0)
Bathroom_Heating.postUpdate(20.0)
logInfo(“Rule”,"–> Badezimmer_Anwesend_Tagestemperatur, 20.0 war im ersten Anlauf nicht erfolgreich")
}
}
end

My kind of Idea is to check the time with an if else statement with the time we had now but I don’t now how to do it. so something like if (time is later than 22:00) { postUpdate, 19.00} else {opstUpdate, 22.0} something like that.

Thanks for your help

heartsaver1859

I’d try to work with Such setup.