Help with rule to find out item state

hi i need help with a Rule in OH2 on Win 10.

I have the following elements and i would like to have the state of the item after a value is assigned.

Items are:

Number Check_Temp_Wz "Check Temp Wz" (checkTemp)
Number Check_Temp_Sz "Check Temp Sz" (checkTemp)
Number Check_Temp_Bd "Check Temp Bd" (checkTemp)

Rule is

rule "CheckTemp" 
		when   
			Member of gSolltemp received command //Receives a value from 8 to 30
				
		then   
			val  ending = triggeringItem.name.split("_").get(2)
			var Number  checkTemp = "Check_Temp_"+ending 
			sendCommand(checkTemp, receivedCommand.toString) 
                        logInfo("RulesxxxStateto String ", "-- value updated to: " + checkTemp)
                        logInfo("RulesxxxStateto String ", "-- value updated to: " + checkTemp.state)
end

LOGS

[RulesxxxStateto String ] - -- value updated to: Check_Temp_Wz
Rule 'CeckTemp': 'state' is not a member of 'java.lang.Number';```

How can i get the value of checkTemp assigned with sendCommand ?

Thanks for any suggestions

It’s right, you know. In your rule, checkTemp is just a string.

There’s a number of problems here.

The Items you showed us are members of a Group named checkTemp.
It seems really unwise to re-use that name for something different within your rule.

The Items you showed us are members of a Group named checkTemp.
The rule you showed is triggered off a Group named gSolltemp , doesn’t seem to be a connection here.

As we said, within the rule checkTemp is just a string. To get hold of an Item by that name, so that you can in turn get it’s state, there are a couple of well-known methods shown in this post

But finally, commands sent to an Item will not immediately update its state, indeed may not update it at all.

2 Likes