Custom Component: SkyQ Media Player

Correction: you should try. Do not know if the mediaserver switch do work with ‘false’.

Do you have any automation using these switches?
If yes, can you share some examples?

No. No automation, only used within the mediacenter control.
Should be easy to use in automation, but actually I do not need it.
I directly use the switches with Alexa…

Ok i’ll try to do some…

Sorry, really new to custom components.

I am running Hassio.
I have a folder like this:

image

I tried putting the contents of what I downloaded into it:

sky_remote folder with init.py and sky_remote.py, and the seperate files init.py, manifest.json, media_player.py in.

But get config errors:

Configuration invalidCHECK CONFIG

Platform error media_player.skyq - No module named ‘custom_components.skyq.sky_remote.sky_remote’; ‘custom_components.skyq.sky_remote’ is not a package

my config file currently has the below in:

  - platform: skyq
    name: SkyQ Living Room
    host: 192.168.1.106
    room: Living Room
    config_directory: '/home/homeassistant/.homeassistant/'
    generate_switches_for_channels: true
    sources:
      SkyOne: '1,0,6'
      SkyNews: '5,0,1'

Should this work with Hassio? How do I put your custom component parts into HA?

Sorry!

Do not kow about Hassio but your config directory is different, the
/home/homeassistant/.homeassistant
one is for hassbian.

thanks.

having /config/ still gives problems, but I think thats around how I have uploaded the files. Should I have this?

image

because I am getting this error:

image

The file structure is OK.
For Hassio I cannot help, I am on Hassbian, sorry.

No problem, hopefully someone else has this working. controlling sky tv through HA sounds a great feature

@4n0nD3v3l0p3r

Is it possible you can add your repo to HACS .

Thanks

2 Likes

I am getting a lot of this error since i installed this custom component:

2019-10-18 12:24:05 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.skyq_salotto fails

Investigating more, i noticed that all these errors that fill completely my logfile happen almost of the times during the night, when the decoder is in standby…
Has anyone alse these issues?

Other parts of the logfile:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 268, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 448, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/skyq/media_player.py", line 171, in update
    if (self._client.powerStatus() is 'On'):
  File "/home/homeassistant/.homeassistant/custom_components/skyq/sky_remote/sky_remote.py", line 20, in powerStatus
    output = json.loads(self.http_json())
  File "/home/homeassistant/.homeassistant/custom_components/skyq/sky_remote/sky_remote.py", line 16, in http_json
    response = requests.get('http://' + self.ip + ':9006/as/system/information')
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.32', port=9006): Max retries exceeded with url: /as/system/information (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x54acc0d0>: Failed to establish a new connection: [Errno 113] No route to host'))

How to avoid?

@Matt_Barnes, did you get this working?

I can confirm this is working for me in hassio, and your folder layout looks correct. I would check the basics, whitespace issues etc. Issues evident if you click validate config and then check the developer logs for more detailed info. I suspect it is picking up your files based on location, but failing to load for some reason.

I am new to hassio, but happy to help if I can.

For ref, here is my config in my media_player.yaml file:

  - platform: skyq
    host: 192.168.0.9
    name: TestSkyLR
    room: Living Room
    config_directory: '/config/'
    generate_switches_for_channels: true
    sources:
      SkyOne: '1,0,6'
      SkyNews: '5,0,1'

Thanks. I was wondering what to do at work today! Will see if I can get Sky working :slight_smile: will let you know how I get on.

Got this working today.

Just started from scratch, following the instructions and SkyQ media player appeared in my config using Hassio.

Need to test it actually works but looks positive. Now to play around with a remote or some sort of backgrounds for a media card or similar.

image

image

Anyone got any examples of graphics and interfaces for this?
Not created my own buttons before so will have a play tomorrow.

2 Likes

@maurizio53, I have solved the issue based on my tests, but do let me know how you get on. :smiley:

This issue was happening when powerStatus check occurs but was unable to connect to the SkyQ box.

I have raised a pull request for @4n0nD3v3l0p3r to merge changes into his master. However, in the meantime you can pull the project from my repo with your fix.

1 Like

Yes, you’re right as i solved temporarely disabling during the night the automatic sleep option, but everytime i restart HA and the decoder is off i always get those error. I’ll try your fix and let you know…
EDIT: Which files i must download from your repo? All of them or which one?

Can anyone help with the code to add to a button to call a service to change source to 1,1,5?

I have this but it does not work, sorry on phone so can’t copy the actual code.

I have been doing some code clean up in the repo as I am hoping to do more with it (if I can). As such you need to take all the files.

EDIT: You won’t need to amend any configuration, you can drop my updated files into the existing folder and restart HA (I think) to get the update to take effect.

I did it, but now i have the media_player.skyq_salotto always off and cannot turn on with the media_player.turn_on command, like before… Maybe i must change something else?

Actually this is the folder of skyq custom component:

39

Is it right?
EDIT: Ok solved… the static IP changed (don’t know why) after the changes i made… Now it’s all ok.
One question. I have integrated into the skyq decoder also some apps like NETFLIX or DAZN. Is it possible to create sources also for these apps together with the channels?

Glad you resolved your issue.

With regards to your Netflix question, please consider a short term/low quality solution, I’m sure their are better ways, but this is what come to mind as a quick solution.

Add Netflix as a source, ensuring no spaces between button’s and comma’s.

Netflix: 'home,down,down,down,down,down,down,down,down,down,down,right,select,select'

e.g.

media_player:
  - platform: skyq
    host: 192.168.0.9
    name: TestSkyLR2
    room: Living Room
    config_directory: '/config/'
    generate_switches_for_channels: false
    sources:
      SkyOne: '1,0,6'
      SkyNews: '5,0,1'
      Netflix: 'home,down,down,down,down,down,down,down,down,down,down,right,select,select'

I’m not entirely sure we the need for a second select, but my tests showed that worked, I suspect we have a timing issue that needs investigation down the road.

3 Likes