So this has been bought over here from the “what did you do with your vera today” thread as think I was annoying a few people over there… but cybrmage was helping me out - so hopefully he will find me here…
I have a curl script which works but want to get into a function
curl --silent -XPOST http://192.168.1.xxx/sony/IRCC -d "<?xml version=\"1.0\"?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:X_SendIRCC xmlns:u=\"urn:schemas-sony-com:service:IRCC:1\"><IRCCCode>"AAAAAQAAAAEAAAATAw=="</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>" -H 'Content-Type: text/xml; charset=UTF-8' -H 'SOAPACTION: "urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"' -H "Cookie: auth=xxx" -o /dev/null
I have updated the URL in the below as with the original reccomendation i got a 404 and the url below is the one i use in a curl scripts which works
so essentially I want to send commands from my vera to my Sony Bravia 2015 android tv.
[code]local http = require(“socket.http”)
local ltn12 = require(“ltn12”)
local respBody = {}
local SONY_IP = “192.168.1.225”
local AUTH_CODE = “75071BA72588155AD9FABC47EBDD353BA4ED40D7”
local IRCC_CODE = “AAAAAQAAAAEAAAAUAw==”
local REQUEST = “<?xml version=\"1.0\"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/\” s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/\“><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">”
REQUEST=REQUEST … IRCC_CODE
REQUEST = REQUEST…“</u:X_SendIRCC></s:Body></s:Envelope>”
local SONY_URL = “http://”…SONY_IP…“/local_api.php?getDeviceList=true”
rBody, rCode, rHeaders, rStatus = http.request(
{
method = “POST”,
url = SONY_URL,
headers = {
[“Content-Type”] = “text/xml; charset=UTF-8”,
[“SOAPACTION”] = “urn:schemas-sony-com:service:IRCC:1#X_SendIRCC”,
[“Cookie”] = “auth=”…AUTH_CODE
},
source = ltn12.source.string(REQUEST),
sink = ltn12.sink.table(respBody),
redirect = false
}
)
luup.log(“http response - code [”…(rCode or “NIL”)…“] html [”…(table.concat(respBody,“”) or “NIL”)…“]”)
[/code]
i get the following in the log
[code]0 02/27/16 21:19:12.518 luup_log:0: http response - code [500] html [
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
s:Client
UPnPError
401
Invalid Action
] <0x71dd2520>
04 02/27/16 21:19:20.209 <0x769d2520>
02 02/27/16 21:19:20.209 Device_Basic::AddPoll 10 poll list ful[/code]