Sky+ IP control

652 views
Skip to first unread message

Chris Birks

unread,
Apr 11, 2014, 9:54:01 AM4/11/14
to comman...@googlegroups.com
Hi all
I'm having a go at sky+ ip control and taken some ideas from posts for soap control. I've seen other posts about sky control and may have to resort to a dusky serial controller (at the mo I use ir through an iTach WIFI2IR). Basically, I'd like to replicate some of the sky+ app features into my gui, e.g. planner - I know I can use multitasking gestures to switch between apps (I use an iPad) but like everything to be in the gui. I've been following various posts on other sites (e.g. Gladdy) and given the sky+ app now clearly communicates directly with the sky box, I'm sure this must be achievable.
Any, this is what I have so far, trying to send a pause command and the function is called from pressing the pause button on the gui and replacing the text INDIVIDUALCODEFORSKYBOXHERE with my sky box code;

function skyControl() {
CF.log("Sky control started");
var Command = {
Pause : "<?xml version=\"1.0\"?><s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><u:Pause xmlns:u=\"urn:schemas-nds-com:service:SkyPlay:2\"><InstanceID>0</InstanceID><Speed>0</Speed></u:Pause></s:Body></s:Envelope>",
};

var skyId = "INDIVIDUALCODEFORSKYBOXHERESkyPlay";
       //Default HTTP Headers
var HeaderBody = {
"User-Agent": "SKY_skyplus",
"Content-Type": "text/xml",
"charset": "utf-8",
"SOAPACTION": "\"urn:schemas-nds-com:service:SkyPlay:2#Pause\"",
"Accept-Language": "en-us",
"Accept-Encoding": "gzip, deflate",
"Connection" :"keep-alive",
};
                     
CF.log("Command sent");
CF.request("http://192.168.1.16:49153/","POST", skyId, "HTTP/1.1", HeaderBody, Command.Pause,
function(status,headers,body){
CF.log(body);
CF.log(status);
CF.log(headers);
});
};

I get the following in the debugger;
> Javascript interface up and running, opening connection with iViewer
> Established connection with iViewer
> Javascript starting up. iViewer version: v4.0.296 build 296
> Sky control started
> Command sent
> Invalid parameters for CF.request: (
    POST,
    "INDIVIDUALCODEFORSKYBOXHERESkyPlay",
    "HTTP/1.1",
        {
        "Accept-Encoding" = "gzip, deflate";
        "Accept-Language" = "en-us";
        Connection = "keep-alive";
        "Content-Type" = "text/xml";
        SOAPACTION = "\"urn:schemas-nds-com:service:SkyPlay:2#Pause\"";
        "User-Agent" = "SKY_skyplus";
        charset = "utf-8";
    },
    "<?xml version=\"1.0\"?><s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><u:Pause xmlns:u=\"urn:schemas-nds-com:service:SkyPlay:2\"><InstanceID>0</InstanceID><Speed>0</Speed></u:Pause></s:Body></s:Envelope>",
    "CF.wrappers.f21"
)
> Lost connection with iViewer
> Lost realtime monitor connection

Tried a search to find out what "CF.wrappers.f21" is but came up blank.
Any thoughts please?
Cheers
Chris

Jarrod Bell

unread,
Apr 11, 2014, 10:02:37 AM4/11/14
to comman...@googlegroups.com
You have too many parameters in your CF.request, try this instead:

CF.request("http://192.168.1.16:49153/", "POST", HeaderBody, Command.Pause, function(status,headers,body) {

It should be in the format CF.request(url, method, headers, body, callback)


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Birks

unread,
Apr 11, 2014, 10:14:17 AM4/11/14
to comman...@googlegroups.com
Thanks for the speedy reply Jarrod :)
Moving ahead, not getting the CF.wrappers error, just a "-1 Timeout" so will fiddle on with it... I know the INDIVIDUALCODEFORSKYBOXHERE has to be included somewhere.
Cheers :)
Chris

Chris Birks

unread,
Apr 11, 2014, 10:24:29 AM4/11/14
to comman...@googlegroups.com
This works in Demopad so just need to find a way to send it using CF.....
POST /INDIVIDUALCODEFORSKYBOXHERESkyPlay HTTP/1.1\x0D\x0AHost: 192.168.1.16:49153\x0D\x0AUser-Agent: SKY_skyplus\x0D\x0AContent-Length: 369\x0D\x0AAccept: */*\x0D\x0AContent-Type: text/xml; charset=utf-8\x0D\x0ASOAPACTION: "urn:schemas-nds-com:service:SkyPlay:2#Pause"\x0D\x0AAccept-Language: en-us\x0D\x0AAccept-Encoding: gzip, deflate\x0D\x0AConnection: keep-alive\x0D\x0A\x0D\x0A<?xml version="1.0" encoding="utf-8"?>\x0D\x0A<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">\x0D\x0A    <s:Body>\x0D\x0A        <u:Pause xmlns:u="urn:schemas-nds-com:service:SkyPlay:2">\x0D\x0A            <InstanceID>0</InstanceID>\x0D\x0A            <Speed>0</Speed>\x0D\x0A        </u:Pause>\x0D\x0A    </s:Body>\x0D\x0A</s:Envelope>\x0D\x0A
Cheers
Chris

On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:

Jarrod Bell

unread,
Apr 11, 2014, 10:32:35 AM4/11/14
to comman...@googlegroups.com
The data you highlighted should be part of your URL:

CF.request("http://192.168.1.16:49153/INDIVIDUALCODEFORSKYBOXHERESkyPlay"


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--

Chris Birks

unread,
Apr 11, 2014, 10:46:24 AM4/11/14
to comman...@googlegroups.com
Thanks Jarrod :)
I'll post again if/when I get any further...
Cheers 
Chris

On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:

Chris Birks

unread,
Apr 13, 2014, 12:14:26 PM4/13/14
to comman...@googlegroups.com
Well, I guess I'm getting somewhere!? Using the following;

function skyControl() {
CF.log("Sky control started");
var Command = {
Pause : "<?xml version=\"1.0\" encoding=\"utf-8\"?><s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><u:Pause xmlns:u=\"urn:schemas-nds-com:service:SkyPlay:2\"><InstanceID>0</InstanceID><Speed>0</Speed></u:Pause></s:Body>/s:Envelope>",
};
var HeaderBody = {
"User-Agent": "SKY_skyplus",
"Content-Type":"text/xml",
"charset":"UTF-8",
"Accept":"*/*",
"Accept-Langague":"en-us",
"SOAPACTION": "\"urn:schemas-nds-com:service:SkyPlay:2#Pause\"",
};

CF.request("http://192.168.0.3:49153/INDIVIDUALCODEFORSKYBOXHERESkyPlay/HTTP/1.1/", "POST", HeaderBody, Command.Pause,
function(status,headers,body){
CF.log(status);
CF.log(headers);
CF.logObject(body);
});
};
I get the following error in debugger;
> Javascript interface up and running, opening connection with iViewer
> Established connection with iViewer
> Javascript starting up. iViewer version: v4.0.296 build 296
> Sky control started
> 500
> [object Object]
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>XML error</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Any thoughts please?
Cheers
Chris

On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:

Jarrod Bell

unread,
Apr 13, 2014, 7:22:26 PM4/13/14
to comman...@googlegroups.com
The error says your XML is invalid, and sure enough you are missing a < symbol in your last XML element:
</s:Envelope>


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--

Chris Birks

unread,
Apr 14, 2014, 6:48:33 AM4/14/14
to comman...@googlegroups.com
Hi Jarrod and thanks :)
Unfortunately this was corrected and I now get a new error!?;

> Javascript interface up and running, opening connection with iViewer
> Established connection with iViewer
> Javascript starting up. iViewer version: v4.0.296 build 296
> Sky control started
> 500
> [object Object]
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>-1</errorCode>
<errorDescription>Invalid Action</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

I've tried looking through upnp architecture but not getting anywhere :(
Cheers
Chris

On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:
Message has been deleted
Message has been deleted

Chris Birks

unread,
Apr 14, 2014, 12:36:01 PM4/14/14
to comman...@googlegroups.com
In case this sheds any more light on things, using firefox poster and just the soapaction as header and the following as body, it works! I can't translate this to work with CF though :(
<?xml version="1.0" encoding="utf-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SetAVTransportURI xmlns:u="urn:schemas-nds-com:service:SkyPlay:2"><InstanceID>0</InstanceID><CurrentURI>xsi://ff0</CurrentURI><CurrentURIMetaData>NOT_IMPLEMENTED</CurrentURIMetaData></u:SetAVTransportURI></s:Body></s:Envelope>

Any thoughts please?
Cheers
Chris
PS
This is now an attempt to change channel, rather than pause.


On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:

Jarrod Bell

unread,
Apr 14, 2014, 7:52:45 PM4/14/14
to comman...@googlegroups.com
Can you send through the entire HTTP packet data that works? ie. the headers, body, URL, method, etc?

One difference I saw in your original post was the HTTP Body in your demopad example has newlines throughout the XML, whereas your example does not. Shouldn't make a difference, but maybe the sky box is picky about this.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--

Chris Birks

unread,
Apr 16, 2014, 2:36:33 PM4/16/14
to comman...@googlegroups.com
Sussed it, yay :) It seems it was the "/" after /INDIVIDUALCODEFORSKYBOXHERESkyPlay that stopped it working!
In case it's of use to anyone and it can bee adapted to send stop, play, FF and REW commands;

function skyControl() {
CF.log("Sky control started");

var Command = {
Pause : '<?xml version="1.0" encoding="utf-8"?>' +
'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>' +
'<u:Pause xmlns:u="urn:schemas-nds-com:service:SkyPlay:2">'+
'<InstanceID>0</InstanceID></u:Pause></s:Body></s:Envelope>',
};
var HeaderBody = {
"User-Agent": "SKY_skyplus",
"SOAPACTION": "\"urn:schemas-nds-com:service:SkyPlay:2#Pause\"",
"Content-Type":"text/xml;",
"charset":"\"UTF-8\"",
};

CF.request("http://192.168.0.3:49153/INDIVIDUALCODEFORSKYBOXHERESkyPlay", "POST", HeaderBody, Command.Pause,
function(status,headers,body){
CF.log(status);
CF.log(headers);
CF.logObject(body);
});
};

Cheers :)
Chris

On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:

Jarrod Bell

unread,
Apr 16, 2014, 7:03:22 PM4/16/14
to comman...@googlegroups.com
Excellent, thanks for sharing.

If you are in an even more sharing mood, you could share your JS file with the full command list via gist.github.com (just make sure its public, and choose JavaScript as the language if it doesnt auto detect it via the filename). Then paste the full gist URL here for everyone to see!


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--

K Dziuba

unread,
May 12, 2014, 12:16:57 PM5/12/14
to comman...@googlegroups.com
hi

is the INDIVIDUALCODEFORSKYBOXHERESkyPlay some sort of username and password

is it a serial nr of the box ? as we can't work around

and still getting the invalid action error.

Thank you

Kris


On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:

Chris Birks

unread,
May 12, 2014, 1:42:09 PM5/12/14
to comman...@googlegroups.com
Hi Kris
Its a "uuid", basically its a unique identifier for each sky box play and browse (and possibly other) functions. Incidentally, I noticed mine had changed following an automatic sky box software update. You will need to use something like "Wireshark" to listen to communications to/from the sky box to find these uuids, I thinnk its free to download. What I did was set Wireshark running on my laptop whilst using the Sky+ App to look at the planner and guide, then look at SSDP or UDP protocols for the sky box ip address and you will find the uuids - there is one for SkyPlay and another one for SkyBrowse though in my case they is only 1 digit difference. They look like 666D7821-4163-123F-8462-00586c983426 (I made the actual number up but this is the format).
I hope that helps, it sounds a bit complicated and takes a bit of time but easy once you get the hang of it.
Good luck :)
Cheers Chris


On Friday, 11 April 2014 14:54:01 UTC+1, Chris Birks wrote:
Message has been deleted
Message has been deleted

Jarrod Bell

unread,
May 12, 2014, 9:04:17 PM5/12/14
to comman...@googlegroups.com
I think you replied to the wrong thread here Barry.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


On 13/05/2014 6:59 am, Barry Gordon wrote:

There are some other issues also relating to just when you want to process the guide data. That processing needs to be done out of the anonymous function when all the replies have been received. I suggest you count each reply as it comes in and when all the replies are in ( the counter will be 1 less than the number of items in the channel list when all replies have been processed. You then process the guideData array.  This is not totally safe in that you should put a timer on it so that if for some reason a reply is missed you do not hang up waiting forever for it to arrive.

 

From: comman...@googlegroups.com [mailto:comman...@googlegroups.com] On Behalf Of Barry Gordon
Sent: Monday, May 12, 2014 4:23 PM
To: comman...@googlegroups.com
Subject: RE: Sky+ IP control

 

The problem you are having is as follows:

 

The main outer loop that iterates the CF.request function is not doing what you want. As each CF.request is issued, and before the reply has returned, the loop process the next item in the channels array. The entire loop is completed before the first reply comes back. ergo for each reply, the processing of the body has i  set to the final value of i  which in your case is 44. Therefore when you build the guideData array and you pull items from the channels array you always get the same item since is i is always 44. You need to make the processing of the reply anonymous function not dependent on the value of i, just what is returned in the body since the return asynchronously with respect to the loop issuing the CF.request.

 

The line that needs to be fixed is:

 

                                                                                  guideData.channels.push({ name: chanData.channels[i].name, channel: chanData.channels[i].channeldec, shows: showArray

                                                                                                                                                //, id: channelID, icon: channels[i].childNodes[3].attributes['src'].value

                                                                                                                                             });

 

I suggest the following:

 

As soon as the body comes back and before you parse it pull out the channel number.  It is in a fixed location so something like var chnNmbr=body.slice(14,18) should give the 4 character string which is the channel number.  Then do a search using a quick for loop to find the index to use to find that channel name in the channels list. Use the index of where it is found to pull the name you want from the channel list

--

You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Barry Gordon

unread,
May 12, 2014, 10:03:47 PM5/12/14
to comman...@googlegroups.com
I think you are right. Hopefully Chris will see it but I will put a copy on the crest thread.

Sent from my iPad

K Dziuba

unread,
May 13, 2014, 7:29:08 AM5/13/14
to comman...@googlegroups.com
Thank You Chris this save my time keep searching

I've extracted the uuid with the sky remote python script - https://github.com/lgladdy/SkyRemote

I am trying to send the Post header and body msg using VBA in Access but somehow my skybox goes to standby and doesn't want to go on again.

I'll let you know if I go any further

Cheers

Kris
Reply all
Reply to author
Forward
0 new messages