Below is rule I’m trying to build to allow me to trigger proxy items, in the case here it’s my motion sensors. For the rule to work I need to build the Item name and then send the command to the Item. How can I change the rule below to make it work?
val String filename = "vMotion_Sensors.rules"
rule "Which Motion Sensor"
Member of gMotion_Sensors changed
if(previousState == NULL) return;
val vLocation = triggeringItem.name.split("_").get(0)
val vDevice = triggeringItem.name.split("_").get(1)
val vStatus = triggeringItem.state
logInfo(filename, "Motion Sensors: Activation Zone " + vLocation)
logInfo(filename, "Motion Sensors: " + vLocation + " is " + vStatus)
val vItem = vLocation + "_" + vDevice + "_vMotion"
logInfo (filename, "Testing: " + vItem + " " + vStatus)
For reference here’s an example Motion Sensor Item
Thanks for your response Scott. I’ve changed my rule as you suggested below, sadly that’s not worked.
Here’s the error I get, if it helps.
2020-02-08 17:47:19.047 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Which Motion Sensor': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(java.lang.String,java.lang.String) on instance: null