I have rule which should resend some states and it looks like
gMapDB.members.forEach(s | s.sendCommand(s.state) )
But unfortunately I get this ERROR.
2016-08-31 19:20:16.089 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Init Routine': Could not invoke method: org.openhab.model.script.actions.BusEvent.sendCommand(org.openhab.core.items.Item,java.lang.Number) on instance: null
Does anybody know, why this won’t work?
Is there a better way to realize a resend of items within a group?
Hi Rich,
thanks for your quick reply. When I start the rule, unfortunately I don’t see any member of the gMapDB group in the events.log, which should respond on the sendCommand.There must be something wrong with my loop. Do you see any obvious?
Regards,
Michael
If the sendCommand is failing then you would not see anything in your events.log. That is why I suggested using toString.
There is nothing I can tell wrong with your loop. You can add a logInfo to the loop to see it executing. Given the error I’m certain the problem is with the sendCommand.
I used .toString …
gMapDB.members.forEach(s |
s.sendCommand(s.state.toString)
logInfo(“Info”, s.state.toString)
)
Even logInfo doesn’t output anything. It seems, that the loop is ignored.
gMapDB contains at least 30 members …
The last thing it could be as far as I can see is if gMapDB doesn’t exist or it has no members. Look for typos in your Items file is all I can think of. Good luck.
Rich,
thanks a lot for patience. Now it works, and of course, it was my fault.
The rule wasn’t triggered, but the toString addition was necessary, too.
Have a nice evening.