Thing configuration from rules

Dumb me took a look at the openHAB RESTful API today. It’s all there:

I can send data to the following endpoint:

thingconfig

The data is sent via a PUT request and looks like this: {"config_6_2": 2} where 6 is the configuration setting number. This can be found out using the REST API by sending a GET request to /things/<your thingUID here>. I am not sure what the 2 is, though.

The data ({"config_6_2": 2}) sets the Fibaro Dimmer 2 dimming step interval to 20 milliseconds per step.

While it feels weird to talk to the own REST API from within rules, this could be one way of doing it until hopefully we can implement this as rule actions.

Doing this from the linux shell with curl would look like this:

curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" -d "{\"config_6_2\": 2}" "http://openhab:8080/rest/things/zwave%3Adevice%3Abridge%3Anode18/config"
2 Likes