Sky Q set-top box custom media_player component

So I sorted the issue with the binary_sensor: part.

That’s giving me a Skyq living room status on the home page but this doesn’t seem to be updating correctly…

Still having isssues with the switch part too?

Anyone have any ideas? Would really help me out!

Thanks!

When looking at the home assistant Configurator, do you have the switches listed as in this screenshot?

The only entity I have enabled on the overview is the binary sensor, not the switch. I’m not using the switch as it doesn’t actually do anything. Also, the turn_on and turn_off service code for the switch (script.sky_q_living_room_power) doesn’t actually work as there is no working script associated with turning on and off the box yet. I put it there as a placeholder for if & when a working switch should be created. Sorry, I should have mentioned that before but was writing in haste and now have a bit of time to look into it. You can do away with the switch code altogether and just use the binary sensor because basically all it’s doing is the following -

Checking the webpage you have defined, checking if ‘activeStandby’ is set to False, if it is, the sensor is to be ON meaning the SkyQ is on. If it is set to True, then the SkyQ is off.

I’m using Lovalace now but before, in my ‘groups.yaml’ file (the file that tells everything where it should be presented), I had this -

frontroom:
name: Living Room
entities:

  • light.front_room_light
  • media_player.front_room_tv
  • binary_sensor.skyq_living_room_power_status
  • media_player.apple_tv
  • remote.apple_tv
  • media_player.playstation_4
  • media_player.lounge

If you are now using Lovelace then, I have for the same room - (appreciate theres a lot more in there than needed for Sky but just so you see it in context)

title: Living Room
cards:
  - type: entities
    title: Lighting
    entities:
      - light.front_room_light
  - type: entities
    title: Switches
    entities:
      - binary_sensor.skyq_living_room_power_status
      - remote.apple_tv

  - type: media-control
    title: Front Room TV
    entity: media_player.front_room_tv

  - type: media-control
    title: Front Room AppleTV
    entity: media_player.apple_tv

  - type: media-control
    title: Playstation 4
    entity: media_player.playstation_4

  - type: media-control
    title: Sonos System
    entity: media_player.lounge

My switch (sensor) looks like this on and off -

Hope this helps you!

Okay! This is starting to make sense now! Thanks for all of your help!

binary_sensor:
  - platform: rest
    resource: http://192.168.0.3:9006/as/system/information/
    name: SkyQ Living Room Power Status
    device_class: power
    value_template: ‘{% if (value_json.activeStandby == False) %}on{% else %}off{% endif %}’

I now have this in my configuration.yaml and this is giving me a status on the home screen but this does not seem to responding to SkyQs actual status

I let it run over night to see if it would eventually update but no joy!

Regarding the home assistant configurator I do not have the switches listed - only the binary_sensor.skq_living_room_power

Thanks for your help. Again any suggestions would really help me out!

W.D

Try this -

What do you get when you browse to http://192.168.0.3:9006/as/system/information/

You should notice the activeStandby entry change from true to false when the box is off (standby) and on. If the box is powered down completely then the page will be unavailable and the sensor will fail to connect. The box needs to be on standby and not totally off. My sensor doesn’t update instantly, it takes at least 15 seconds maybe more to poll the box and change from off to on etc.

Yeah already been on there, page shows all the settings for the skyQ box… that page does show the correct status.

Seems like Home Assistant isn’t picking it up though? Must be something in my code that I’ve pasted above that prevents it from monitoring?

Does anything else need to be installed onto Home Assistant apart from what’s included on a new install?

Does my code look sensible to you?

Are there any other settings I need to add for this to work?

Thanks!

So ive found that the following at least gives me a status of the skybox although not ‘perfect’

Sensor:
- platform: rest
    resource: http://192.168.0.3:9006/as/system/information
    name: SkyQ Living Room Power Status
    device_class: power
    value_template: ‘{% if (value_json.activeStandby == False) %}on{% else %}off{% endif %}’

This gives me the following…

I can’t for the life of me work out why the binary_sensor isn’t working as commanded!?

Any inputs appreciated! WD

Does this still work? I can’t seem to get it configured correctly.

I also struggled to get this working, eventually used this…

      - platform: rest
        resource: http://192.168.0.5:9006/as/system/information/
        name: SkyQ Living Room systemUptime
        json_attributes:
            - systemUptime
            - activeStandby
        value_template: '{{value_json.systemUptime}}'
        scan_interval: 5
        
      - platform: template
        sensors:
          skyqlivingroomuptime:
            value_template: '{{ states.sensor.skyq_living_room_systemuptime.attributes["systemUptime"] }}'
            unit_of_measurement: 's'
            friendly_name: SkyQ Living Room System Uptime
          skyqlivingroomstandby:
            value_template: '{{ states.sensor.skyq_living_room_systemuptime.attributes["activeStandby"] }}'
            friendly_name: SkyQ Living Room Standby Status
          skyqlivingroompower2:
            value_template: '{% if (states.sensor.skyq_living_room_systemuptime.attributes["activeStandby"] == false) %}on{% else %}off{% endif %}'      
            friendly_name: SkyQ Living Room Power Status

Seems to be some oddity with using value templates directly, but using attributes is a viable work around.

Hope this helps

2 Likes

Thanks, Do you know how to turn on the box from home assistant?

I have a Harmony Hub and use this to control the skyQ box via the IR interface, with the rest interface this provides just enough functionality to do what I require. AFAIK the media player component for the skyQ box has been abandoned?

I use Node Red to control my Sky Q box.

https://flows.nodered.org/node/node-red-contrib-skyremote

1 Like

see below:

Out of interest, How did you get this working? I get the following…

SkyQNodeRedError

Just using an ‘Inject Node’ to test it at the moment…

Set the Port number to 49160 by using Sky+ HD.

Hope it works for you.

1 Like

Yep! I just spotted that they’ve changed the SKYQ Port to match the SKY+HD one on the nodered pallete.
This is awesome! Thanks a lot!

Edit:
@cameron sorry, how would I make a button or similar in the front end (lovelace) to start the inject (or whatever is required) in NodeRed?
I’m still a newbie with nodered, and the only automations I’ve made so far dont require interactions (light brightness changes etc).
Feel free to PM if you dont want to go off topic.

This is some of my Code if you like to try.

script:
  channel_remote:
      sequence:
        - service: mqtt.publish
          data_template:
            topic: 'sky/channel/'
            payload: '{{value}}'

  command_remote:
      sequence:
        - service: mqtt.publish
          data_template:
            topic: 'sky/command/'
            payload: '{{value}}'


Lovelace


                    - type: custom:button-card
                      entity_picture: /local/tv_icons/BBC ONE HD.png
                      tap_action:
                        service_data:
                          value: '["1","1","5","select"]'
                      template: remote_button_sky_channel_template

                    - type: custom:button-card
                      icon: mdi:play
                      label: Play
                      tap_action:
                        service_data:
                          value: 'play'
                      styles:
                        card:
                          - background-color: '#339900'
                      template: remote_button_sky_control_template

Button Card Template


  remote_button_sky_channel_template:
    show_state: false
    show_name: false
    show_label: false
    show_entity_picture: TRUE
    size: auto
    tap_action:
        action: call-service
        service: script.channel_remote
    styles:
      card:
        - border-radius: 15px
        - width: 85px
        - height: 85px
      entity_picture:
        - width: 80px
        - height: 80px
        - border-radius: 3px

  remote_button_sky_control_template:
    show_state: false
    show_name: false
    show_label: true
    size: auto
    aspect_ratio: 2/1
    tap_action:
      action: call-service
      service: script.command_remote
    styles:
      icon:
        - height: 50px
        - width: 50px
        - color: white
      card:
        - border-radius: 15px
1 Like

Ah, I dont have MQTT set up yet… Looks like that will be my next job!
Thanks again.

My wife got pretty excited when I did a demo and explained we could use it to effectively have a “Netflix” button. :slight_smile:

1 Like

Node Red

1 Like

Has anyone created a custom media player or similar that has the SkyQ controls such as the navigation pad on it ?
up, down, left righ, enter as buttons ?

Try this: