Very basic thermostat rule, not quite working. help please

Can somebody please tell me why my rule doesn’t ever execute? I’m not sure why this isn’t working I think everything is correct.

rule “Heating Control”
when
Item temperature1 received command // I’ve tried changing this from “received command” to “changed”
then
if (TstatEnable.state == ON){
if (temperature1 <= TSsetpoint){
sendCommand(Heat,ON)
}
else if (temperature1 >= TSsetpoint){
sendCommand(Heat,OFF)
}
}
end

My Items are as follows:

Number temperature1 “Temperature 1 [%.1f °F]” (lr) {mqtt=“<[myBroker:STATUS/TF1:state:JS(trim.js)]”}
Number TSsetpoint “Heating Set Point”
Switch TstatEnable “Tstat enable”
Switch Heat “bedroom heater” {insteonplm=“2F.83.A2:F00.00.02#switch”}

OK so I’ve identified one issue and now the rule executes the problem now, is when it executes, from the OH terminal I get:

2016-12-14 18:09:33.762 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule ‘Maintain Heat’: The name ‘ <= ’ cannot be resolved to an item or type.

I’ve changed the rule, it’s now written like this:

rule "Maintain Heat"
when
	Item temperature1 received update
then
	//if (TstatEnable.state == ON){
		if (temperature1 <= TSsetpoint){
			sendCommand(Heat,ON)
			}
		else if (temperature1 >= TSsetpoint){
			sendCommand(Heat,OFF)
			}
	//}
end

Any Ideas?

Alright, I figured it out, just letting you guys know so you don’t try to help, I simply needed to add “.state” to each item in the rule for anyone that would like to know

Is this how it’s supposed to look?

temperature1.state >= TSsetpoint

Since both “temperature1” and “TSetpoint” are number items using the ending “.state” on both would be the way to go.

2 Likes