- Platform information:
- Hardware: Raspberry PI4
- OS: Raspberry Pi OS (32-bit)
- Java Runtime Environment: openJDK version “11.0.9.1” 2020-11-04
- openHAB version: 3.0.1
I’m using OH now for a few months and make myself more and more familiar with it. By doing so I encounter more and more details to solve - like below …
I’m using a cron job to schedule daily heating up of a room in the morning in a simple rule as below. It works very reliable so far. I maintain rules in separate rule-files.
rule "AZ-Heizplan: AN"
when
// weekdays ...
Time cron "0 0 14 ? * SAT *" or //14:00 Uhr
Time cron "0 0 16 ? * SUN *"
then
T_AZ_Setpoint.sendCommand("20.5")
end
Occasionally the cron job and opening a window clashes - For instance a window is opened in the morning. A bit later at the scheduled time the heating switches into its normal day-time temperature triggered by the cron job, which I want to avoid.
So I’m looking for a way to somehow “pause” or “re-schedule” the cron trigger. Heating up shall start, if the window was closed. I tried a few things but unfortunately it didn’t work out so far as I want.
What I do if a window opens is I persist the last Setpoint value and retrieve it after to window closed. That also works well.
var String para_1
rule "AZ-Fenster-AUF"
when
Item F_AZ_SensorWindow changed from CLOSED to OPEN
then
para_1 = T_AZ_HeatMode.state.toString
createTimer(now.plusSeconds(5), [ |
if(para_1 == "1" || para_1 == "15") {
T_AZ_Setpoint.persist("mapdb")
T_AZ_Setpoint.sendCommand("8")
}
else
logInfo("rule: AZ-Fentser-AUF", "Keine Bedingung passt")
]) end
What I have in mind is to combine the persistence service with the situation “heating-up and window open”. But unfortunately I couldn’t figure out how.
rule "AZ-Heizplan: AN"
when
// cron ...
then
// wenn das Fenster geöffnet
if(F_AZ_SensorWindow == OPEN) {
// How to change temp after window was closed?
}
// wenn das Fenster geschlossen ...
else {
T_AZ_Setpoint.sendCommand("20.5")
}
end
I hope anyone can give me some support on this or even has another idea how to solve this?
Thank you very much in advance,
Peter