Problem with the rules. Heating rule

Hello. Just started learning Openhab. And everything was fine until I got to the rules. I’m not a programmer, so I did it using examples.

rule "Ventilation control"
when  
Item FF_Bathroom_Humidity changed
then
if (FF_Bathroom_Humidity.state >= 70) FF_Bathroom_Fan.sendCommand(ON)
else if (FF_Bathroom_Humidity.state <= 60) FF_Bathroom_Fan.sendCommand(OFF)
end

Fan control by air humidity. Everything works. Depending on the humidity, MQTT sends commands to turn the fan on or off.

By analogy, I wanted to make heating control. But the command to turn on or off the heating from the MQTT broker is not received. I look in MQTT. FX

rule "Heating control"
when  
Item FF_Bathroom_HeatingSet changed
or
Item FF_Bathroom_Heating changed to ON
or
Item FF_Bathroom_Temperature changed
then
if (FF_Bathroom_Heating.state == ON)
{
	if (FF_Bathroom_Temperatur.state >= FF_Bathroom_HeatingSet.state) FF_Bathroom_ThermalHead.sendCommand(OFF)
	else if (FF_Bathroom_Temperatur.state < FF_Bathroom_HeatingSet.state) FF_Bathroom_ThermalHead.sendCommand(ON)
}
end

Items

Switch          FF_Bathroom_Heating                 "Heating On Off"               <switch>          (FF_Bathroom, gHeating)           ["HVAC", "Switchable"]             {channel=""}
Switch          FF_Bathroom_ThermalHead             "Thermal head"            <switch>          (FF_Bathroom, gHeating)           ["Switchable"]                     {channel=""}
Number          FF_Bathroom_HeatingSet              "Temperature setting"   <heat>            (FF_Bathroom, gHeating)           ["HVAC"]                           {channel=""}
Number          FF_Bathroom_Temperature             "Temperature sensor"      <temperature>     (FF_Bathroom, gTemperature)       ["Temperature"]                    {channel=""}

Sitemap

Frame {
		Default item=FF_Bathroom_Temperature  label="Temperature"

		Default item=FF_Bathroom_Heating label="Heating On Off"
		Setpoint item=FF_Bathroom_HeatingSet label="Temperature setting"
		visibility=[FF_Bathroom_Heating==ON]
		}

Topics for MQTT I write using Paper UI. Please tell me what I did wrong? Why don’t I get a command to turn the heating on and off? Second day problem. Sorry for my English. Thanks

  • Platform information:
    • Hardware: Raspberry Pi 3
    • OS: Raspbian Buster Lite
    • Java Runtime Environment: Zulu Embedded 8.25.0.76
    • openHAB version: 2.5.3

What does the event.log say? Do you see a event happen?

Secondly, If you turn of the heating (FF_Bathroom_Heating to OFF), nothing will happen, because of Item FF_Bathroom_Heating changed to ON`
My suggestion to your rule would be:

rule "Heating control"
when  
Item FF_Bathroom_HeatingSet changed
or
Item FF_Bathroom_Heating received update
or
Item FF_Bathroom_Temperature changed
then
if (FF_Bathroom_Heating.state == ON)
{
	if (FF_Bathroom_Temperatur.state >= FF_Bathroom_HeatingSet.state) 
 	{
		FF_Bathroom_ThermalHead.sendCommand(OFF)
	}
	else
	{
		FF_Bathroom_ThermalHead.sendCommand(ON)
	}
}
else  /// FF_Bathroom_Heating != ON
{
	FF_Bathroom_ThermalHead.sendCommand(OFF)
}
end