thingsboard-gateway
thingsboard-gateway copied to clipboard
[HELP] REST Connector JSON Downlink Converter not able to send JSON?
Describe the issue
I try to POST a request to an REST API endpoint if an shared attribute updates on a device.
The attribute is a Boolean value with the key occupation .
It seems that the default Json Downlink Converter does not correctly convert the payload, its result is the following
'{"sampleDeviceName": True}'
Do i miss something or is this a bug?
Configuration
"attributeUpdates": [
{
"HTTPMethod": "POST",
"SSLVerify": false,
"httpHeaders": {
"CONTENT-TYPE": "application/json"
},
"security": {
"type": "anonymous",
"username": "user",
"password": "passwd"
},
"timeout": 0.5,
"tries": 3,
"allowRedirects": true,
"deviceNameFilter": ".*",
"attributeFilter": "occupation",
"requestUrlExpression": "http://sample-rest-endpoint-host/${attributeKey}",
"valueExpression": "{\"${deviceName}\": ${attributeValue}}"
}
],
Connector name (If you need help with some connector/converter): REST Connector
Versions (please complete the following information):
- OS: SLES15
- Thingsboard IoT Gateway version 3.5.2
- Python version 3.9
Is seems adding
result["data"] = dumps(ast.literal_eval(result["data"]))
to the downlink converter before returning the result fixes this...