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?