postUpdate with variable.name value?

Is this possible. ive been trying to accomplish this for a while but all my research/testing is not working out:

rule "TEST"
when
	Item vSideGarageSoffit changed
then
	logInfo("RULE.RUNNING", "### TEST ###")
{	
	gSoffitLights.members.filter[s|s.state == ON || s.state > 0].forEach[ light |
    	gSoffitRestore.members.filter[i|i.name == light.name+"_Restore"].forEach [ e | 
			if(e.state == 0){
				logInfo("RULE.gSoffitLights", "--> Currently "+e.name+" = " +e.state+"%")
				postUpdate(e.name, light.state)
				logInfo("RULE.gSoffitLights", "--> Now "+e.name+" = " +e.state+"%")
			}
    	]
	]
}
end

The part i’m having problems accomplishing is the e.name within “postUpdate(e.name, light.state)”

e.name is resolving to a Number item called “vSideGarageSoffit_Restore”

When i run the rule this is the error i get:

2017-03-08 21:43:51.347 [INFO ] [.smarthome.model.script.RULE.RUNNING] - ### TEST ###
2017-03-08 21:43:51.382 [INFO ] [home.model.script.RULE.gSoffitLights] - --> vSideGarageSoffit_Restore = 0%
2017-03-08 21:43:51.387 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘TEST’: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.postUpdate(java.lang.String,java.lang.String) on instance: null

Whats the proper way to be able to resolve a Item name within a postUpdate?

Derp. it’s

postUpdate(e, light.state)

I’ll leave this here so it hopefully helps someone in the future :slight_smile:

You can do it with a string, but I think you have to do

e.name.toString

The better way would be to call e.postUpdate(light.state). The methods on the Item are much better able to handle different State types and you will avoid many problems in the long run using this verses the postUpdate action. The same goes for sendCommand.