Turn off in the evening
rule “HeizungNachtWohnenAus”
when
Time cron “0 45 22 * * ? *” // um 22:45 und 0 Sekunden
then
sendHttpGetRequest(“http://IP:PORT/set/thermostat/ABBxxxxx/ch0000/off”) //Wohnzimmer
end
The other way round in the morning
I have two questions now:
How can i put that into one rule instead of having 2 rules
I want to control the rule via Habpanel, e.g. via Switch item. How can i implement that?
rule "HeizungNachtWohnenAus"
when
Time cron "0 45 22 * * ? *" or // um 22:45 und 0 Sekunden
Time cron "0 0 0 * * ?" or // your time
Item yourTriggerSwitch received command ON
then
sendHttpGetRequest(“http://IP:PORT/set/thermostat/ABBxxxxx/ch0000/off”) //Wohnzimmer
end
Sorry, this was a bit naively from my point of view, as i’m a newbie.
But if you can get the actual state of your thermostate, you can think about using an if-Statement or switch/case-Statement in the execution-block. Perhaps you find some information here.
Use an if statement to check if the switch is on before execution of the rule.
Example:
rule "HeizungNachtWohnenAus"
when
Time cron "0 45 22 * * ? *" or // um 22:45 und 0 Sekunden
Time cron "0 0 0 * * ?" or // your time
Item yourTriggerSwitch received command ON
then
if(yourTriggerSwitch.state == ON)
sendHttpGetRequest(“http://IP:PORT/set/thermostat/ABBxxxxx/ch0000/off”) //Wohnzimmer
end
When time or the switch is triggered the rule will fire. If you have the switch on then the rule runs. if the switch is OFF then the statement is false and nothing happens.
I guess you want to send different commands? The problem is, you can’t get an explicit information about which Time cron triggered te rule. But of course it’s possible to “guess” the correct one.
rule "HeizungNachtWohnenAus"
when
Time cron "0 45 22 * * ? *" or // um 22:45 und 0 Sekunden to switch off
Time cron "0 0 6 * * ?" or // the time to switch on
Item yourTriggerSwitch received command // a switch to manually switch off/on
then
var String myCommand
if(triggeringItem !== null) { // rule was triggered by switch
if(triggeringItem.state == ON) {
myCommand = "on"
} else {
myCommand = "off"
}
} else {
if(now.getMinuteOfDay == 22 * 60 + 45) { // Time cron 0 45 22
myCommand = "off"
} else
if(now.getMinuteOfDay == 6 * 60 + 0) { // Time cron 0 0 6
myCommand = "on"
}
}
sendHttpGetRequest("http://IP:PORT/set/thermostat/ABBxxxxx/ch0000/"+myCommand) // Wohnzimmer
end