Zum Hauptinhalt springen

Sky Q Smart-Home-Integration, kostenlos und Open Source

Sky Q-Integration für Gladys Assistant

Sky Q set-top boxes on the local network: standby, channel, play, pause, remote keys.

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

Control your Sky Q set-top boxes from Gladys, on your local network, without any cloud: power state, wake-up and standby, channel, play, pause, the other remote keys, the channel or recording being played and the share of the recordings disk in use. The integration uses the local ports of the box (REST 9006, UPnP/SOAP 49153, remote control 49160), the ones the Sky apps and the community libraries use.

Unofficial integration, not affiliated with Sky. This first milestone was written and tested against simulated boxes: it has never been tested with a real box. Your feedback is welcome.

Supported boxes​

  • Sky Q main boxes (UK, Ireland, Italy, Germany).
  • Sky Q Mini boxes and Sky Glass TVs (types IPSETTOPBOX and TV) are read (power state, disk) but take no remote key, and their playback is not read, as in the reference library.

Prepare the box​

Give the box a fixed IP address in your router (reserved DHCP lease). The box must be on the same network as Gladys. No setting of the box is known to be needed (not checked on a real box yet).

Add a box​

  • By its address: type the IP address in "IP addresses of the boxes" (several addresses separated by commas) and save.
  • By the search: use Find the boxes. Gladys searches the network (SSDP, target urn:schemas-nds-com:device:SkyControl:2) for the integration; a network blocking multicast may hide the box: type its address then.

The box appears in the integration's Discovery tab: create it. Its states come with the next read (at most one refresh interval later).

What you get​

FeatureDetail
PowerRead only: 1 on, 0 in standby or not answering
ReachableRead only: 1 the box answers on the network (on or in standby)
Wake upButton: "Home" then "Dismiss", sent only when the box was just read in standby
StandbyButton: the power key, sent only when the box was just read on
ChannelRead while live TV is shown; setting it types the digits of the number, 300 ms apart
ButtonsPlay, pause, stop, record, rewind, fast forward, channel up/down, arrows, select, back, Sky, TV guide, info
Remote keyDropdown of the keys of the remote (colours, digits, text, help, Box Office...), never the power key
Channel nameRead only, - when no live channel is shown
Recording playedRead only: the title of the recording played, - otherwise
PlaybackRead only: playing, paused or idle
Recordings disk usedRead only, in percent, read every 10 minutes

There is no switch: wake-up and standby are two push buttons, so a generic on/off command ("everything off" scene, voice assistant) does not reach them, and the power toggle leaves only through the guarded Standby button. There is no volume: the box has none the network can read or set. The programme guide (EPG) is not read: it is online only, and this integration stays on your local network.

How a command is sent​

Commands to one box are sent one after the other; each gets 3.5 s from the moment Gladys asks, the wait for the previous ones included. Before any key, the integration reads the serial number at the box's address: a key is sent only after the box's own serial number was read there (a box replaced, or moved by DHCP, gets no key at an address where another box answers).

  • Wake up: the power state is read; in standby, "Home" then "Dismiss" are sent (the way the Home Assistant integration wakes a box: these keys are not a toggle). Already on: nothing is sent.
  • Standby: the power state is read; on, the power key is sent. Already in standby: nothing is sent. The power key is a toggle, so it is sent only on a state read just before.
  • Standby and wake-up send nothing ("nothing sent" in the logs) when: the address of the box is unknown, the box does not answer, its serial number cannot be read or is another box's, its power state cannot be read, it is a Mini box or a Sky Glass TV, its remote port refuses the connection, or the 3.5 s ran out first.
  • The protocol of the remote has no acknowledgement: a key that left is "sent, without confirmation". The box is read again 5 s after a wake-up, a standby, a channel, play, pause, stop or a channel key (and 20 s after a wake-up or a standby). A wake-up or standby that did not change the state after 20 s is written to the logs; it is not sent again by itself (a second toggle could undo the first).
  • After a wake-up or a standby, neither is sent again until a read shows the state changed, or for 30 s (a box applies a key a second or two later: a second toggle read on the old state would undo the first). Meanwhile they are refused ("not seen applied yet (retry in up to 30 s): nothing sent"). The guard is kept in /data with its wall-clock time: after a restart of the integration it is alive if it is under 30 s old, or if the clock seems to have been set back. If /data cannot be read, they are refused ("/data cannot be read ...: nothing sent") until it can, and at most 30 s after the start (a guard of the previous run cannot be older). If the guard cannot be written to /data, the key is not sent.
  • Between the read of the state and the key, the handshake of the remote takes a moment (up to 1.5 s): a change made in that moment with the Sky remote is not seen.
  • A channel is typed digit by digit. When the channel list of the box is known, a number that is not in it is refused. A number whose digits cannot all be typed in the time left is not started.

The User-Agent "SKYPLUS_skyplus"​

To find its SkyPlay service, a box publishes up to 50 description files on its UPnP port. The reference library asks them with the User-Agent of the box's own software, SKYPLUS_skyplus: some boxes may answer them only so (not checked on a real box yet). With the explicit agreement of the maintainer of these integrations, this integration may send it, under these rules:

  • each description file is first asked with this integration's own User-Agent (gladys-sky-q);
  • SKYPLUS_skyplus is sent for a file only after that file got an explicit HTTP refusal with the own User-Agent (an answer other than 200 and 404), and only while no file answered the own User-Agent; a 404, no answer or a cut answer never leads to it;
  • one pass over the files at most; after a failed search, or an error of the SOAP service, the files are asked again 10 minutes later at the earliest;
  • it goes only to the box's own address, only on its UPnP port (49153), only for these description files: the REST requests, the SOAP requests and the remote keys carry the integration's own User-Agent or none;
  • once a User-Agent got a description file from a box, the other is not tried again for that box until the integration restarts or the box changes address.

No other imitation of an application is used, and the online services of Sky (guide, images) are not contacted.

Configuration​

FieldDetail
IP addresses of the boxesSeparated by commas; boxes found by the search are kept
Refresh interval (s)5 to 300, 15 by default: how often the boxes are read

An invalid address is ignored; the status of the integration says how many were ignored (without showing them back).

Check the boxes shows, for each known box, what the last read found and how long ago. It starts a read only when one is due: never sooner than the refresh interval.

Status of the integration​

  • No box answers: every created box failed to answer at its last read.
  • Another box answers at the address of...: the serial number read at a box's address is another box's. The first box gets no command until it is found again (search or new address).
  • The configuration could not be read: Gladys did not give it; it is asked again every 30 s, and the boxes already known keep taking commands.
  • The saved data cannot be read: /data/sky-q.json exists but cannot be read; it is left untouched and nothing is saved until it is fixed. A file that is not valid JSON is moved to sky-q.json.bad.

What the integration keeps​

In its data folder (/data/sky-q.json): the known boxes (serial number, address, model), the time of the last read, so that a restart does not read sooner than the interval, and the guard of a wake-up or standby just sent. No password: a box needs none.

Limits of this first milestone​

  • Never tested with a real box (see the TODO of the repository for what to check first).
  • No programme title for live TV (the guide is online only).
  • The current application of the box (Netflix, YouTube...) is not read.
  • No recording management (deleting, keeping, booking).

Konfigurationseinstellungen​

Diese Einstellungen fragt Sky Q in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
Your Sky Q boxes, on your local networksectionNeinPower state, wake-up and standby, channel, playback, the recording played, the recordings disk and the remote keys, through the local ports of the box (REST 9006, UPnP 49153, remote 49160), without any cloud and without the online TV guide. Give each box a fixed IP address in your router, then type the addresses below, or use "Find the boxes". The boxes then appear in the Discovery tab. Sky Q main boxes (UK, Ireland, Italy, Germany); Sky Q Mini boxes and Sky Glass TVs are read but take no key. Unofficial integration, not affiliated with Sky.
IP addresses of the boxesstringNeinSeparated by commas, for example 192.168.1.50, 192.168.1.51. Boxes found by the search are kept without being typed here.
Refresh interval (s)numberNeinHow often the boxes are read, in seconds.

So installierst du Sky Q in Gladys​

  1. Öffne in Gladys Integrationen: Sky Q erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/lm1lc3n7/gladys-sky-q:0.1.2) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/LM1LC3N7/gladys-sky-q.

Sky Q benötigt Gladys >=5.1.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

Sky Q ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von LM1LC3N7 veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂