Error message in Rules Execution

Hi,

currently struggeling with rules - but have no clue why - as they worked ever since a couple of months.

My rule:

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.openhab.core.library.types.*
import org.joda.time.*

rule "OG Alles auf"
when
	Item OGUp received update
then
	if (OGUp.state==ON)
		{
			ShuttersOG?.members.forEach(Rollershutter|
   sendCommand(Rollershutter, UP)
	   )
		OGLights?.members.forEach(Switch|
sendCommand(Switch, OFF)
)
postUpdate(OGUp, OFF)
}
end

changing the item state is resulting in the following output in debug log:

18:12:15.600 [DEBUG] [m.r.internal.engine.RuleEngine:305 ] - Executing rule 'OG Alles auf'
18:12:16.969 [INFO ] [openhab.model.script.Dashboard:53 ] - Item OGUp has changed state from OFF to: ON
18:12:20.832 [ERROR] [o.o.c.s.ScriptExecutionThread :50 ] - Error during the execution of rule 'OG Alles auf': Could not invoke method: org.openhab.model.script.actions.BusEvent.sendCommand(java.lang.String,java.lang.String) on instance: null

any idea?

thanks
Karsten

Change your sendCommands to

Rollershutter.sendCommand(UP)
Switch.sendCommand(OFF)

or

sendCommand(Rollershutter.name, UP)
sendCommand(Switch.name, OFF)

Is it possible to have an item named “Rollershutter” or “Switch”? Wouldn’t they be reserved names in an items file?

I think you can because in the rules the class names are actually SwitchType and RollershutterType I believe.

I just typed var Switch = null into Designer and it had no problem with it.

But can you make a Switch item like

Switch Switch "Switch"

In an items file?

In this case he is iterating over the members of a group so Rollershutter and Switch are just variables.

ShuttersOG?.members.forEach(Rollershutter|  sendCommand(Rollershutter, UP))

OGLights?.members.forEach(Switch| sendCommand(Switch, OFF))

Ah, thanks. I missed that.