Closed Ostromogilski closed 1 year ago
Postman request with the same body works as expected:
it seems that plugin is adding \
for every line break, that doesn't work with SmartThings API:
{\"commands\":[{\"component\":\"main\",\"capability\":\"robotCleanerCleaningMode\",\"command\":\"setRobotCleanerCleaningMode\",\"arguments\":[\"homing\"]}]}
Is it possible to avoid adding this behavior?
Working format should be like this:
{"commands":[{"component":"main","capability":"robotCleanerMovement","command":"setRobotCleanerMovement","arguments":["homing"]}]}
My working configuration for Samsung PowerBot :
{
"accessories": [
{
"accessory": "HTTP-SWITCH",
"name": "Samsung Powerbot",
"switchType": "stateful",
"debug": false,
"onUrl": {
"url": "https://api.smartthings.com/v1/devices/YOUR_DEVICE_ID/commands",
"method": "POST",
"body": {
"commands": [
{
"component": "main",
"capability": "robotCleanerMovement",
"command": "setRobotCleanerMovement",
"arguments": [
"cleaning"
]
}
]
},
"headers": {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
},
"offUrl": {
"url": "https://api.smartthings.com/v1/devices/YOUR_DEVICE_ID/commands",
"method": "POST",
"body": {
"commands": [
{
"component": "main",
"capability": "robotCleanerMovement",
"command": "setRobotCleanerMovement",
"arguments": [
"homing"
]
}
]
},
"headers": {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
},
"pullInterval": 5000,
"statusUrl": {
"url": "https://api.smartthings.com/v1/devices/YOUR_DEVICE_ID/components/main/capabilities/samsungce.robotCleanerOperatingState/status",
"method": "GET",
"headers": {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
},
"statusPattern": ".*\"value\":\"cleaning\".*"
}
],
"platforms": [
{
"platform": "homebridge-http-switch"
}
]
}
Describe the bug For some unknown for me reason, I'm keeping to receive
Error 422
sending POST request to SmartThings API to start my vacuum cleaner. I tried the same request in Postman and it works as expected. But once I put the request into plugin config I getError occurred setting state of switch: HTTP request returned with error code 422
upon triggering the switchVersion (output of
npm list -g homebridge homebridge-http-switch
)1.6.0
0.5.36
Configuration
Additional context
I would greatly appreciate any advise on this matter.