[SOLVED] Need help getting a rule with temperature sensor to work

I am new to rules. I am using openHABian on a raspberry pi.

I am using visual studio for my editor. I have used paper UI to configure my bindings and things and items and HABPanel to control switches. Everything is working fine manually. Now I want to automatically turn off the fireplace if the temperature in the room is above a value set on the HABPanel. Here is my simple code for the rule. It seems like the system does not even see the rule.

rule “Fireplace_off_over_temperature”

when
Temperature > Requested_Fireplace_temperature
then
Extraswitch.sendCommand(OFF)
end

I also tried this

rule “Fireplace_off_over_temperature”
when
Temperature.state > Requested_Fireplace_temperature.state
then
Extraswitch.sendCommand(OFF)
end

Extraswitch is the switch that controls the fireplace.
Temperature is the temperature from the sensor.
Requested_Fireplace_Temperature is the temperature set from a slider in HABPanel

Any help would be appreciated.

Thanks

Your when is wrong. It’s not a condition. It’s supposed to be something like when temperature received update or when temperature changed.

They’re special openHAB keywords.

Okay I changed it to this and still nothing is happening. I have the sensor reporting to HABPanel and it is reporting a temperature

rule “Fireplace_off_over_temperature”
when
Item Temperature changed or
Item Temperature received update
then
if (Temperature.state > Requested_Fireplace_temperature.state) {
Extraswitch.sendCommand(OFF)}
end

Got it to work. I had used Extraswitch and it should have been extraswitch

Thanks for you help. I think I can write rules now