HowTo: Send JSON Command
seppelicous opened this issue · 3 comments
Hi,
I like to send JSON Command as HTTP POST to my Hyperion Server.
I tested the command with a simple HTTP rest tool. The JSON in the body is
{"command":"componentstate","componentstate":{"component":"LEDDEVICE","state":false}}
That works for me, but I am not sure if implemented it correctly. Can someone have a look at it, if this is correct?
Thank you very much!
This is my Config for the Switch, but nothing happens. I also get no error.
{
"accessory": "HTTP-SWITCH",
"name": "HTTP-SWITCH",
"switchType": "toggle",
"onUrl": {
"url": "http://192.168.178.128:8090/json-rpc",
"method": "POST",
"body": {
"command": "componentstate",
"componentstate": {
"component": "LEDDEVICE",
"state": true
}
},
"headers": {
"Content-Type": "application/json"
}
},
"offUrl": {
"url": "http://192.168.178.128:8090/json-rpc",
"method": "POST",
"body": {
"command": "componentstate",
"componentstate": {
"component": "LEDDEVICE",
"state": false
}
},
"headers": {
"Content-Type": "application/json"
}
}
}
I got the tham Problem. My Config looks like yours and also nothing happens
Is anybody out there how is explain the json part in body Tag?
I'm having the same issues.
According to plugin documentation:
body: Defines the body sent with the http request. If value is not a string it will be converted to a JSON string automatically.
Hyperion logs say that it's invalid JSON. My guess is that the plugin includes quotations around the JSON, and Hyperion can't handle that.