Skip to content

HA Direct Connection

KNOOP edited this page Aug 27, 2026 · 1 revision

HA Direct Connection

Ava Pro 0.7.3 adds Live State over WebSocket — direct Home Assistant entity-state streaming that bypasses the ESPHome satellite protocol for state updates. This reduces latency for dashboard rendering and entity state changes.


How It Works

When Live State is enabled, Ava opens a subscribe_entities WebSocket subscription to Home Assistant. Entity states stream directly from HA over WebSocket instead of arriving through the ESPHome satellite protocol.

Home Assistant ─── subscribe_entities (WebSocket) ───→ Ava (live state)
         │
         └── ESPHome satellite protocol ───→ Ava (fallback)

Dual-source arbitration: Ava's HaStateArbiter receives state from both sources:

  • WebSocket (Live State) — primary, lower latency
  • ESPHome — fallback when WebSocket is unavailable

When WebSocket state is available, ESPHome state for the same entity is suppressed. When WebSocket goes down or is disabled, ESPHome state automatically takes over.


Entity Interest Tracking

Ava tracks which entities are currently visible (on-screen dashboard, floating windows, quick entity panel) and includes only those in the subscription. When the user navigates to a different dashboard page, the entity interest set changes and the subscription is updated.

This prevents flooding the WebSocket with state updates for hundreds of entities that are not currently displayed.

Snapshot replay: When the subscription is established or re-established, HA sends a full snapshot of all subscribed entities' current state. Ava replays this snapshot to update all visible entities at once.


ESPHome Fallback

If the WebSocket connection drops or Live State is disabled:

  • ESPHome state updates resume automatically
  • No user-visible interruption — entities continue updating
  • When WebSocket reconnects, it takes priority again

The fallback is seamless and automatic. No configuration is needed beyond enabling Live State.


Setup

  1. Go to SettingsHome Assistant
  2. Turn on Live State
  3. Entity states now stream directly from HA over WebSocket

Path: Settings → Home Assistant → Live State


Performance

Source Latency Update rate
ESPHome satellite ~200–500 ms (poll-based) Periodic
WebSocket (Live State) ~20–50 ms (push) Real-time

Live State is particularly beneficial for:

  • Dashboards with many entities that change frequently
  • Real-time sensor displays (power, temperature, presence)
  • Quick Entity panel slot switching

Compatibility

  • Requires Home Assistant 2024.1+ (for subscribe_entities WebSocket command)
  • Works alongside ESPHome satellite protocol (not a replacement)
  • ESPHome is still used for voice audio, wake events, timers, and announcements
  • Live State only affects entity state display, not voice functionality

Signed-In HA Session for Camera, Cover, and Media

Beyond entity-state streaming, the signed-in HA session is also used for authenticated media access:

Use case Before 0.7.3 With HA Direct
Camera stream / snapshot Derived an IP from the ESPHome connection — worked, but the URL was unauthenticated and could fail behind HA's trusted-networks auth Uses the signed-in HA session token as Authorization header — works behind any HA auth configuration
Cover / camera quick actions Routed through ESPHome Can use direct HA WebSocket service calls
Media browser / media auth ESPHome media player only HA media auth token available for media browser calls

The session token stays in memory only — it is never written to disk, never appended to a URL as a query parameter. When the HA session expires, Ava re-authenticates transparently.

Why this matters: A user named Morgan has HA behind a reverse proxy with IP-based allowlisting. The old ESPHome-derived camera URL worked on the LAN but broke through the proxy. With the signed-in session, the camera stream works everywhere HA works — no special firewall rules, no exposed unauthenticated URLs.


Back to Home

Clone this wiki locally