Pull Data From The Web & Display In Home Assistant - Working with APIs - Display YouTube Sub Count
Тәжірибелік нұсқаулар және стиль
* Update - it looks like they removed the Social Blade integration, so this looks like the only way to get KZread Data into Home Assistant now*
Hey everyone!! As I said in the video this is part 1 of a series on communicating with APIs and displaying data in Home Assistant. Now in this video, I show you how to explore an API and set up the calls to retrieve data and place it in a sensor in Home Assistant. In this example, I am pulling from the KZread API and displaying the subscriber and view count from a KZread channel.
Let me know if there is an API you need help with. Part 2 should be coming next week.
❓What future topics would you like me to cover??❓
▶ Buy Me A Beer 🍻: [www.buymeacoffee.com/ThisSmar...](www.buymeacoffee.com/ThisSmar...)
▶ Timestamps
00:00 - Opening
00:17 - Introduction
02:45 - Part 1 - Requirements
03:09 - Part 2 - Get API Key
03:24 - Part 2.1 - Sign into Console
03:39 - Part 2.2 - Create Project
04:04 - Part 2.3 - Add KZread API
04:33 - Part 2.4 - Grab API Key
05:14 - Part 2.5 - Note on Quotas
05:54 - Part 3: API Data
06:08 - Part 3.1 - Creating Sensors.yaml
06:56 - Part 3.2 - Exploring KZread API
07:53 - Part 3.3 - Build API Call
09:17 - Part 3.4 - Find Chanel ID
10:15 - Part 3.5 - Testing API on your machine
11:31 - Part 4 - Create HA Sensor
12:05 - Part 4.1 - Building Rest Sensor
12:50 - Part 4.2 - Note on Refreshing Data
13:31 - Part 4.3 - Working with JSON
14:01 - Part 4.4 - Building Value Template
17:31 - Part 4.5 - Building Multiple Sensors
18:07 - Part 5 - Verify Sensors
19:31 - Outro
▶ Links in Video:
(I use [Rebrand.ly](rebrand.ly/) for my URL shortening)
Fun APIs - tshouse.link/apis
Blog Post for Video - tshouse.link/yt15post
G dev console - tshouse.link/gdev
KZread API Console - tshouse.link/ytapi
Home Assistant Rest Sensor Docs - tshouse.link/harest
▶ Product Links:
(When available, we use affiliate links and may earn a commission!)
My Main Home Automation Gear (Kit.co): tshouse.link/homekit
My Z-Wave Home Automation Gear (Kit.co): tshouse.link/zwave
▶ Get a One-Month Trial of Great Music for Creators (I use this on my photography channel): [tshouse.link/sound](tshouse.link/sound)
▶ Website: thissmart.house
Пікірлер: 63
I am a Network engineer with not much exposure to programming, but have always wanted to build a custom integration to pull info from a lot of websites. This is by far the most amazing video that help me understand literally everything I ever wanted to know. Thank you! You have earned yourself a life time subscriber!!
@ThisSmartHouse
2 жыл бұрын
So glad it helped. You're project sounds interesting.
3 years old and this still helps! Thanks for a well explained walk through. I've managed to run a REST API call to build a Sensor in HA using your details and newly updated HA docs on REST sensors.
GREAT EXAMPLE !!! Nice clear walk through of all the steps. Looking forward to viewing your other "tubes"
@ThisSmartHouse
Жыл бұрын
Thanks! Let me know if you have anything you want covered.
Your videos do really help me get started with Home Assistant. Thank you so much!!
@ThisSmartHouse
2 жыл бұрын
That's why I make them. I am so glad it helped. Anything you want to see that would help you?
This is wonderful, thank you for the detailed explanation!
@ThisSmartHouse
8 ай бұрын
Glad it was helpful!
Awesome!! Thank you for the always awesome work!!
@ThisSmartHouse
3 ай бұрын
My pleasure!
really very good informative and the way of your illustration very clear definitely i will follow your channel
@ThisSmartHouse
3 жыл бұрын
Thank you so much!
1000 subs will be coming! Keep up the good work:)
@ThisSmartHouse
3 жыл бұрын
Thank you so much!!!
thank you for this tutorial
Did you notice your subscriber count increment just now? haha. Very well explained but a little out of my league just for now. However this demonstration answered a lot of questions I had about the method used to extract info like that. Time for me to watch again and go off to experiment. Thanks for taking the time to help others.
@ThisSmartHouse
2 жыл бұрын
Thank you! I appreciate every sub I have. Don't be intimidated learning this stuff is extremely powerful. I've been able to apply so many bits of knowledge I gained by playing around with apis to my day job (I work in IT).
Thanks for the video, i am trying to get data from a web site I log into for my pool temp and various levels. What API do I need to find in Google Developer Console to achieve this?
Thanks for the video!
@ThisSmartHouse
3 жыл бұрын
You bet!
Super cool. Thanks
@ThisSmartHouse
2 жыл бұрын
You are welcome
Thank you so much - now i can read the marker states from my lightmanager air and integrate my smoke detectors ! the ha documentary was kinda confusing with reading json
@ThisSmartHouse
Жыл бұрын
Glad it helped! Learning how to interact with APIs is a super helpful skill to have.
Great video!
@ThisSmartHouse
2 жыл бұрын
Thanks!
Nice video, with 1 suggestion - the youtube player controls are obscuring what you are typing at the bottom of the screen. I'm trying to pause your video so I can type in my HA window, and the YT player controls are overlapping what you have types at the bottom.
This is exactly what I'm looking. The integrated OCR engines of home assistant are not really good and easy to use. For a project I wanted to use an API OCR engine. As i understood the video correctly you are doing to get commands for you're two sensors. Is there a way to do it only by one pull and to the values as attributes into the sensor?
Thx so much, gonna use this to pull bus line arrival times ...
@ThisSmartHouse
Жыл бұрын
Awesome! There is no end to the stuff you can do with APIs. I am constantly researching if a service has an API. I really wish Amazon would open up theirs for parental control of Kindles...
Thanks!
@ThisSmartHouse
2 жыл бұрын
No problem!
cna youdo the same with TikTok?
Not sure if you are still checking comments - I've been using the Google Sheets API to pull a single cell value from a spreadsheet. When tested using the template editor in HA I get the data I want with the Result Type: Number but the rest sensor keeps reporting state:unknown. Any suggestions?
@ThisSmartHouse
2 жыл бұрын
Hmmm. Because of the complexity it'd be better for you to join the discord channel so I can help you more directly. tshouse.link/discord
Nice video! I would suggest one minor improvement.. or at least an improvement IMO. One sensor can have multiple attributes (attribute_templates). Instead of creating more sensors doing the same Api call, just add attributes to the same sensor. I would suggest maybe adding the "status" part in the Api call, using the "privacyStatus" as the State (public = "on") and use the "statistics" part for attributes.
@ThisSmartHouse
2 жыл бұрын
For sure. I was trying to get people's "feet wet" with APIs, but you are right much more efficient.
@Zizzy7
2 жыл бұрын
@@ThisSmartHouse makes sense, totally get it. Might be too intimidating if you go all out in an explanation video. :)
@ThisSmartHouse
2 жыл бұрын
This is the struggle I have. I want to have a video be complete on a subject but then it will be an hour long...
@aleharder
2 жыл бұрын
Hey, any chance you could explain on how to implement that? Or have example code for it?
How to add attributes to your scrape-sensor? I have a scrape-sensor which gets the water-temperature from a lido. So I want the coordinates as attributes. like: latitude: 47.3519 longitude: 8.5360 If possible I would even like to have an attribute with the website-link where I scraped the information. Are there some informations about how I can create such attributes or how they have to be named ("link:", "source:", "web:", ...)?
buonasera,ho seguito il tuo video per creare lo stesso sensore che hai creato tu, dopo aver seguito le tue indicazioni ho effettuato la prova su modelli di homeassistant ed il risultato era corretto, ma una volta riavviato homeassistant il sensore da me creato èin stato unknow, uso homeassistant supervisor su debian 11 ultimo aggiornamento.
what about MySensors , NRF24 integration ? make some step_by_step ... please
I got voltge values for three phases as a list. How to get values only for phase L1? { "status":"ok", "voltage": [230.2, 229.8, 224.6], } {{ value_json['voltage'] }} is giving me all three values
@RetroAdz
9 ай бұрын
That's an array of integers, so you'd do value_json['voltage'][0] to get the first in the array
I'm not seeing the sensor come up when using Developer tools. All worked until the end. Any ideas? HA showing no errors in the YAML.
@ThisSmartHouse
2 жыл бұрын
Might be easier if you jump on our discord so I can give you some things to try. tshouse.link/discord
@Dmkjr
2 жыл бұрын
@@ThisSmartHouse Thanks! I'll jump on the channel because I love learning, but I think I just figured out what I was doing wrong. :|. YAMMMMMLLLL. I thought when it's broke it was always DNS. 🤭
@ThisSmartHouse
2 жыл бұрын
That is true rule in IT (just had that this week), but in home assistant it is ALWAYS YAML.
This is great, but I can't get to actually pull the information automatically.... the scan interval doesn't do anything
Actually sometimes I don't understand why integrate any Google products into HA - point of HA is to avoid of Tech totalitarism.
@ThisSmartHouse
3 жыл бұрын
Yeah Google makes things difficult but you have to work with what you get. But you can apply this method to other APIs.
you called the file 'sensors.yaml', but i'm pretty sure it's supposed to be 'sensor.yaml'
@ThisSmartHouse
Жыл бұрын
It doesn't matter as long as it matches what you defined in configuration.yaml. Mine is called sensors.yaml (I had to double check).
ehm no... It does not in fact work, though I reasonably sure I've done it correct, asper your instruction, only I couldn't split up the fine, for some odd reason. At any rate, I did learn a thing or two, so thanks.
@ThisSmartHouse
Жыл бұрын
Things do change on apis. But mine still seems to be working. What error are you getting?