Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local selfId = fibaro:getSelfId();
- local ip = fibaro:get(selfId, "IPAddress")
- local port = fibaro:get(selfId, 'TCPPort');
- -- MP3-File setzen
- tcpSocket = Net.FTcpSocket(ip, port)
- payload = [[POST /upnp/control/rendertransport1 HTTP/1.1
- SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
- CONTENT-TYPE: text/xml ; charset="utf-8"
- Content-Length: 357
- <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID/><CurrentURI>http://www.verarscht.org/tts/geschirr_fertig.mp3</CurrentURI><CurrentURIMetaData/></u:SetAVTransportURI></s:Body></s:Envelope>]]
- bytes, errorcode = tcpSocket:write(payload)
- --fibaro:debug(errorcode);
- if errorcode == 0 then
- state = tcpSocket:read()
- fibaro:debug(state);
- end
- tcpSocket:disconnect()
- -- ENDE
- -- Datei abspielen
- tcpSocket = Net.FTcpSocket(ip, port)
- payload = [[POST /upnp/control/rendertransport1 HTTP/1.1
- SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#Play"
- CONTENT-TYPE: text/xml ; charset="utf-8"
- Content-Length: 245
- <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID/><Speed/></u:Play></s:Body></s:Envelope>]]
- bytes, errorcode = tcpSocket:write(payload)
- fibaro:debug(errorcode);
- if errorcode == 0 then
- state = tcpSocket:read()
- fibaro:debug(state);
- end
- tcpSocket:disconnect()
- -- ENDE
Add Comment
Please, Sign In to add comment