Creating a Home Assistant Web Scraper Sensor

Here is a demonstration of using lxml for scraping a website to extract essential HTML data and pass the data as sensor to Home Assistant.

Source Code:


As home assistant already has a web scraper, maybe you could explain how this one differs and what the pros and cons are compared to the built in.

There are many full blown scapers, scapy, beautiful-soup, lxml etc. The one included is HA is just designed for simple web pages. The example I used here scapes a simple HTML page, but lxml is capable of much more.

Thank you, so lxml is the point of differentiation. Useful to know. when I get a spare few hours to learn something new I’ll look at lxml. Cheers and good to see contributions coming in all the time.


how to install lxml in hassio?

I’m not familiar with docker. I gave up on hassio, using regular hassbian on my end

1 Like