http post / upnp on a esp9266
Posted: Fri Jul 08, 2016 11:37 am
hey
so i'm traying to make a esp9266 controle my sonos devices i goth som code working in java witch i'm now traying to port to the esp8266 using arduino ide / code
here is my java code
the main thing in the above java code is the i connect to this local ip addres
then i make a http call
witch has a request metod set as
and i add i requestproperty with the key
then i make a outputstream with sende the following
any idear on how i can archive this with arduino code?
so i'm traying to make a esp9266 controle my sonos devices i goth som code working in java witch i'm now traying to port to the esp8266 using arduino ide / code
here is my java code
Code: Select all
URL url = new URL("http://" + ipAdress + ":1400/MediaRenderer/GroupRenderingControl/Control");
HttpURLConnection request = (HttpURLConnection) url.openConnection();
request.setRequestMethod("POST");
request.addRequestProperty("SOAPACTION", "\"urn:schemas-upnp-org:service:GroupRenderingControl:1#SetGroupVolume\"");
request.setDoOutput(true);
request.setReadTimeout(2000);
OutputStreamWriter input = new OutputStreamWriter(request.getOutputStream());
input.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
" <s:Body>\n" +
" <u:SetGroupVolume xmlns:u=\"urn:schemas-upnp-org:service:GroupRenderingControl:1\">\n" +
" <InstanceID>0</InstanceID>\n" +
" <DesiredVolume>"+volume+"</DesiredVolume>\n" +
" </u:SetGroupVolume>\n" +
" </s:Body>\n" +
"</s:Envelope>");
input.write("");
input.flush();
the main thing in the above java code is the i connect to this local ip addres
http://192.168.1.118:1400/MediaRenderer/GroupRenderingControl/Control
then i make a http call
witch has a request metod set as
POST
and i add i requestproperty with the key
SOAPACTIONand a value as
\urn:schemas-upnp-org:service:GroupRenderingControl:1#SetGroupVolume\
then i make a outputstream with sende the following
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n
<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\n
<s:Body>\n
<u:SetGroupVolume xmlns:u=\"urn:schemas-upnp-org:service:GroupRenderingControl:1\">\n
<InstanceID>0</InstanceID>\n
<DesiredVolume>50</DesiredVolume>\n
</u:SetGroupVolume>\n
</s:Body>\n
</s:Envelope>
any idear on how i can archive this with arduino code?