Today’s video is part 2 of our look at retrieving data from an API and displaying it in Home Assistant. We look at how to pull information from the YouTube API and display the latest video from any YouTube channel. We show you how to install a custom Lovelace card that lets you use Home Assistant template information and HTML to make a truly custom card. We pull the latest thumbnail, title, and link from any channel.
As I show in the video here are the rest sensors that I used.
Just replace :
- [[YTCHANNELID]] with the ID from your YouTube channel of choice.
- [[APIKEY]] with your YouTube channel ID you generated from Part 1.
- platform: rest
resource: https://youtube.googleapis.com/youtube/v3/search?part=snippet&channelId=[[YTCHANNELID]]&channelType=any&order=date&key=[[APIKEY]]
method: GET
value_template: '{{ (value_json["items"][0].id.videoId) }}'
name: "Latest Peter McKinnen Video"
scan_interval: 14400
- platform: rest
resource: https://youtube.googleapis.com/youtube/v3/search?channelId=[[YTCHANNELID]]&channelType=any&order=date&key=[[APIKEY]]
method: GET
value_template: '{{ (value_json["items"][0].snippet.title) }}'
name: "Latest Peter McKinnen Video Title"
scan_interval: 14400