Sky Q set-top box custom media_player component

Belated update.
It’s working perfectly.
Thanks.
Dont ask what was wrong, as i’m still unsure ;o)

1 Like

This has been a great addition to my setup - thanks. I seem to be suffering sporadic issues with it though where it will report nothing is playing, and if I restart HA it fails to add the component. The box is still available on the network when this occurs. Here is a section of the log if it is of any help - does anyone have any suggestions?

2017-08-20 09:27:20 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform skyq
Traceback (most recent call last):
  File "c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\homeassistant\helpers\entity_component.py", line 164, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "c:\users\admin\appdata\local\programs\python\python36\lib\asyncio\tasks.py", line 352, in wait_for
    return fut.result()
  File "c:\users\admin\appdata\local\programs\python\python36\lib\asyncio\futures.py", line 244, in result
    raise self._exception
  File "c:\users\admin\appdata\local\programs\python\python36\lib\concurrent\futures\thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\admin\AppData\Roaming\.homeassistant\custom_components\media_player\skyq.py", line 93, in setup_platform
    add_devices([SkyQ(name, host, xmlTvFeedUrl)])
  File "C:\Users\admin\AppData\Roaming\.homeassistant\custom_components\media_player\skyq.py", line 105, in __init__
    self._soapControlURl = self._getSoapControlURL(host, 0)
  File "C:\Users\admin\AppData\Roaming\.homeassistant\custom_components\media_player\skyq.py", line 121, in _getSoapControlURL
    description = xmltodict.parse(resp.text)
  File "C:\Users\admin\AppData\Roaming\.homeassistant\deps\Python36\site-packages\xmltodict.py", line 330, in parse
    parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: no element found: line 1, column 0

Thanks

That error looks like it’s having trouble getting information from the box over the network when trying to first set up the component. Difficult to say what the root cause could be, maybe a network issue? Do you have any logs of when it’s not reporting anything playing?

Cant get it to work at all at the moment. Had a look with wireshark and I think its falling over as its getting nothing at all back from description0.xml but its trying to parse it as XML? I’ve tried with CURL and get the same - description1.xml is fine and content is there but description0.xml is blank. Going to try restarting the SkyQ box.

Thanks

Rebooted but no change. Tried it with my mini box and works fine. Description0.xml from the mini but my silver box reports 404

Request

GET http://192.168.1.39:49153/description0.xml HTTP/1.1
Host: 192.168.1.39:49153
User-Agent: SKYPLUS_skyplus
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive

Response

HTTP/1.1 404 Not Found
SERVER: Linux/3.10.27 UPnP/1.0 SKY DLNADOC/1.50
CONNECTION: close

Interesting. There might be a difference with the Silver box that I haven’t been able to account for. I only have a 2TB box and a Mini to test with here.

If you take a look at the _getSoapControlUrl function, you can probably see that it’s looking for a specific service that it needs to talk to. That service might be defined on a different SOAP definition file on your particular box (this is definitely the case for my Q and Mini boxes, which use description0.xml and description1.xml respectively) - or it might be missing entirely, which could throw a bit of a spanner in the works…

The Sky Q Silver box is the 2TB box. I also have the 2TB box and 2 mini’s.
Luckily for me, it’s working.

Thanks for the push in the right direction. The strange thing is this has worked fine a few days ago. Anyway took a look at my silver box vs my mini. SkyRC on the mini was description0.xml - but it wasn’t description1.xml on the silver which is what we would expect? description1 in the silver is SkyPairing, I found SkyRC on description2.xml - changed this around in the code you provided and sure enough its working again. I will see how it goes and see if it changes again!

Ah yes, I was getting the SKUs mixed up, I know there is a 1TB and 2TB variant but I can never remember the branding! :o)

Interesting, perhaps there is a software update being rolled out. What’s the version number on your Silver box? Glad you got it working in the meantime. :slight_smile:

So my sky Silver box has not appeared for days now either. The mini and cast are still visible. What command did you run get the 404 response.

HW Version: 32B061
SW Version: Q004.002.84.00L(4m1knhs)

Mine has since changed back to description0. I used curl for Windows. You have to use the switch to change the user agent to SKYPLUS_skyplus as well.

Just checked again and it’s changed again, seems to be a regular thing by the looks of it.

Yeah, this might be a bit of an issue. See edits to the OP.

To correct my previous statement - my mini box has never changed it’s always been description0. My silver box alternates between description1 and description2, haven’t managed to find any pattern yet.

Did the websocket been closed off in latest software version?
the scripts on 5900 are no longer working?

Hi,

Forgive me, but I appear to be missing something, I’m just starting out with HA, and have a few skyQ boxes, but following this thread I fail to see where I can get the skyq.py file from.

Thanks

1 Like

is there any plan / possibility of this becoming available again?

Does it work for a standard (newer version) PlusHD box?

Im also very frustrated that my Sky box is the only (and most used) media aspect missing from HAS!!!

1 Like

I think the ports on Sky q are now blocked. Been timing out a few weeks ago. Haven’t checked this week but doubt they are open again. As for HD there are some articles about ports and api on Google.

Looks like the port has just moved to 49160.

Thanks that works a treat.
It’s been 2 weeks without working.
Sky Q.