As I’m migrating over my rules from OH2 to OH3 I’ve run into an issue with a library that I use in a few places. Specifically: “org.eclipse.smarthome.model.script.ScriptServiceUtil”. I use this to access items as I roll through a group looking at statuses. For example, I would use it as: “ScriptServiceUtil.getItemRegistry.getItem(l.name.toString).state.toString()”.
Unfortnately now I get an error of: “Script execution of rule with UID ‘thingstate-2’ failed: The name ‘ScriptServiceUtil’ cannot be resolved to an item or type; line 87, column 60, length 17” when the rule runs. I’m assuming that the problem is that I’m referencing org.eclipse.smarthome which I believe is now changed. Can someone point me to the direction of the proper location?
EDIT: For anyone looking, use “org.openhab.core.model.script.ScriptServiceUtil”
If you are using a language other than Rules DSL, the item registry is available as the variable ir so you can just use ir.getItem(I.name). If you are using the image registry to get at an Item’s state you can use items: items[I.name].
There is no reason to call toString on I.name, name is already a String.
2020-11-09 21:44:41.533 [DEBUG] [rg.openhab.core.io.net.exec.ExecUtil] - exit code '6', result '', errors ' % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: 'http
I removed the single ’ in the url and I get the correct reply as per the debug back but I still get exit code 6 which is making it return null.
Edits on top of edits. When I send the URL as a string variable, without the ', it seems to work.