REST API Call from Lupus XT1 Plus

Platform information:
Hardware: NUC7CJYH with 8 GB RAM and 32 GB SSD + zwave: UZB1 Stick
Ubuntu Server 20.04
OH 3.2 stable

I am successfully retrieving the Sensor states from my alarmsystem Lupus XT1 Plux with curl.

For a comprehensive implementation I would need the direct trigger from the Lupus itself which I intend to do with the help of the openhab REST API.

Task:
The motion sensor of the XT1 should send a Motion ON to OH and this works fine:
Based on:
openHAB REST API | openHAB

curl -u "admin:xxx" -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://192.168.68.70:8080/rest/items/LupusMotionDetector"

However, the Lupus internal handling does not allow a curl string, so I am wondering which format would work.

According to the Lupus docs this kind of syntax works:

http://usr:password@IP-Address:Port/SetMotionDetect.cgi?md1_ena=1&md2_ena=1&md3_ena=1
  1. How to re-format the REST API call to match this format?

The documentation above mentions:
" The openHAB REST API is excellently documented with detailled use instructions. It would vastly exceed this space to present all possible examples. Nevertheless, here is some examples using curl (opens new window), a common command line tool available for many platforms:"

  1. But where to find this detailed documentation?

I’ll answer this one first.

In MainUI go to Developer Tools → API Explorer

The API is well documented and you can even interact with the API from the docs to see how it works (or make some changes to your OH config if you want).

You don’t. That’s not how it works. The service that implements the API (i.e. openHAB) dictates what the call needs to look like. You’ve two problems here.

  1. It uses basic auth. That’s off by default but you can turn it on in MainUI through Settings → Security (I think, something like that).

  2. It’s using an HTTP GET and openHAB requires an HTTP PUT or HTTP POST to update an Item.

Note, I’m assuming the SetMotionDetect.cgi?... part of the URL in the docs is for example and not required. Otherwise you are never going to get this to work without writing something else outside of OH to receive these calls.

To deal with 2, there are two unofficial ways to handle it. The first is to install ClassicUI and use http://IP:8080/classicui/CMD?LupusMotionDetector=ON (note that only commands are supported).

Or there is an unofficial add-on posted somewhere here on the forum (I can’t find it at the moment) that adds an HTTP GET end point that lets you command or update Items. If you search you should be able to find it.

Thank you for your detailed response.
So my assumption that the REST API requests could be modified was wrong - my bad.

I have reached out to the Lupus support to find out of a curl call would be also possible somehow.

@Wolfgang_S
Thanks for sharing this - I will check it out as well.