Openhab 3 on Linux (Raspberry Pi OS) with Docker (Raspberry 4 with USB-SSD)
"…failed: ReferenceError: “” is not defined in
I am creating the script as part of a rule via the OH3 UI.
Am I missing a library?
I really spent some time looking for an example but cannot find any complete example and did not get it to work from the bits and pieces that I found.
Thanks in advance.
You don’t need to use the REST API for this. Each Item has
If you are using Rules DSL it’s as simple as
If using one of the other languages you need to pull the Item from the ItemRegistry first
If you really want to use the REST API for this, you should use the sendHttpXRequest Actions to make the requests. But note that those API calls are protected and you’ll need to set up authentication in the headers of the requests.
Great. For now I do not need to use REST API then. I have some Shelly devices where I might want to poll power consumption using their REST API so I do not have to wait until they push updates to OH. But this is something for later. It is good to know to use sendHttpXRequest Actions when I get to it.
There is a slight mistake in your example, “addGroup” should be “addGroupName”:
After you pointed me the right way I found this old post of yours with a lot of good information. For some reason I did not come across this before. There is also the information on “addGroupName”:
Thanks a lot!