Getting the status of a Sky+ HD Box

Thanks to C4rtm4N I now have the status of my Sky+ HD box in Home-Assistant. When used in conjunction with dalhundal‘s sky-remote-cli it becomes close to a fully fledged solution.

Playback or Live TV is now automatically paused if the Sky+HD box is on…

The code I used (for now, there appears to be times when it generates errors in HA) is:

Sensor to catch the box’s status:

- platform: command_line
  name: sky_hd_status
  command: curl -i -s -o /dev/null -w "%{http_code}" 'http://sky_ip_address:49159/photo-viewing/start?uri=http://any_ip_address/null.jpg' && curl 'http://sky_ip_address:49159/photo-viewing/stop'
  scan_interval: 300

Template Switch to control the box:

- platform: template
  switches:
    skyhd:
      friendly_name: Sky+ HD
      value_template: "{% if states.sensor.sky_hd_status.state == '200' -%}on{% else %}off{% endif %}"
      turn_on:
        service: shell_command.sky_hd_power
      turn_off:
        service: shell_command.sky_hd_power

The shell commands are:

sky_hd_power: sky-remote-cli sky_ip_address power
sky_hd_pause: sky-remote-cli sky_ip_address pause

of course replace the ip addresses with that of the Sky box (which should be fixed by your router). You’ll need to ensure sky_remote_cli is installed of course:

npm install -g sky-remote-cli

Head over to dalhundal‘s page for more info on sky-remote-cli…