API Error – Flair
- 5 years ago
Can anyone tell me how to fix this error 422 shown in this API call:
verboseTrace: patchObjectAsync> - patch api call with attributes {"data":{"id":"de16ee71-a91d-495c-a33b-948b4fcc4861","type":"hvac-units","attributes":{"temperature":82}}} failed, Error: 422
Comments
- 5 years ago
Your json is really wrong if you are trying to set the temperature:
{"data":{"type":"structures", "attributes": {"set-point-temperature-c":"27.78"}}}
- 5 years ago
Thank you for your help.
The dev is using patchObjectAsync and that is the trace created.
The DTH code is:
asynchttp_v1.patch('patchObjectAsync', params, args)
- 5 years ago
Sorry but I don't understand your statement?! I used Python for my own needs, the json I had to send to the API to patch the temperature set point is the one I wrote in my previous message. What's DTH code?! :)
- 5 years ago
Sorry, I'll explain.
I am using another developer's Smartthings code. DTH is an acronym for Device Type Handler. It's part of the programming structure for utilitizing Smartthings.
The code utilizes the library "asynchttp_v1" whithin which is the procedure (I think that's what one calls it) "patch"
Hence, asynchttp_v1.patch('patchObjectAsync', params, args)
In case you're curious:
https://docs.smartthings.com/en/latest/smartapp-developers-guide/async-http.html?highlight=patch
- 5 years ago
Turns out the app will only work with the Flair system in Manual mode.
As soon as I switched it to Manual, the error disappeared and the system responded properly to the commands.
Hope this helps someone, sometime.