Hi together,
I try to create my Things via REST API. I use python along with the requests library.
The creation of Things and Items is easy and runs smoothless.
However, I do not understand the REST API Doc in which way I can create the Channels of a Think.
Linking them is also possible with the corresponding endpoint.
Here is the payload for the Thing:
{
"label": "Subwoofer",
"bridgeUID": "mqtt:systemBroker:embedded-mqtt-broker",
"configuration": {},
"properties": {},
"UID": "mqtt:topic:44Subwoofer68Subwo",
"thingTypeUID": "mqtt:topic",
"channels": [
{
"uid": "mqtt:topic:44Subwoofer68Subwo:SubwooferPower",
"id": "subwooferpower_power",
"channelTypeUID": "mqtt:switch",
"itemType": "Switch",
"kind": "STATE",
"label": "SubwooferPower",
"description": "Control ON/OFF",
"properties": {},
"configuration": {
"commandTopic": "cmnd/subwoofer/POWER",
"stateTopic": "state/subwoofer/POWER"
}
}
],
"location": "Living Room"
}
But results in:
<Response [500]>
{‘error’: {‘http-code’: 500, ‘exception’: {‘class’: ‘java.lang.NullPointerException’}}}
Traceback (most recent call last):
File “openHabConfig.py”, line 88, in createThing
r.raise_for_status()
File “/Users/olivergoetz/Development/home-automation/venv/lib/python3.8/site-packages/requests/models.py”, line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://openhab:8080/rest/things
Currently I do not know how to proceed.