Hello,
I am trying to convert the following shell command to a RESTful command:
'/usr/bin/curl -X POST "https://api.xxx.xxx/1/appliances/<DEVICEID>/aircon_settings" -d "temperature=26&operation_mode=cool&button=" -H "Authorization: <APIKEY>"'
ac_on:
url: 'https://api.xxx.xxx/1/appliances/<DEVICEID>/aircon_settings'
method: POST
headers:
Authorization: !secret api_key
payload: -d "temperature=26&operation_mode=cool&button="
The HA log doesn’t report any errors, but payload
seems to be ignored. I wonder what I am doing incorrectly here?
I would like to move my configurations to github, and since shell command doesn’t allow use of !secret, I am trying to use RESTful commands instead.
At the very least you should probably remove the -d from the payload: parameter.
Thanks for the reply. Unfortunately, the payload is still being ignored.
Is there any way to see how the command being sent is actually formatted?
I’ve seen some posts recommend using developer tools in the browser, but I’ve never seen any output that looked like the applicable commands.
Looking at the code, no. The only thing that it outputs in the log is “Success call xxx.”, “Error yyy on call xxx.”, “Timeout call xxx.” or “Client error xxx.”, where xxx is just the URL, and yyy is the response status code. You might try looking in the log for any of those messages. E.g., if it says “Error …” the response status code might tell you something.
That’s really only helpful if you’re using a template, which you’re not.
If the curl command works, I really don’t see any reason why this RESTful Command is not working for you.
Thank you very much.
I fear it is beyond my skill level, but I wonder if there is a way to redirect or send the RESTful command to someplace else, or output it to a file to view how the command is actually formed? I’m thinking about sending a mail to the IR blaster mfg, but I’d need to know how the command is formatted in order to describe the problem to them.
It is a mystery…
The IR blaster seems to send the last known command to the AC if an unknown command is received; when the RESTful command is sent, the AC beeps and acknowledges the command, but it is ignoring the payload. But the fact that the AC beeps proves that the RESTful command is properly arriving at the URL, correctly authorized with the API key specified in the header, and then sent to the correct AC unit via my IR blaster (but without correctly interpreting the payload)…