rule "All"
when
Item Scene_Rollershutter received update
then
gShutter.members.forEach[S |
if (Scene_Rollershutter.state == NULL || Scene_Rollershutter.state == "") {
S.sendCommand(Scene_Rollershutter.state)
Thread::sleep(200)
}
]
end
I don’t think this will work. A Rollershutter can receive UP/DOWN as a command, but it stores its state as a PercentType so the Group aggregation function needs to work on PercentType. Perhaps something like
Group:Rollershutter:MAX
would be more appropriate.
Add some logging to verify that the Rule is running at all.
Note that what Vincent was saying is that in your original you only send the command to S when Scene_Rollershutter.state is NULL or “” which doesn’t make sense. You want to send the command when Scene_Rollershutter.state is NOT NULL or “”.
Also, since Scene_Rollershutter is a Number, its state can never be “” so testing for that is basically a noop.
How many rollershutters do you have? Just these three or are there more? If a lot more then I have some problems with the Thread::sleep. But if we are talking 5 or less this should be fine.
Also notice the space between the [ and the S. This is required in ON 2.3+.
rule "All"
when
Item Scene_Rollershutter received update
then
logInfo("Debug", "I enter here")
gShutter.members.forEach[ S |
S.sendCommand(Scene_Rollershutter.state)
Thread::sleep(200)
]
end
log
2018-05-29 21:45:45.452 [INFO ] [eclipse.smarthome.model.script.Debug] - I enter here
2018-05-29 21:45:45.453 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'All': Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null
rule "All"
when
Item Scene_Rollershutter received update
then
if(Scene_Rollershutter.state == NULL || Scene_Rollershutter.state < 0 || Scene_Rollershutter.state > 100) return;
logInfo("Debug", "I enter here")
gShutter.members.forEach[ S |
S.sendCommand(Scene_Rollershutter.state)
Thread::sleep(200)
]
end
log
2018-05-29 22:01:07.494 [vent.ItemStateChangedEvent] - Scene_Rollershutter changed from 0 to 60
2018-05-29 22:01:07.554 [INFO ] [eclipse.smarthome.model.script.Debug] - I enter here
2018-05-29 22:01:07.561 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'All': Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null