No description
  • Go 94.7%
  • Vue 3.9%
  • TypeScript 1.2%
Find a file
Joeri b62dafd308 feat: update dashboards live on every device
Every committed dashboard create, save, rename and delete is now
broadcast over the browser WebSocket as a dashboard frame, in commit
order. Kiosks show edits as they are saved, follow renames to the new
URL (keeping the group and query string) and show "not found" on a
delete. The dashboard list and kiosk switcher stay current, and an idle
editor takes over changes made elsewhere; one with unsaved edits keeps
them, warns once, and its next save wins. After a reconnect, views
refetch once and skip re-rendering when nothing changed.

The server also announces the build it serves on connect. Kiosk pages
reload into a new build after an upgrade; other pages switch on their
next navigation, so nothing being typed is lost. Pages built before
this change still need one manual reload.

This also fixes a kiosk dropping its query string when its group was
removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 19:32:59 +02:00
cmd/server perf: trim and dedupe browser state updates 2026-10-07 14:58:26 +02:00
internal feat: update dashboards live on every device 2026-10-20 19:32:59 +02:00
tools fix: harden full stack after code review 2026-10-01 00:00:19 +02:00
web feat: update dashboards live on every device 2026-10-20 19:32:59 +02:00
.dockerignore fix: harden full stack after code review 2026-10-01 00:00:19 +02:00
.gitignore feat: make the app installable as a PWA 2026-10-19 22:30:05 +02:00
AGENTS.md feat: update dashboards live on every device 2026-10-20 19:32:59 +02:00
compose.yml feat: initial HA Dash — lightweight kiosk dashboard for Home Assistant 2026-09-30 09:18:51 +02:00
Dockerfile feat: initial HA Dash — lightweight kiosk dashboard for Home Assistant 2026-09-30 09:18:51 +02:00
go.mod feat: initial HA Dash — lightweight kiosk dashboard for Home Assistant 2026-09-30 09:18:51 +02:00
go.sum feat: initial HA Dash — lightweight kiosk dashboard for Home Assistant 2026-09-30 09:18:51 +02:00
Makefile fix: harden full stack after code review 2026-10-01 00:00:19 +02:00
README.md feat: update dashboards live on every device 2026-10-20 19:32:59 +02:00

HA Dash

A lightweight Home Assistant dashboard designed for kiosk browsers on low-end devices. The stock Home Assistant frontend is far too heavy for old tablets and thin clients — HA Dash ships a single static page (~180 KB gzipped for the kiosk view, served precompressed and cached immutably), renders only what you placed on a grid, and receives entity diffs over one WebSocket so updates cost almost nothing.

┌─ kiosk browser ─┐   WS: snapshot + diffs   ┌── Go server ──┐  1 WS conn  ┌── HA ──┐
│  Vue SPA        │ ◄──────────────────────► │  API + hub    │ ◄─────────► │ /api/websocket
│  (embedded in   │   POST /api/services/…   │  SQLite       │  subscribe_entities
│   Go binary)    │                          └───────────────┘              └────────┘
  • One Go binary serves the embedded Vue app, the REST API and the browser WebSocket
  • The Go server holds a single WebSocket connection to Home Assistant (subscribe_entities) and fans out only changed states, trimmed to the few fields the UI uses — the HA token never leaves the server
  • Multiple dashboards, free grid with draggable/resizable tiles (WYSIWYG editor)
  • v1 tile types: lights (toggle + brightness) and switches (toggle)
  • Optimistic updates: taps feel instant, the authoritative diff follows over the socket
  • Live dashboards: edits, renames and deletes reach every open kiosk, list and editor over the same socket — no reload, and no traffic while nobody edits
  • Runs as non-root (uid/gid 10001) in a read-only distroless container

Quick start (Linux)

  1. Install Docker Engine with the compose plugin.

  2. Create the data directory owned by the container user (Docker creates missing bind-mount paths as root, which would make SQLite fail):

    mkdir -p ./data && sudo chown 10001:10001 ./data
    
  3. Build and run:

    docker compose up -d
    
  4. Open http://<host>:8090 and finish the setup (next section).

First dashboard

  1. Create a long-lived access token in Home Assistant: profile (bottom left) → Security → Long-lived access tokens → Create token.
  2. In HA Dash, fill in your Home Assistant URL (e.g. http://homeassistant.local:8123), paste the token, Test connection (should show your HA version), then Save.
  3. Create a dashboard: pick a name, number of grid columns and rows.
  4. In the editor, drag lights/switches from the left palette onto the grid (or click to place). Move and resize tiles freely; the layout autosaves.
  5. Open the dashboard and point your kiosk browser at its URL — e.g. http://<host>:8090/d/<dashboard-id>. Use Copy kiosk URL on the dashboard card.

Kiosk tips

  • Supported kiosk browsers: iOS/Safari 15.4+ and Chrome/Chromium 99+ (including Android WebViews of that version). Older engines can't render the UI.

  • Chromium in kiosk mode:

    chromium --kiosk --noerrdialogs --disable-session-crashed-bubble \
             --incognito http://<host>:8090/d/<id>
    
  • The kiosk view hides all chrome. A faint grid button in the top-right corner opens a switcher between dashboards, the editor and the manage page.

  • If Home Assistant goes down, the kiosk shows a small reconnecting pill and heals itself — no page reload needed. The browser WebSocket also auto-reconnects with backoff.

  • Dashboard edits show up on open kiosks as they are saved, and a kiosk follows a rename to the new URL. A kiosk browser started with the old URL (or an installed app) still needs the new one, as renaming changes it.

  • After a server upgrade, kiosk pages reload into the new version as soon as they reconnect; other open pages switch on their next navigation.

  • App assets are cached immutably by hash, so reloads only revalidate the page itself. In --incognito the cache is dropped whenever the browser restarts.

  • Optional: disable screen blanking (xset s off -dpms) and hide the cursor in your kiosk session manager.

Install as an app (PWA)

HA Dash can be installed like an app: Install app in Chrome/Edge, Add to Home screen on Android, or Share → Add to Home Screen in iOS Safari.

  • Install from a dashboard's kiosk page (/d/<id>) to get that dashboard as its own app, named after it and opening full screen. Install from the manage page to get the whole app. Renaming a dashboard changes its URL, so reinstall it afterwards.
  • A service worker caches the app's own files (never dashboard state, which always arrives live). If the server is unreachable when the app opens, it waits and loads the dashboard once the server is back, instead of showing a browser error page. Kiosk pages switch to a new version when they reconnect after an upgrade; other pages on their next navigation, launch or reload.
  • Browsers only allow installation and the service worker over HTTPS (or localhost). On a plain http://<lan-ip> URL, Chrome won't offer Install app and the app runs without a service worker. To get both, serve HA Dash through your HTTPS reverse proxy.

Security notes

  • The long-lived HA token is stored only in the SQLite DB under ./data on the server and is never sent to any browser.
  • The admin UI has no authentication (LAN-trusted model, like most HA add-ons). If you expose the port beyond your trusted network, put it behind a reverse proxy with auth.
  • Other websites can't drive it through your browser: API writes and the live WebSocket must come from the dashboard's own origin. A reverse proxy must therefore pass the original Host header through (nginx: proxy_set_header Host $host;).
  • Changing the Home Assistant URL requires re-entering the token, so the saved token can't be redirected to another host.
  • The container: distroless (no shell, no package manager), non-root 10001:10001, read-only rootfs, all capabilities dropped, no-new-privileges, tmpfs on /tmp.
  • Service calls are allow-listed: only light/switch domains with toggle/turn_on/turn_off (plus brightness_pct/transition data).

Configuration

The compose file hardening flags at a glance:

flag purpose
user: "10001:10001" never runs as root
read_only: true + tmpfs /tmp immutable root filesystem
cap_drop: [ALL] no Linux capabilities
security_opt: no-new-privileges blocks privilege escalation
volumes: ./data:/data SQLite + settings live here
healthcheck uses /server healthcheck (distroless has no curl/wget)

Environment variables: PORT (default 8080), DATA_DIR (default /data in the container, ./data for local dev).

Development

make test      # go test + web typecheck
make lint      # go vet, gofmt check, web typecheck
make mockha    # fake Home Assistant on :8123 (token: mock-token)
make dev       # build web UI + run Go server on :8080
make web-dev   # Vite dev server on :5173 (proxies /api to :8080)

The mock HA implements the real WebSocket protocol (auth handshake, subscribe_entities, state diffs, service calls) with five entities and random state changes every few seconds — ideal for developing without a real instance.

Troubleshooting

  • permission denied writing dash.db — the ./data bind mount is root-owned. Run the chown 10001:10001 step from Quick start.
  • SELinux hosts (Fedora/RHEL) — if SQLite still fails to write despite correct ownership, append :Z to the bind mount: - ./data:/data:Z.
  • HA connection failed on the setup page — check the URL scheme and port (must be the HA web URL, not the add-on internal one), and that the token was not revoked.
  • Dashboard unreachable from the kiosk — check the host firewall (ufw allow 8090). Note that Docker-published ports bypass ufw INPUT rules, so also verify the port is bound to the right interface.
  • States are stale — the pill in the top bar shows the connection status; hover it for the last error. The server keeps retrying with exponential backoff.

Architecture

  • cmd/server — entrypoint + healthcheck subcommand
  • internal/ha — Home Assistant WebSocket client: auth handshake, subscribe_entities diff parsing (a/c/r compact format), reconnect with backoff, service calls over the REST API
  • internal/ws — hub: fans out snapshots + diffs to browsers, filters to light/switch domains
  • internal/api — REST API + embedded SPA serving (Go 1.22+ mux patterns)
  • internal/store — SQLite (pure-Go driver, WAL mode)
  • web — Vue 3 + TypeScript + Tailwind CSS 4 + shadcn-vue (reka-ui) + grid-layout-plus
  • tools/mockha — mock Home Assistant for development and testing