Custom Component: SkyQ Media Player

Have you also tried using developer services to trigger one of the switches? I’d expect this to fail the same (it works for me but then, I haven’t had it fail in my other testing).

Assuming that fails, can you post one section of your generated yaml, e.g.

    skyq_bbc1hdbedroom_2:
      value_template: '{{"off"}}'
      friendly_name: 'BBC1HD in the bedroom_2'
      turn_on:
        service: media_player.select_source
        data:
          entity_id: media_player.sky_q_mini
          source: 'BBC1HD'
      turn_off:
        service: script.placeholder

It fails, new error:

Logger: homeassistant.helpers.service
Source: helpers/service.py:102
First occurred: 20:42:31 (1 occurrences)
Last logged: 20:42:31
Unable to find referenced entities media_player.sky_q_mansarda

This is the yaml generated:

skyq_italia1hdmansarda:
      value_template: '{{"off"}}'
      friendly_name: 'Italia 1 HD in the Mansarda'
      turn_on:
        service: media_player.select_source
        data:
          entity_id: media_player.sky_q_mansarda
          source: 'Italia 1 HD'
      turn_off:
        service: script.placeholder

Maybe i’ve found the problem, the entity id in the yaml is media_player.sky_q_mansarda
in home assistant i see media_player.skyq_mansarda i think the switch generated are referring to the wrong entity, why?

Confirmed, manually changin the yaml did the trick. Do not know why the yaml is generated with a different name for entity id

In theory it should regenerate the yaml every time you restart HA. That said, it then won’t pick up the switches until the next reboot (not ideal, but not sure how to improve). So, you need to make sure the switch file is regenerated and then reboot again.

It is possible, that if you had the switch file from prior to you adding the boxes via the ui, that you haven’t set the ‘Generate switches for channels’ for channels option in the ui setup, and therefore it is using the entity name from before. Or maybe you have renamed the entity. By default, because of the default name of ‘Sky Q’, it should create and entity called ‘sky_q****’. But that depends on what you put in the name box when you setup the integration.

In anywise it looks like things are out of sync. So I’d probably delete the yaml file, reboot to make sure it is generated, then reboot again. If it isn’t generated, then set the option in the settings, and then reboot.

If all that doesn’t work, post back and I’ll think again.

OK, I can see a problem. It is generating the switches based on the Friendly Name of the sky box, not on the entity name. I need to see if I have access to the entity name. Otherwise, just make sure the entity name and the friendly name have the same spaces/underscores.

I’ve posted a new version which should fix this issue. [BUG] Generate Switches doesn't use entity_id for switch names · Issue #38 · RogerSelwyn/Home_Assistant_SkyQ_MediaPlayer · GitHub

1 Like

I can’t get this to work, there’s something wrong with the call “service_data” but can’t figure out what…

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:129
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11:30:37 (9 occurrences)
Last logged: 11:34:27

[140704845387040] Error handling message: expected dict for dictionary value @ data['service_data']. Got 'Rai 1'
[140704845387040] Error handling message: expected dict for dictionary value @ data['service_data']. Got 'Rai1'

I’ve tried with other sources too but same error…

This is the card code in lovelace:

type: 'custom:swipe-card'
card_width: 185px
start_card: 2
parameters:
  effect: coverflow
  grabCursor: true
  centeredSlides: true
  slidesPerView: auto
  coverflowEffect:
    rotate: 50
    stretch: 0
    depth: 100
    modifier: 1
    slideShadows: true
  pagination:
    type: bullets
cards:
  - type: picture-entity
    entity: media_player.skyq_mansarda
    image: /local/Rai1.png
    tap_action:
      action: call-service
      service: media_player.select_source
      service_data: Rai 1

Thanks mate

I think you need to take a look at your service data to validate that it is correct for the Lovelace card your are using. I don’t use swipe-card, so have no experience. But when I look at it, your are saying you want to select source Rai 1, but you haven’t said what device you want to select the source on.

If you were to look at the developer services tab in HA, you will see that select source takes two parameters, entity_id and source. Given that swipe card is generic, it won’t know what Rai 1 is, as to whether it is the entity id or the source, and in any case it would still need the other parameter. So you need to take a look at the data you are providing.

I see you have the entity in there, but I doubt that will get fed into the service call.

@dankitchen seems to using it, i’ve just copied and adapted his code found here: Custom Component: SkyQ Media Player - Share your Projects! / Custom Components - Home Assistant Community (home-assistant.io)

Apologies if this has been asked before, but I haven’t found it anywhere.

Is there any way to select an app directly, without having to use keystrokes?
I suppose this is a feature request - is this possible with what Sky has exposed?

I’ve tried using the keystrokes, but it’s very unreliable and usually opens the app to the left or right!

Unfortunately, the answer to that is no. Sky do not expose functionality (that we are aware of) to do this.

I’ve saw your update of the component. It talks about apps, how it works?

It will show you which App you have open on the Sky Q box.

Did you manage to resolve this? I don’t use this particular card anymore but I still have the code for it.

1 Like

No, i ended up using buttons instead of swipe card :smiley:

Would you mind sharing your code? As a newbie I am struggling to understand, thanks

Hi all, this is my configuration.yaml:

#integrazione skyq
media_player:
 - platform: skyq
   name: sky
   host: 192.168.0.12
   sources:
      SkyTG: '1,0,0'
      SkySport: '2,0,0'
      SkyMotori: '4,1,8'
   generate_switches_for_channels: true

And in my config folder I have the skyqDefaultRoom.yaml file. The problem is that about each a day the media_player changes the name: sometimes works with media_player.skyq_living_room, sometimes with media_player.sky…
According the configuration.yaml the name should be media_player.sky…

manty thanks