Skip to content

Updated

View MarkdownOpen in ChatGPTOpen in Claude

Getting Started

A widget is a SolidJS component + a Zod config schema, wrapped with defineWidget. The dashboard renders the component, auto-generates the settings form from the schema, and feeds in entity state.

Scaffold

`bunx @glasshome/widget-cli@latest` (no args). Creates a project and your first widget.

Hot-reload

`bun widget connect <dashboard-url>` rebuilds on save and re-uploads to a running dashboard.

Publish

`bun widget publish` to Hub. Pick personal or organization scope.

Inside a scaffolded project, bun widget <cmd> works (the CLI is pinned in devDependencies, with a widget script alias to glasshome-widget); elsewhere use bunx @glasshome/widget-cli@latest <cmd>. Full command list: Widget CLI.

Prerequisites

Tool Version Notes
Bun 1.0+ CLI engines field requires bun >=1.0.0
Node.js 18+ Required by @glasshome/widget-sdk (engines.node >= 18); Bun’s bundled Node compatibility layer satisfies this

Scaffolded projects ship a .mise.toml pinning the versions. Install mise and run mise install.

Quickstart

  1. 1

    Scaffold a project

    bunx @glasshome/widget-cli@latest
    cd <project-name>

    Generates package.json, vite.config.ts, tsconfig.json, the widget script alias, and your first widget (prompts for name + description).

  2. 2

    (Optional) add more widgets

    bun widget add

    Prompts for name and description, creates src/<name>/index.tsx and src/<name>/manifest.json.

  3. 3

    Connect to a running Dash instance

    bun widget connect http://homeassistant.local:3123

    Builds, runs an OAuth device-code flow against your local Dash instance (not Hub), uploads each bundle to the Dash API under the local scope, then watches src/, re-uploading on save. With Developer Mode on in Dash Settings, widgets refresh without a page reload.

  4. 4

    Publish

    bun widget publish

    publish runs login automatically the first time. See Publishing.

Project layout

my-widgets/
├── package.json
├── vite.config.ts
├── tsconfig.json
└── src/
    ├── my-widget/
    │   ├── index.tsx          # Component + defineWidget
    │   └── manifest.json      # Widget metadata
    └── another-widget/
        ├── index.tsx
        └── manifest.json

One widget per directory under src/. Build outputs one self-contained JS bundle per widget plus a registry.json in dist/.

Mental model

  • The dashboard handles rendering, gestures, theming, entity subscriptions, settings forms, and layout. Your widget supplies how the bound entities are visualized and what the primary tap does.
  • No settings UI to write: define a Zod schema; the dashboard renders the form.
  • No WebSocket state to manage: useEntity / useEntities read the entity ids the user picked in config and stay reactive; useWidgetEntityGroup aggregates them and supplies an empty state.
  • No Home Assistant connection or token to hold: all reads and service calls go through SDK hooks, checked against your declared capabilities.

Versions at a glance

Version type Where it lives Who bumps it What breaks without it
SDK version (sdkVersion) manifest.json, as a semver range (e.g. ^1.0.0) bun widget publish derives it from the built bundle (CLI 0.19 and later; older CLIs had bun widget upgrade rewrite it) Dash refuses to load a widget whose range excludes its SDK and asks the home to update; a range floored too low lets an older Dash install a widget that crashes
Widget version (version) manifest.json --bump flag on bun widget publish Re-publishing the same version is rejected (409)
Config version (configVersion) manifest.json, integer You, when config shape has breaking changes Without a bump, users’ saved configs aren’t migrated and may fail Zod parse
CLI minimum (Hub-enforced) Served by Hub at /api/widgets/cli-version Hub (I bump it on protocol changes) login/publish hard-stop if CLI is below the floor
CLI 0.19+

Which Dash runs your widget

Each Dash release ships one widget SDK. A widget whose sdkVersion range is above that SDK installs on a later Dash. The Hub serves this table at /api/widgets/dash-releases, and widget publish uses it to say which Dash versions a widget reaches.

DashChannelWidget SDKUISync layer
1.5.1stable1.34.21.46.00.12.14
1.5.0stable1.34.21.46.00.12.13
1.5.0-rc.7rc1.34.21.46.00.12.13
1.5.0-rc.6rc1.34.11.45.00.12.13
1.5.0-rc.5rc1.33.11.44.60.12.12
1.5.0-rc.4rc1.33.11.44.60.12.12
1.5.0-rc.3rc1.33.01.44.30.12.11
1.5.0-rc.2rc1.32.11.39.00.12.8
1.5.0-rc.1rc1.32.11.39.00.12.8
1.5.0-beta.7beta1.27.01.35.40.12.6
1.5.0-beta.6beta1.25.21.35.10.12.6
1.5.0-beta.3beta1.23.11.34.00.12.2
1.5.0-beta.2beta1.23.11.34.00.12.2
1.5.0-beta.1beta1.23.11.33.20.12.1
1.4.5stable1.23.11.33.20.12.1
1.4.4stable1.22.21.31.00.11.6
1.4.3stable1.22.11.29.10.11.6
1.4.2stable1.22.11.29.10.11.6
1.4.1stable1.22.11.29.10.11.6
1.4.0stable1.22.11.29.00.11.6
1.4.0-beta.15beta1.22.11.28.00.11.6
1.4.0-beta.14beta1.22.01.27.00.11.6
1.4.0-beta.13beta1.22.01.26.20.11.6
1.4.0-beta.12beta1.22.01.26.00.11.6
1.4.0-beta.11beta1.21.01.25.00.11.6
1.4.0-beta.10beta1.20.11.24.00.11.5
1.4.0-beta.9beta1.20.01.22.10.11.5
1.4.0-beta.8beta1.20.01.22.10.11.4
1.4.0-beta.7beta1.20.01.22.10.11.4
1.4.0-beta.6beta1.20.01.22.00.11.4
1.4.0-beta.5beta1.18.11.21.20.10.2
1.4.0-beta.4beta1.15.11.16.10.8.2
1.4.0-beta.3beta1.15.11.16.10.8.1
1.4.0-beta.2beta1.14.31.12.00.8.1
1.4.0-beta.1beta1.14.31.11.00.8.1
1.3.1stable1.14.31.10.10.8.1
1.3.0stable1.14.31.9.00.8.1
1.3.0-beta.8beta1.14.31.9.00.8.1
1.3.0-beta.7beta1.14.31.8.00.8.1
1.3.0-beta.4beta1.14.11.7.00.8.0
1.3.0-beta.3beta1.14.11.7.00.8.0
1.3.0-beta.2beta1.14.11.7.00.8.0
1.3.0-beta.1beta1.13.01.6.00.8.0
1.2.0stable1.12.01.5.00.7.2
1.2.0-beta.1beta1.12.01.5.00.7.2
1.1.3stable1.11.01.3.00.7.2
1.1.2stable1.10.21.3.00.7.2
1.1.1stable1.10.21.3.00.7.2
1.1.0stable1.10.21.3.00.7.2
1.1.0-beta.7beta1.10.21.3.00.7.2
1.1.0-beta.6beta1.10.21.3.00.7.2
1.1.0-beta.5beta1.10.11.3.00.7.1
1.1.0-beta.4beta1.10.01.3.00.7.0
1.1.0-beta.3beta1.9.21.3.00.6.0
1.1.0-beta.2beta1.9.11.3.00.6.0
1.1.0-beta.1beta1.9.01.3.00.5.0
1.0.0stable1.5.00.5.40.3.2
1.0.0-beta.12beta1.5.00.5.40.3.2
1.0.0-beta.11beta1.4.20.5.30.3.1
1.0.0-beta.10beta1.4.10.3.30.3.0
1.0.0-beta.9beta1.4.10.3.30.3.0
1.0.0-beta.8beta1.3.00.3.20.3.0
1.0.0-beta.7beta1.2.10.3.20.2.2
1.0.0-beta.6beta1.2.00.3.10.2.2
1.0.0-beta.5beta1.2.00.3.10.2.1
1.0.0-beta.4beta1.1.10.3.10.2.1
1.0.0-beta.3beta1.1.10.2.70.2.1
1.0.0-beta.2beta1.1.10.2.70.2.1
1.0.0-beta.1beta0.5.20.2.60.1.16

A beta or release candidate Dash can run a widget before the stable one does. Homes on the stable channel get it once that Dash is released.

Known limits:

  • The table lists releases, so a home on an older Dash has to update before it gets your widget.
  • The derived sdkVersion is a minimum. It proves every name your widget imports exists on that Dash; a prop or behavior that changed since then can still differ, so try your widget on the oldest Dash its range admits.
CLI 0.15+

Building with a coding agent

Claude Code, Codex, Cursor and other coding agents build widgets that match the official ones when they read the widget guide. It ships inside @glasshome/widget-sdk at node_modules/@glasshome/widget-sdk/guide/widgets.md, so it always describes the SDK your project builds against.

bun widget create points your agent at it: a Claude skill in .claude/skills/glasshome-widget/ and a section in AGENTS.md. Both only point at the guide, so a new SDK brings new guidance without touching them. In an existing project, bun widget upgrade adds them; it adds one marked section to an AGENTS.md you already have and leaves the rest alone.

bun widget build tells you when a newer SDK is out. Run bun widget upgrade and your agent reads the new guide on its next task.

Auth flows: connect vs. login

Both flows open a browser, but they authenticate against different hosts, and the resulting tokens are stored separately, never interchangeable:

Where to go next