Closed Stefan-83 closed 2 years ago
Something like this:
{
"accessory": "HTTP-SWITCH",
"name": "your light name",
"switchType": "stateful",
"serialNumber": "SW001",
"pullInterval": 60000,
"debug": true,
"onUrl": {
"url": "https://publickitchenapi.casoapp.com/api/v1.0/Winecooler/SetLight",
"method": "POST",
"headers": {
"ApiKey": "x-apikey xxxxxxxxxxxxxxx",
"Content-Type": "application/json",
},
"body": {
"technicalDeviceId": "1001-94c9601c7866",
"zone": 1,
"lightOn": true
}
},
"offUrl": {
"url": "https://publickitchenapi.casoapp.com/api/v1.0/Winecooler/SetLight",
"method": "POST",
"headers": {
"ApiKey": "x-apikey xxxxxxxxxxxxxxx",
"Content-Type": "application/json",
},
"body": {
"technicalDeviceId": "1001-94c9601c7866",
"zone": 1,
"lightOn": false
}
},
}
You may want to set a statusURL too if you want to know the current status of the light and the API has one.
Thank you so much Michael 👍 with some little tweaks, it works! (no need for status --> switchType: toggle and the correct header is "x-api-key")
{
"accessory": "HTTP-SWITCH",
"name": "Weinkühlschrank",
"switchType": "toggle",
"serialNumber": "SW001",
"pullInterval": 60000,
"debug": true,
"onUrl": {
"url": "https://publickitchenapi.casoapp.com/api/v1.0/Winecooler/SetLight",
"method": "POST",
"headers": {
"x-api-key": "0000000000000000000000000000",
"Content-Type": "application/json"
},
"body": {
"technicalDeviceId": "1001-ABCDEFGHI",
"zone": 0,
"lightOn": true
}
},
"offUrl": {
"url": "https://publickitchenapi.casoapp.com/api/v1.0/Winecooler/SetLight",
"method": "POST",
"headers": {
"x-api-key": "0000000000000000000000000000",
"Content-Type": "application/json"
},
"body": {
"technicalDeviceId": "1001-ABCDEFGHI",
"zone": 0,
"lightOn": false
}
}
}
(hopefully this example will help others in the future)
Best regards, Stefan
Hi, i want to switch the light of my winecooler via the manufacturer's API:
I can use swagger to switch the light with: Servers: https://publickitchenapi.casoapp.com/ POST: /api/v1.0/Winecooler/SetLight ApiKey: x-apikey xxxxxxxxxxxxxxx
Request body:
Responses:
curl -X POST "https://publickitchenapi.casoapp.com/api/v1.0/Winecooler/SetLight" -H "accept: */*" -H "x-api-key: xxxxxxxxxxxxxxx" -H "Content-Type: text/json" -d "{\"technicalDeviceId\":\"1001-ABCDEFGHI\",\"zone\":1,\"lightOn\":false}"
Request URL
https://publickitchenapi.casoapp.com/api/v1.0/Winecooler/SetLight
Any ideas how to integrate this into http-switch?
Thanks, Stefan