Temperature constantly resets

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?

I think you only want to run the rule on changed.
Devices can and do make periodic updates to the same value.

1 Like

Thank you @rossko57!
I tried this and it seems to be the solution to the problem. I will wait until tomorrow.

Another question:
Are all the “postUpdate” (commented out in the example) necessary?

What’s this doing, just saving the existing value for later?
You would normally do that with a postUpdate.
sendCommand is usually used when you want something to happen.

sendCommand just to store a state is inefficient, both the command and the actual state update churn around on the event bus.

What does what?

What that?.

Sorry, I do not understand

What are all the “postUpdate” (commented out in the example) doing, just saving the existing temperature to an Item for later?
(Bear in mind I have no idea what your Items are intended for, or what you expect the rule to do exactly)

You would normally do the saving of an existing value to an Item by postUpdate.

When you send a command to an Item, it’s just a command and does not directly affect an Item’s state. Commands are usually meant for something else to act,like a binding or another rule.
openHABs autoupdate feature is enabled on each Item by default, and is one of the things listening out for commands. It takes the command, guesses the likely outcome, and updates the Item state with a new value.

If you just want to write something to the Item state, do so directly using postUpdate. It’s less work for your system,less entries in your logs.

I have no clue what you are writing. I even used a translator and came up with the same gibberish, sorry.

postUpdate is an openHab command. That’s all I can say about it:

I do not understand your question.

And do I want that? Or rather just sendCommand? Or both? That is my question.

I just want to do exactly that:

As simple and correct as possible.

Some posts use postUpdate, some use sendCommand, and some use both. I do not understand any deeper meaning.

Yes.
Some people are careless.
Some people do not understand what they are doing.
Some people copy others work without understanding.

You can send an Item a command.
A command is usually used to do something to an external device - switch it on, perhaps.
A command may, or may not, affect an Item’s state.

There is a feature of openHAB called autoupdate, automatic update.
Every Item has autoupdate turned on, by default.
The function of autoupdate is to take a command to an Item, and make an update to the Item state out of the command.

So, you can send an Item a command, and a system feature will make a change in the Item’s state.
That is three operations by the system.

Or, you can update an Item’s state directly.
That is one operation by the system.

1 Like