Hello,
how can I POST
xml data using REST with header containing this?
Content-Type, charset, SOAPACTION, X-Auth-PSK
I want to send remote control data tomy Sony TV. Its working in Tasker but I would like to use HASS to send commands.
Thanks.
Hello,
how can I POST
xml data using REST with header containing this?
Content-Type, charset, SOAPACTION, X-Auth-PSK
I want to send remote control data tomy Sony TV. Its working in Tasker but I would like to use HASS to send commands.
Thanks.
with curl.
You can either do it with a shell command or a command line switch. The command line switch documentation has examples of using curl.
Here’a a curl command with a header that I use. (yours will be different based on your headers/body). This one sends a post command to H.A., but the process is the same going out from HA to your device.
curl -X POST ^
-H "Content-Type: application/json" ^
-d "{\"state\": \"22.5\"}" ^
http://your_ip:your_port/api/states/sensor.lh_crawlspace_temp
Hello so I dsid tryt his:
- platform: command_line
switches:
sony_remote:
command_on: >
curl -X POST http://192.168.100.226/sony/IRCC -d @/config/sony/test.xml -H "Content-Type: text/xml" -H "charset: utf-8" -H "SOAPACTION: urn:schemas-sony-com:service:IRCC:1#X_SendIRCC" -H "X-Auth-PSK: sony"
but it doesn’t work and no error log. Am I missing something?
Thank you.
try the curl from the command line. Does it work? If it does then you have a permission or path problem. If it doesn’t then it will tell you why it isn’t working.
So now I got this in command line:
<?xml version="1.0"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>401</errorCode>
<errorDescription>Invalid Action</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Any idea?
Thanks.
So when I put Auth-PSK key sony
in single qoutes, Ive got no error, but TV do not react.
Its working in Tasker using REST plugin but there I am sending xml as a custom body and not like a file. Maybe thats the issue here?