What is API / curl command to exclude Zwave devices?

What is the API command to exclude Zwave devices ?

In the UI I see the “Exclude Devices” button, but what would be a Linux command to do that ?

So far, I tried:

  1. The “addons” part (localhost:8080/rest/addons/binding-zwave) but that does only give general information
  2. The “actions” part (localhost:8080/rest/actions/zwave%3Aserial_zstick%3A8c6eb44bfc) but that gives a HTTP 404 Not found.

Am I looking in the good direction?
Or would there be a totally different way?
Perhaps a openhab-cli command ?
What way is de UI using to start the exclude?

The background of this question: I’m trying to make a hand-crafter Zwave.things file. That is possible, and I can add devices using the “inbox” and “discovery” commands in the API, but now I have no idea how to exclude …

To be complete, the whole commands I used (in addition to the API-explorer). The API-token is placed in Linux environment variable $BEARER. This token works with other commands.

curl -X GET  localhost:8080/rest/addons/binding-zwave  -H 'accept: application/json' -H "Authorization: Bearer $BEARER"
curl -v -X GET localhost:8080/rest/actions/zwave%3Aserial_zstick%3A8c6eb44bfc  -H 'accept: application/json' -H "Authorization: Bearer $BEARER"

Have you seen this posting

Thanks Wolfgang! That was it!
For an important part at least.

I’m now able to initiate a Zwave exclusion process via this command below. Note the string “controller_exclude”: true (of course, you have to supply your own Zwave id, do not use mine “8c6eb44bfc”, create the $BEARER environment variable with your token, and create the full config record even voor items you do not change):

curl -v -X PUT localhost:8080/rest/things/zwave%3Aserial_zstick%3A8c6eb44bfc/config -H "accept:*/*" -H "Content-Type:application/json" -H "Authorization: Bearer $BEARER" -d ' {"controller_softreset": false, "security_networkkey": "90 02 01 4B A1 C8 F9 95 92 99 C9 E5 8A 99 43 31", "security_inclusionmode": 0, "controller_sisnode": 1,"controller_maxawakeperiod": 10,"controller_sync": false,"controller_master": true,"inclusion_mode": 2,"port": "/dev/ttyACM0","controller_wakeupperiod": 3600,"controller_exclude": true,"heal_time": 1,"controller_inclusiontimeout": 30,"controller_hardreset": false}'

I had to repeat the whole config to prevent this error message:

No message body writer has been found for class java.util.Collections$UnmodifiableMap" ```

However, this curl command ONLY works if you have a zwave things file generated by the OpenHAB Userinterface. If you manually make a Zwave.things file, there is nothing OH can do for you, you get the respone:

"error": {
    "message": "Cannot update Thing zwave:serial_zstick:controller as it is not editable.",
    "http-code": 409
  },
1 Like