Scrape functions extract data from HTML pages using CSS selectors, similar to Home Assistant’s scrape integration. They’re useful for websites without APIs.Documentation Index
Fetch the complete documentation index at: https://extended-openai-conversation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Configuration
The URL of the web page to scrape
List of data points to extract from the page
Template that combines scraped sensor values into the function result
Sensor Configuration
Each sensor extracts a piece of data from the page:Variable name to use in the main
value_templateCSS selector to find the element
Template to process the selected element’s text
Extract an HTML attribute instead of text (e.g.,
href, src)CSS Selectors
Basic Selectors
Basic Selectors
Combinators
Combinators
Attribute Selectors
Attribute Selectors
Pseudo-classes
Pseudo-classes
Advanced Features
Extract Attributes
Extract Attributes
Get HTML attributes instead of text:
Multiple Elements
Multiple Elements
Extract all matching elements:
Headers
Headers
Add custom headers (e.g., for authentication):
Use Cases
Version Tracking
Monitor software versions and releases
Price Monitoring
Track product prices and availability
News Aggregation
Extract headlines and articles
Status Pages
Monitor service status pages
Best Practices
Inspect the page
Use browser DevTools to find the right CSS selectors. Right-click an element and select “Inspect” to see its HTML structure.
Respect robots.txt
Check the website’s
robots.txt to ensure scraping is allowed. Add appropriate delays for rate limiting.Debugging
Test CSS selectors in browser console:Examples
Get Home Assistant Version
Scrape the current version from home-assistant.io:Scrape Product Price
Extract Multiple Items
Comparison: Scrape vs REST
| Feature | Scrape | REST |
|---|---|---|
| Data format | HTML | JSON/XML |
| Requires API | No | Yes |
| Selector type | CSS | JSON path |
| Best for | Public websites | APIs with keys |
| Maintenance | Higher (HTML changes) | Lower (stable APIs) |
Next Steps
REST Functions
Use APIs when available
Composite Functions
Combine scraping with processing
Scrape Integration
HA scrape integration docs