Integrated TV guide

is It possible to add a TV guide to ha so I can easily see what’s on TV

Not trying to deny you, I have a tab in Lovelace that tells me what shows are “coming soon” in my sonarr integration and what has been recently added to my plex, but wouldn’t you want TV Guide right in your media player of choice so you could schedule DVR and tune to channels?

I wish the iFrame card were more robust, I used to have a few webpage tabs in Lovelace but they stopped working when they upgraded to fancy interfaces. You could see if there’s a webpage with your guide that works with the iFrame card and set the Lovelace page to panel mode.

Just some thoughts.

I wanted something similar but couldnt find any options.

To be honest, i struggled to even find a good xml/api feed to get the data from for UK listings.

I wasnt really sure how XMLTV worked but the fact that http://www.xmltv.co.uk/ was empty and showed no listings meant I didnt even both looking into this. One or two other APIs were paid for versions which I didnt want.

I did find a API at freesat.co.uk randomly from http://www.webgrabplus.com/content/freesatcouk-0 However this was the only place I could find any reference of their API online anywhere!! I could find no documenation at all.

However, the channels are listed at https://www.freesat.co.uk/tv-guide/api list BBC One as channel 505.
Then todays listings can be viewed at https://www.freesat.co.uk/tv-guide/api/0?channel=505
Tomorrows would be https://www.freesat.co.uk/tv-guide/api/1?channel=505

The api lists all of todays shows on BBC one with a start time and a duration. It is then a case of going through each “event” to find the one event that had a start time less than now and a start time+ duration of greater than now.

Ideally I would have done this using some json query or in some command line function so everything stayed with HA, however I dont have experience in this.

Therefore, I set about using PHP as this is my native programming language. I wrote a simple page which got the contents of the freesat api and parsed them until I found the event I required. This then returns just the current show


{
"name": "Money for Nothing",
"description": "2/7. Sarah and the team repurpose an old road light, a 70s style sofa, a worn-out dressing table and a set of moth-eaten blankets. Also in HD. [S]",
"time": "15:00 to 16:00"
}

I then pulled this into a HA sensor (one per channel for the channels I reglarly watch)

  - platform: rest
    name: TV Guide - BBC One
    value_template: '{{ value_json.name }}'
    json_attributes:
      - description
      - time
    resource: http://*****tvlistings.php?channel=505

Then ive displayed all the information and a tap on the programme name will change the channel on the TV to show the programme

image

Im welcome to any pointers into a better way of achieving this as its a bit dirty the way it is.

4 Likes