OH3 DSL rules and groups defined in the UI

There was a question with a similar subject that got solved by changing uppercase/lowercase of a member of the group method.
However in my case, it seems that in my DSL rule, I am unable to access groups that I define with the UI. Groups defined in my item text file do work, but since I have now created a lot of the items via the UI, I wanted to also define the groups in the UI.

The line of code that fails is this:

logInfo(“voice”, MyLights);

Giving an error

2021-01-03 11:08:03.352 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘voice-1’ failed: An error occurred during the script execution: Could not invoke method: org.openhab.core.model.script.actions.Log.logInfo(java.lang.String,java.lang.String,java.lang.Object[]) on instance: null in voice

The group appears in the UI item list and contains one light:

Is there a trick to get the GUI defined groups in a DSL text-defined rule?

No there is no trick you can use it in the same way. Looking at the error message logInfo expects 3 parameter.

logInfo accepts 2 parameters at least. But you are correct that the second is expected to be a format string. I changed to:

logInfo("voice", "My lights are {}", MyLights);

Now the output seems to indicate that I get a group and I can work with it. I don’t know what was the problem I was hitting. I guess the problem is moot now.

1 Like