Skip to content

Home Assistant

EdgeFetch pairs with Home Assistant in two parts that work together or separately:

  1. EdgeFetch custom integration (Home Assistant Marketplace): A thin async HTTP client (edgefetch) that connects Home Assistant to any EdgeFetch Hub (https://hub.example.com or 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.
  2. 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.

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-After backoff, and dial-time SSRF protection (RejectNonPublicPeer blocks Home Assistant’s :8123, RFC 1918 LANs, loopback, Tailscale 100.64.0.0/10, and cloud metadata before connect()). 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 Assist smart-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):

Add to Home Assistant

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’s caller_key (password schema) option before starting. In hub mode, the add-on refuses to start without a configured caller_key so 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 port 8080 inside 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), .local and .home.arpa internal domains, and DNS-rebinding targets right before connect().
  • Persistent storage: Hub state, SQLite metadata, named caller keys, and BM25 search collections are stored under /data/hub across restarts and Home Assistant backups.
  • Automatic Supervisor discovery: On startup in hub mode, the add-on announces its internal {host, port} endpoint through the Home Assistant Supervisor discovery API (discovery: [edgefetch]). The secret caller_key is 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: hub
caller_key: "<long-random-secret>"
pause_ms: 1000
pause_jitter_ms: 400

mode: 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) using hub_url, agent_token, and site_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 AppArmor enforce profile.
  • Enforces local per-host pacing floors (pause_ms: 1000, pause_jitter_ms: 400), optional domain allowlists (allowed_hosts), owner-only robots_bypass_hosts (only for domains you own, paired with ROBOTS_BYPASS_HOSTS on the Hub), and fail-closed browser sandboxing (allow_no_sandbox_browser: false by default). See Add worker nodes and Security model for full worker tuning details.
# Example add-on configuration (mode: worker)
mode: worker
hub_url: "https://hub.example.com"
agent_token: "<your-hub-agent-token>"
site_id: "site-ha-1"
pause_ms: 1000
pause_jitter_ms: 400
allow_no_sandbox_browser: false

Install EdgeFetch from the Home Assistant Marketplace (built into Home Assistant 2026.11+ via the HACS catalog), then connect it to your Hub.

You can connect the integration in two ways:

  1. One-click Supervisor discovery (local mode: hub add-on): Open Settings → Devices & services. Home Assistant displays the discovered EdgeFetch card automatically (async_step_hassio). Select Configure, paste your add-on caller_key, and submit.
  2. 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 /admin console under Access → Caller API Keys.
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 scrape formats, 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 budgetUsd cap (search_budget_usd): Passes budgetUsd on every POST /v1/search call so the Hub skips search providers whose list price exceeds your per-query ceiling. Setting search_budget_usd to 0 restricts searches strictly to $0 / free providers (such as a self-hosted SearXNG instance, indexed collections, Wikipedia, and site: sitemap/llms.txt lookups).
    • 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.

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”
  1. 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”).
  2. In that agent’s configuration, enable EdgeFetch under its LLM API selector while leaving Assist device control unchecked (you can assign it to its own Voice Assistant profile under Settings → Voice assistants).
  3. 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.

  • “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.

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 %}

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:

  1. 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).
  2. records index + field: Extract a field from EdgeFetch’s structured list-item extractor (formats: ["records"]), for example records[0].price or records[0].title.
  3. jsonFilter path: Evaluate a Hub-side jsonFilter path 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 >= 15 minute interval: Every watched page runs its own DataUpdateCoordinator with a minimum update interval of 15 minutes (never faster), layered on top of EdgeFetch’s per-host pacing, conditional caching, robots.txt checks, and Retry-After handling.
  • Automatic numeric & currency/unit detection: When the extracted value parses as a number or price (for example $49.99 or 18.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 — canonical https:// URL watched
    • fetched_at — ISO 8601 timestamp of the Hub fetch
    • via — adapter extractorId or worker route that produced the value