Home Assistant
EdgeFetch pairs with Home Assistant in two parts that work together or separately:
- EdgeFetch custom integration (Home Assistant Marketplace): A thin async HTTP client (
edgefetch) that connects Home Assistant to any EdgeFetch Hub (https://hub.example.comor the local add-on) and exposes AI-assistant LLM tools (web_search,read_web_page,extract_passages), data-returning actions (edgefetch.search,edgefetch.scrape,edgefetch.extract,edgefetch.catalog), and watched-page subentry sensors. - EdgeFetch Home Assistant OS add-on: An AppArmor-confined Alpine container (
slug: edgefetch) that runs either as a self-hosted single-box Go Hub (mode: hub) with automatic Supervisor discovery or as an outbound-only residential worker node (mode: worker) with zero inbound ports.
Why EdgeFetch + Home Assistant
Section titled “Why EdgeFetch + Home Assistant”Home Assistant core already includes a built-in Scrape integration for pulling CSS selectors out of raw HTML. EdgeFetch solves a different problem:
- 491 declarative site adapters: Instead of brittle CSS selectors against noisy markup, 491 YAML adapters route known platforms, package registries, commerce storefronts (Shopify, WooCommerce), public-data portals (Socrata, CKAN, NOAA/weather.gov, Legistar), forums (Discourse, Reddit, Hacker News), and docs sites directly to their official public APIs, feeds, or structured JSON-LD.
- Thin client, Go engine: The Python custom integration contains zero HTML parsers, CSS selectors, or scraping logic. Every call goes to the EdgeFetch Hub’s HTTP API, where Go enforces RFC 9309
robots.txt,Content-Signal: ai-input, per-host pacing,Retry-Afterbackoff, and dial-time SSRF protection (RejectNonPublicPeerblocks Home Assistant’s:8123, RFC 1918 LANs, loopback, Tailscale100.64.0.0/10, and cloud metadata beforeconnect()). Pages behind logins, CAPTCHAs, or anti-bot challenges stop immediately rather than attempting bypasses. - Untrusted-content boundaries & agent separation: Web pages and search snippets returned to Home Assistant conversation agents are explicitly framed as untrusted external content so OpenAI, Anthropic, Google, or local Ollama agents answer questions from them without following prompt-injection instructions inside third-party pages. For defense in depth, attach EdgeFetch to a separate read-only research/Q&A Conversation Agent rather than combining untrusted web browsing and
Assistsmart-home device control on the same agent.
Home Assistant OS add-on: worker vs hub mode
Section titled “Home Assistant OS add-on: worker vs hub mode”Add the EdgeFetch add-on repository to Home Assistant OS with one click, then install EdgeFetch (ghcr.io/bartrumb/edgefetch-addon-amd64 and ghcr.io/bartrumb/edgefetch-addon-aarch64):
Set mode in the add-on Configuration tab depending on where you run your Hub:
| Option | mode: hub |
mode: worker (default) |
|---|---|---|
| Best for | Self-hosted single-box Home Assistant OS setup (no cloud account or separate VPS) | Adding a home residential worker node to a remote Cloudflare Workers or VPS Hub |
| What runs | Standalone Go Hub (edgefetch --mode=hub) + local fetch engine |
Outbound Go worker (edgefetch --mode=agent) dialing wss://hub.example.com/agent/ws |
| Storage | Persistent /data/hub directory managed by Supervisor |
Stateless (/data holds locked startup options only) |
| Network surface | Internal Supervisor network only on port 8080 (no host port mapped) |
Zero inbound listening ports (host_network: false) |
| Integration setup | Automatic Supervisor discovery (discovery: [edgefetch]) |
Connect the integration to your remote Hub URL (https://hub.example.com) |
mode: hub — Self-hosted Hub on Home Assistant OS
Section titled “mode: hub — Self-hosted Hub on Home Assistant OS”When mode is set to hub, the add-on runs the pure-Go EdgeFetch Hub directly on your Home Assistant OS box:
- Mandatory
caller_key(fail-closed startup): You must configure a strong secret in the add-on’scaller_key(passwordschema) option before starting. Inhubmode, the add-on refuses to start without a configuredcaller_keyso an unauthenticated Hub can never boot on the Supervisor network. - Internal Supervisor network only (port
8080, no host port mapped): The Hub listens strictly on internal container port8080inside the Home Assistant Supervisor network, with no host port mapped onto your home LAN. - Home-LAN, Supervisor, and DNS-rebinding SSRF protection: Outbound fetches enforce dial-time peer IP and hostname verification (
RejectNonPublicPeer), blocking all home-LAN / RFC 1918 ranges, Home Assistant (:8123) and Supervisor internal endpoints, loopback, link-local / cloud metadata (169.254.0.0/16), CGNAT / Tailscale (100.64.0.0/10),.localand.home.arpainternal domains, and DNS-rebinding targets right beforeconnect(). - Persistent storage: Hub state, SQLite metadata, named caller keys, and BM25 search collections are stored under
/data/hubacross restarts and Home Assistant backups. - Automatic Supervisor discovery: On startup in
hubmode, the add-on announces its internal{host, port}endpoint through the Home Assistant Supervisor discovery API (discovery: [edgefetch]). The secretcaller_keyis never placed in the discovery payload; Home Assistant prompts you once to confirm the discovered EdgeFetch Hub and paste the key.
# Example add-on configuration (mode: hub)mode: hubcaller_key: "<long-random-secret>"pause_ms: 1000pause_jitter_ms: 400mode: worker — Outbound worker node (default)
Section titled “mode: worker — Outbound worker node (default)”When mode is left at its default worker, the add-on acts strictly as an outbound worker node for an existing Cloudflare Workers or Go Hub:
- Dials outbound over TLS WebSockets (
wss://hub.example.com/agent/ws) usinghub_url,agent_token, andsite_id, so it works behind CGNAT, Starlink, or a home router with zero port forwarding. - Drops privileges irreversibly to
65532:65532(PR_SET_NO_NEW_PRIVS=1,PR_SET_DUMPABLE=0) under an AppArmorenforceprofile. - Enforces local per-host pacing floors (
pause_ms: 1000,pause_jitter_ms: 400), optional domain allowlists (allowed_hosts), owner-onlyrobots_bypass_hosts(only for domains you own, paired withROBOTS_BYPASS_HOSTSon the Hub), and fail-closed browser sandboxing (allow_no_sandbox_browser: falseby default). See Add worker nodes and Security model for full worker tuning details.
# Example add-on configuration (mode: worker)mode: workerhub_url: "https://hub.example.com"agent_token: "<your-hub-agent-token>"site_id: "site-ha-1"pause_ms: 1000pause_jitter_ms: 400allow_no_sandbox_browser: falseHome Assistant custom integration
Section titled “Home Assistant custom integration”Install EdgeFetch from the Home Assistant Marketplace (built into Home Assistant 2026.11+ via the HACS catalog), then connect it to your Hub.
1. Setup & caller keys
Section titled “1. Setup & caller keys”You can connect the integration in two ways:
- One-click Supervisor discovery (local
mode: hubadd-on): Open Settings → Devices & services. Home Assistant displays the discovered EdgeFetch card automatically (async_step_hassio). Select Configure, paste your add-oncaller_key, and submit. - Manual Hub URL (
https://hub.example.com): Open Settings → Devices & services → Add integration → EdgeFetch and enter:- Hub URL:
https://hub.example.com - Caller key: A named caller key (
ef_<prefix>_<secret>) created in your Hub’s/adminconsole under Access → Caller API Keys.
- Hub URL:
Recommended caller-key scopes
Section titled “Recommended caller-key scopes”| Scope | Required? | What it unlocks in Home Assistant |
|---|---|---|
fetch |
Required | /v1/scrape, /v1/search, /v1/extract, /v1/catalog — powers all LLM tools, actions, and watched-page sensors |
admin-read |
Optional | GET /agents — creates the Connected nodes diagnostic sensor showing how many worker nodes are online |
During setup, the integration verifies connectivity via GET /health and an authenticated check, binds the config entry’s unique ID to the Hub’s identity so the same Hub cannot be added twice, and creates a Hub connectivity binary_sensor (plus the Connected nodes sensor when the key holds admin-read).
- Options, spend controls & reauth: Under Configure on the integration entry, you can tune default
max_results, default scrapeformats, and built-in spend controls:- Per-entry daily call cap: Limits the total number of Hub API calls made by a config entry per day (across LLM tools, actions, and watched-page sensors) so runaway automations or chat loops cannot exhaust quotas. Reaching the daily cap blocks further calls until reset and raises a Home Assistant Repair issue in Settings → System → Repairs.
- Per-search
budgetUsdcap (search_budget_usd): PassesbudgetUsdon everyPOST /v1/searchcall so the Hub skips search providers whose list price exceeds your per-query ceiling. Settingsearch_budget_usdto0restricts searches strictly to $0 / free providers (such as a self-hosted SearXNG instance, indexed collections, Wikipedia, andsite:sitemap/llms.txtlookups). - Reauthentication: If you rotate or revoke an
ef_<prefix>_<secret>caller key in/admin, Home Assistant raises a standard Reauthenticate repair prompt without losing your watched-page sensors or automations.
- Diagnostics: Downloading diagnostics from Settings → Devices & services → EdgeFetch automatically redacts caller keys and any URL credentials.
2. AI assistant (LLM API) tools
Section titled “2. AI assistant (LLM API) tools”EdgeFetch registers an EdgeFetch LLM API provider with Home Assistant’s llm helper so Conversation Agents — OpenAI, Anthropic, Google Generative AI, Ollama, or other LLM integrations — can look up live external information politely.
Enable on a dedicated research Conversation Agent
Section titled “Enable on a dedicated research Conversation Agent”- Go to Settings → Devices & services, open your LLM integration (for example OpenAI, Anthropic, Google, or Ollama), and add a dedicated Conversation Agent entry (e.g., “Research Assistant”).
- In that agent’s configuration, enable EdgeFetch under its LLM API selector while leaving
Assistdevice control unchecked (you can assign it to its own Voice Assistant profile under Settings → Voice assistants). - Save. That Conversation Agent gains three tools:
| Tool | Hub endpoint | Behavior |
|---|---|---|
web_search |
POST /v1/search |
Searches your Hub’s configured search engines (Serper, Brave, Tavily, self-hosted SearXNG) and indexed collections, returning ranked titles, URLs, and snippets. |
read_web_page |
POST /v1/scrape |
Fetches one https:// URL through EdgeFetch’s 491 site adapters into clean Markdown, capped at ~8,000 characters so voice and chat context windows stay fast and bounded. |
extract_passages |
POST /v1/extract |
Politely fetches 1–20 https:// URLs and returns only the BM25-ranked passages matching the assistant’s query. |
Every tool description and response marks web output as untrusted external content, instructing the LLM never to treat text found inside a web page as system instructions or smart-home commands.
Example Assist & voice prompts
Section titled “Example Assist & voice prompts”- “Check the latest NOAA forecast discussion for marine zone ANZ531 and tell me if there’s a small craft advisory.”
- “Read https://crates.io/crates/tokio and tell me the newest stable version and when it came out.”
- “Search for the Home Assistant 2026.11 release notes and summarize what changed for Marketplace integrations.”
- “Extract the passages mentioning battery charging temperature limits from these two manual URLs.”
3. Data-returning actions (SupportsResponse.ONLY)
Section titled “3. Data-returning actions (SupportsResponse.ONLY)”For deterministic automations, scripts, and template sensors, EdgeFetch registers four service actions that return structured JSON via response_variable (SupportsResponse.ONLY):
| Action | Parameters | Returned response |
|---|---|---|
edgefetch.search |
query, optional max_results, time_range, detail (compact | standard | full) |
Ranked results (title, url, snippet, score) and search metadata |
edgefetch.scrape |
url, optional formats (markdown, records, links, json), json_filter, query |
Trimmed Hub JSON (markdown, records, links, json, extractor_id, via). Caps markdown at 20,000 characters and includes truncated: true plus next_offset when more content remains |
edgefetch.extract |
urls (1..20 https:// URLs), query |
Top BM25-scored passages (results) with source url, title, and score |
edgefetch.catalog |
url, optional platform (auto | shopify | woocommerce), fields, max_pages |
Polite storefront product/variant summary and snapshot diff metadata |
Why edgefetch.scrape caps Markdown at 20,000 characters
Section titled “Why edgefetch.scrape caps Markdown at 20,000 characters”Home Assistant passes response_variable payloads through its in-memory script/template engine, which degrades when handed multi-megabyte documents. edgefetch.scrape caps returned markdown at 20,000 characters and sets truncated: true (along with next_offset when the Hub provides an artifact paging offset) so templates stay responsive. When you only need specific facts from long pages, prefer edgefetch.extract with a query, formats: ["records"], or json_filter.
Example Home Assistant automation
Section titled “Example Home Assistant automation”This morning automation fetches structured release data from a project page via edgefetch.scrape and posts a persistent notification when a new version appears:
automation: - alias: "Morning upstream release digest" trigger: - platform: time at: "08:00:00" action: - action: edgefetch.scrape data: url: "https://crates.io/crates/ripgrep" formats: - markdown - json response_variable: page - action: notify.persistent_notification data: title: "Upstream package check ({{ page.extractor_id | default('html') }})" message: >- {{ page.markdown[:600] }} {% if page.truncated %} (Truncated at 20,000 chars; next_offset={{ page.next_offset | default('n/a') }}) {% endif %}4. Watched-page subentry sensors
Section titled “4. Watched-page subentry sensors”To track a value on a public page over time without writing YAML automations, add a Watched page subentry under Settings → Devices & services → EdgeFetch → Add watched page.
Each watched page configures one URL and one structured value source:
- Adapter field: Read a named field produced by one of EdgeFetch’s 491 declarative site adapters (identified by
extractorId, such as a package version, status indicator, or listing metric). recordsindex + field: Extract a field from EdgeFetch’s structured list-item extractor (formats: ["records"]), for examplerecords[0].priceorrecords[0].title.jsonFilterpath: Evaluate a Hub-sidejsonFilterpath against structured adapter or JSON API output, returning just the targeted scalar value.
Polling floor, numeric parsing, and attributes
Section titled “Polling floor, numeric parsing, and attributes”- Polite
>= 15minute interval: Every watched page runs its ownDataUpdateCoordinatorwith a minimum update interval of 15 minutes (never faster), layered on top of EdgeFetch’s per-host pacing, conditional caching,robots.txtchecks, andRetry-Afterhandling. - Automatic numeric & currency/unit detection: When the extracted value parses as a number or price (for example
$49.99or18.4 °C), the sensor exposes a numeric state with the parsed ISO currency or unit of measurement so Home Assistant records long-term statistics and graphs automatically. Non-numeric values (such as version strings or status labels) are exposed as text sensors. - Provenance attributes: Every watched-page sensor includes three state attributes for debugging and template use:
url— canonicalhttps://URL watchedfetched_at— ISO 8601 timestamp of the Hub fetchvia— adapterextractorIdor worker route that produced the value
