System:
- Openhabian 2.5.3
- Raspberry Pi 3
- HM-CC-RT-DN
- HM-Sec-SCo
I control three thermostats (HM-CC-RT-DN) with one window contact each (HM-Sec-SCo):
When the window is open, the temperature should be lowered to “Off” (4.5 °C). When the window is closed, the previous temperature should be restored.
For this I have created items and rules. A dummy item is used to store the temperature before the window is opened.
Often the window is closed and a temperature is set and it is still switched to the temperature that was set before the last time the window was opened. Although no window was opened in the meantime.
items file:
// Büro
Contact ck_fenster_office_open "Fenster" <window> (bZimmer) { channel="homematic:HG-HM-Sec-SCo:b4014820:REQ0533212:1#STATE" }
Switch ck_termo_office_open "Fensterkontakt" <fensterkontakt> (bZimmer) { channel="homematic:HG-HM-CC-RT-DN:b4014820:PEQ1313275:3#WINDOW_STATE" }
Number ck_termo_office_temp "Temperatur [%d °C]" <temperature> (bZimmer) [ "TargetTemperature" ] { channel="homematic:HG-HM-CC-RT-DN:b4014820:PEQ1313275:4#SET_TEMPERATURE" }
Number ck_termo_office_temp_vorher "Temperatur [%d °C]" <temperature> (bZimmer) [ "PreviousTemperature" ]
// Wohnzimmer
Contact ck_fenster_living_open "Fenster" <window> (wZimmer) { channel="homematic:HG-HM-Sec-SCo:b4014820:REQ0533213:1#STATE" }
Switch ck_termo_living_open "Fensterkontakt" <fensterkontakt> (wZimmer) { channel="homematic:HG-HM-CC-RT-DN:b4014820:REQ0842766:3#WINDOW_STATE" }
Number ck_termo_living_temp "Temperatur [%d °C]" <temperature> (wZimmer) [ "TargetTemperature" ] { channel="homematic:HG-HM-CC-RT-DN:b4014820:REQ0842766:4#SET_TEMPERATURE" }
Number ck_termo_living_temp_vorher "Temperatur [%d °C]" <temperature> (wZimmer) [ "PreviousTemperature" ]
// Schlaffzimmer
Contact ck_fenster_sleep_open "Fenster" <window> (sZimmer) { channel="homematic:HG-HM-Sec-SCo:b4014820:REQ0533190:1#STATE" }
Switch ck_termo_sleep_open "Fensterkontakt" <fensterkontakt> (sZimmer) { channel="homematic:HG-HM-CC-RT-DN:b4014820:REQ0845285:3#WINDOW_STATE" }
Number ck_termo_sleep_temp "Temperatur [%d °C]" <temperature> (sZimmer) [ "TargetTemperature" ] { channel="homematic:HG-HM-CC-RT-DN:b4014820:REQ0845285:4#SET_TEMPERATURE" }
Number ck_termo_sleep_temp_vorher "Temperatur [%d °C]" <temperature> (sZimmer) [ "PreviousTemperature" ]
rules file:
rule "Heizung Fensterauf Buero"
when
Item ck_fenster_office_open received update
then
if (ck_fenster_office_open.state.toString == "OPEN") {
// ck_termo_office_open.postUpdate("ON")
ck_termo_office_open.sendCommand("ON")
// ck_termo_office_temp_vorher.postUpdate(ck_termo_office_temp.state as DecimalType)
ck_termo_office_temp_vorher.sendCommand(ck_termo_office_temp.state as DecimalType)
// ck_termo_office_temp.postUpdate(4.5)
ck_termo_office_temp.sendCommand(4.5)
} else if (ck_fenster_office_open.state.toString == "CLOSED") {
// ck_termo_office_open.postUpdate("OFF")
ck_termo_office_open.sendCommand("OFF")
if (ck_termo_office_temp_vorher.state == null) {
// ck_termo_office_temp_vorher.postUpdate(ck_termo_office_temp.state as DecimalType)
ck_termo_office_temp_vorher.sendCommand(ck_termo_office_temp.state as DecimalType)
} else {
// ck_termo_office_temp.postUpdate(ck_termo_office_temp_vorher.state as DecimalType)
ck_termo_office_temp.sendCommand(ck_termo_office_temp_vorher.state as DecimalType)
}
}
end
rule "Heizung Fensterauf Wohnzimmer"
when
Item ck_fenster_living_open received update
then
if (ck_fenster_living_open.state.toString == "OPEN") {
// ck_termo_living_open.postUpdate("ON")
ck_termo_living_open.sendCommand("ON")
// ck_termo_living_temp_vorher.postUpdate(ck_termo_living_temp.state as DecimalType)
ck_termo_living_temp_vorher.sendCommand(ck_termo_living_temp.state as DecimalType)
// ck_termo_living_temp.postUpdate(4.5)
ck_termo_living_temp.sendCommand(4.5)
} else if (ck_fenster_living_open.state.toString == "CLOSED") {
// ck_termo_living_open.postUpdate("OFF")
ck_termo_living_open.sendCommand("OFF")
if (ck_termo_living_temp_vorher.state == null) {
// ck_termo_living_temp_vorher.postUpdate(ck_termo_living_temp.state as DecimalType)
ck_termo_living_temp_vorher.sendCommand(ck_termo_living_temp.state as DecimalType)
} else {
// ck_termo_living_temp.postUpdate(ck_termo_living_temp_vorher.state as DecimalType)
ck_termo_living_temp.sendCommand(ck_termo_living_temp_vorher.state as DecimalType)
}
}
end
rule "Heizung Fensterauf Schlaffzimmer"
when
Item ck_fenster_sleep_open received update
then
if (ck_fenster_sleep_open.state.toString == "OPEN") {
// ck_termo_sleep_open.postUpdate("ON")
ck_termo_sleep_open.sendCommand("ON")
// ck_termo_sleep_temp_vorher.postUpdate(ck_termo_sleep_temp.state as DecimalType)
ck_termo_sleep_temp_vorher.sendCommand(ck_termo_sleep_temp.state as DecimalType)
// ck_termo_sleep_temp.postUpdate(4.5)
ck_termo_sleep_temp.sendCommand(4.5)
} else if (ck_fenster_sleep_open.state.toString == "CLOSED") {
// ck_termo_sleep_open.postUpdate("OFF")
ck_termo_sleep_open.sendCommand("OFF")
if (ck_termo_sleep_temp_vorher.state == null) {
// ck_termo_sleep_temp_vorher.postUpdate(ck_termo_sleep_temp.state as DecimalType)
ck_termo_sleep_temp_vorher.sendCommand(ck_termo_sleep_temp.state as DecimalType)
} else {
// ck_termo_sleep_temp.postUpdate(ck_termo_sleep_temp_vorher.state as DecimalType)
ck_termo_sleep_temp.sendCommand(ck_termo_sleep_temp_vorher.state as DecimalType)
}
}
end
The error habens like this:
2021-01-28 15:19:31.252 [ome.event.ItemCommandEvent] - Item 'ck_termo_office_open' received command OFF
2021-01-28 15:19:31.314 [ome.event.ItemCommandEvent] - Item 'ck_termo_office_temp' received command 4.50
2021-01-28 15:19:31.349 [nt.ItemStatePredictedEvent] - ck_termo_office_open predicted to become OFF
2021-01-28 15:19:31.372 [vent.ItemStateChangedEvent] - ck_termo_office_temp changed from 21.00 to 4.50
2021-01-28 15:19:31.377 [nt.ItemStatePredictedEvent] - ck_termo_office_temp predicted to become 4.50
2021-01-28 15:19:33.188 [vent.ItemStateChangedEvent] - ThermostatBRo_4_SetTemperature changed from 21.00 °C to 4.50 °C
Here is the log over 24h: event.log - Pastebin.com
Where is the error?