Home Assistant

@webship.co/workspace-home-assistant 1.0.0 · github.com/webship/workspace-home-assistant · npm

Home Assistant logo

Home Assistant for the Webship Workspace dashboard. It brings:

  • a builder that runs Home Assistant, the open-source home automation platform, from its official image in a container of its own, and does its first run;
  • the Home Assistant step pack wired into the testing setup of that app;
  • its AI items: two agents, a skill, a command and two prompts for building and testing Home Assistant apps, each listed in the workspace folder of its kind.

An app runs Home Assistant's official Container image, pinned by digest:

  • 2026.11.3, the latest, by default;
  • 2026.5.4, six months before it, with --release 2026.5.4.

Its configuration is the project's config/ folder: what Home Assistant's own docs call /config. Nothing of Home Assistant runs on the machine: what the builder asks of the app (its onboarding, its restart, its backups and their restore) runs in the app's own container, with the image's own Python, through the app's own API.

The workspace is container-based (DDEV by default). An app is a row like any other, so the row menus the core draws (start, stop, launch, backup, restore, remove, tests) work on it. Its Backup and Restore go through the plugin's own database hook, with Home Assistant's own backups.

The builder builds on DDEV by default, and with --runtime on Docker Compose, Podman or a Kubernetes cluster: see Runtimes. It needs Webship Workspace 1.0.42 or newer, the core with the database hook (webship/workspace#937), and says so on an older one before it makes anything.

Use it

cd ~/workspace
bash core/scripts/plugins.sh --require home-assistant --with-needs     # npm install into the dashboard
bash core/scripts/plugins.sh --activate home-assistant --with-needs    # plugins.home-assistant in settings.yml
bash core/scripts/plugins.sh --install home-assistant                  # the builder, functions, args, AI items, its settings file
bash core/scripts/plugins.sh --configure home-assistant                # its settings: the demo, analytics

The same four steps are buttons on the dashboard's Settings → Plugins page. --install is idempotent. --uninstall removes what it placed; an AI item you edited stays.

Everything the plugin carries lands in the folder it belongs to, when that folder is an active workspace folder:

What Lands in
cmd-home-assistant-project.sh every active sites folder: dev/, test/, sandboxes/, demos/
The agents home-assistant-app-builder, home-assistant-tester ai-agents/
The skill home-assistant-scenarios ai-skills/
The command /home-assistant-test ai-commands/
The prompts home-assistant-build-and-test, home-assistant-scenarios-for-an-app ai-prompts/
Its settings, plugin.home-assistant.settings.yml core/config/ (once; never overwritten)

There they are listed like any other item of the folder, and installed into Claude Code from there.

What it needs

A workspace starts empty, so the manifest says what else this plugin needs (needs):

  • One sites folder, for the builder: dev, test, sandboxes or demos (dev is the one added when none is there). The folder also carries cmd-tools-testing.sh, the Users tools and the backup script this plugin's hooks answer to.
  • ai-agents, ai-skills, ai-commands and ai-prompts: the AI folders its agents, its skill, its command and its prompts are placed in.

--require says so, --activate and --install stop until the workspace has them, and --with-needs adds what is missing first:

bash core/scripts/plugins.sh --activate home-assistant --with-needs   # dev and the four AI folders are required, activated and installed first
bash core/scripts/plugins.sh --install home-assistant

Everything the builder runs for an app runs in its own container, through the container tool the workspace already needs; the plugin asks for no command of its own on the machine.

What the package holds

Path What it is
commands/cmd-home-assistant-project.sh The builder, in the Build list as Home Assistant (home automation), installed into every sites folder
scripts/functions/fun-home-assistant.sh The bash functions behind it, sourced by bootstrap once installed. They hold the names the core's tools look for (set_homeassistant_users, add_homeassistant_users, cancel_homeassistant_users, testing_configure_homeassistant) and the database hook (homeassistant_is_project, homeassistant_export_db, homeassistant_import_db, homeassistant_db_extension).
scripts/args/arg-home-assistant.sh Its argparse; the Build form draws the builder's flags from it
scripts/docker-compose.home-assistant.yaml On DDEV, the app's service, copied into the project's .ddev/
scripts/home-assistant-serve.sh How the app runs without the image's s6: its first start's configuration, its restarts, its stop (see Its restarts and its stop)
scripts/home-assistant-app.py What the builder asks of the app, run in its container: its onboarding, its restart, its backups, the check of a backup, its restore
config/plugin.home-assistant.settings.yml The template of its settings file
testing/site.feature The first feature an app gets when testing is set up
ai/agents/home-assistant-app-builder.md The agent that builds and fixes apps: their container, their configuration and backups, their owner
ai/agents/home-assistant-tester.md The agent that writes and runs scenarios with the step pack
ai/skills/home-assistant-scenarios/ The skill: the step pack's phrases, the traps, five example features
ai/commands/home-assistant-test.md The slash command /home-assistant-test <app>: set up when missing, match every step, run, report
ai/prompts/home-assistant-build-and-test.md, home-assistant-scenarios-for-an-app.md Two prompts: whole launch commands for a new session
src/index.ts register(api): what the assistant is told about Home Assistant here
features/home-assistant.feature, features/home-assistant-runtimes.feature Scenarios for the dashboard's own browser suite

The workspacePlugin block in package.json is the manifest the installer reads. Its functions and its claim on a project are named homeassistant (a bash function takes no dash): cmd-tools-add-users.sh <name> homeassistant.

What is different from a platform

WordPress (a platform) Home Assistant
What is built A WordPress site A Home Assistant app, 2026.11.3 (or 2026.5.4), with its owner and the demo's devices
Project --project-type=wordpress --project-type=generic --webserver-type=generic, DDEV's database omitted: Home Assistant's own server serves it, on its own recorder database
The image The container tool's Home Assistant's official image, pinned by digest, run without its s6
Its data — The project's config/ folder: its configuration, .storage/ and the recorder's SQLite, so they go with the project's backup
Recognised by The project type On DDEV a file the builder writes, .ddev/config.home-assistant.yaml; on another runtime its claim, platform: homeassistant in the x-webship block of compose.yaml
Accounts WP-CLI The app's own onboarding: its owner, through the calls its onboarding pages make
Backup and Restore DDEV's export-db and import-db The plugin's database hook: Home Assistant's own backups, checked before Home Assistant's own restore puts one back
Testing The WordPress pack The Home Assistant pack, which turns devices on and off from their details and tiles, and waits on the app's own state

The commands

Run it from a sites folder. --help is safe.

Build and serve an app

cd ~/workspace/dev
bash cmd-home-assistant-project.sh home --install --add-users                      # Home Assistant 2026.11.3, started, with its owner
bash cmd-home-assistant-project.sh home --install --add-users --release 2026.5.4   # the line six months before
bash cmd-home-assistant-project.sh home --install --add-users --runtime docker     # on Docker Compose instead of DDEV
bash cmd-home-assistant-project.sh home --install --runtime kubernetes             # on the workspace's Kubernetes cluster
Flag What it does
--install Start the app (its first start writes its configuration, see below) and check that it serves its pages at its address (https://<name>.ddev.site on DDEV)
--add-users Do its onboarding too, which makes its owner (see Its owner)
--release 2026.11.3|2026.5.4 The release to run, each from its official image pinned by digest (default: 2026.11.3)
--runtime ddev|docker|podman|kubernetes The container runtime to build on (default: DDEV, or container.runtime of settings.yml); see Runtimes
--launch Open the app in a browser when it is ready

The builder works in this order:

  1. It deletes a project of the same name first: its containers and its configuration.
  2. It makes the project with its empty config/ folder and configures it.
  3. It writes its own folder, .webship-home-assistant/ (only you can read it): the release it runs, the app's serve.sh, the script it runs in the app's container, and its additions to the app's configuration.
  4. With --install, it starts the app and waits until it serves its pages. Its first start writes Home Assistant's own default configuration (its ensure_config script), then the builder's additions to it:
    • on DDEV, http:, with the addresses of the container networks as trusted proxies: DDEV's router sends the project's address to the app and says who asked (X-Forwarded-For), which Home Assistant refuses from a proxy it does not trust ("400: Bad Request"). On the other runtimes nothing stands in front of the app, and no http: is written;
    • demo:, the demo integration, as the plugin's settings say (on by default).
  5. With --add-users, it does the app's onboarding: its owner, the core configuration as the app has it, analytics as the settings say, the integration step. On DDEV it then keeps the builder's HTTP configuration where the app's release keeps it (see below). Then it checks the app: it runs, its owner signs in, and the demo's devices are in.

The HTTP configuration on 2026.11. Home Assistant 2026.11 keeps its HTTP configuration in a store of its own, set in its pages. It takes http: from configuration.yaml once, at its first start, as a configuration on trial: the app asks its owner to keep it, and goes back to its own defaults after 5 minutes when nobody does (it restarts on them, and DDEV's router gets "400: Bad Request"). It reads http: from configuration.yaml no more after that, and lists the lines as a repair ("The HTTP YAML configuration is deprecated", then "HTTP YAML configuration is ignored after migration"). So on DDEV the builder's onboarding keeps the trial, as the app's own dialog does (http/config/promote), takes its http: lines out of configuration.yaml, and restarts the app on its store. Built without --add-users, the app asks its owner after the onboarding on its first page; cmd-tools-add-users.sh <name> homeassistant keeps it too, and puts it back when its 5 minutes went by. 2026.5 takes http: from configuration.yaml, where the lines stay.

Its restarts and its stop

Home Assistant's image starts it through s6, as root, and s6 starts it again when it asks for a restart: it exits with code 100, from a restart in its settings and from the restore of a backup. The builder runs it as the project's user without s6, so .webship-home-assistant/serve.sh does what s6 did:

  • A restart. It starts Home Assistant again when it exits with code 100, and only then.
  • A stop. A stop from the runtime (the row's Stop, ddev stop, a pod deleted) is passed on to Home Assistant once, with TERM, and serve.sh waits for it. Home Assistant shuts down as it does under s6, its recorder closing the database, and its own exit code passes out.
  • Anything else. Any other end of Home Assistant ends the container, with its exit code. On DDEV a crash brings the container back (restart: on-failure), and an init passes the stop on to serve.sh (init: true).

Proven on DDEV, Docker Compose, Podman and Kubernetes, through the runtime menu's own verbs:

  • Home Assistant's own restart (homeassistant.restart, through its API): it went down and was running again 6.2 to 6.8 s after the request, and its log said once "Home Assistant asked for a restart (exit code 100): it starts again." The restore of a backup restarts it twice, and both held.
  • A stop (runtime-verb.sh stop, the menu's Stop):
    • serve.sh passed it on once ("Home Assistant is asked to stop: it shuts down.");
    • Home Assistant shut itself down in 1.12 to 1.26 s, and its own exit code came back ("Home Assistant stopped (exit code 0).");
    • after it, the recorder's database passed PRAGMA integrity_check, its last run had been closed by Home Assistant itself (closed_incorrect 0), and no -wal was left;
    • at the next start, Home Assistant found nothing to say about the last shutdown.
  • The window off DDEV. On DDEV the app's service has an init, and nothing is cut. On Docker Compose, Podman and Kubernetes the core's web container starts the app's server under runuser, which ends the container 2 seconds after a stop ("Session terminated, killing shell... ...killed."). Home Assistant's own shutdown took 1.12 to 1.16 s on those three.

Off DDEV, until webship/workspace#983 is fixed, a stop gives Home Assistant 2 seconds. It is usually done in about 1.2 s. A stop during its start, or under load, can take longer, and then its recorder's session is cut: at its next start Home Assistant says "The system could not validate that the sqlite3 database … was shutdown cleanly" and "Ended unfinished session". The database itself stays whole (PRAGMA integrity_check: ok), but the last states before the stop can be missing from its history. Seen in a review: a stop 12 s after a restart was killed 2 s after it.

Its configuration and its backups

The configuration is the project's config/ folder: /var/www/html/config in the app's container on every runtime. It holds:

  • configuration.yaml and the files it includes (automations.yaml, scripts.yaml, scenes.yaml);
  • .storage/: the accounts, the devices, the areas, the dashboards, the helpers;
  • the recorder's SQLite database, home-assistant_v2.db, with the -wal and -shm the app keeps open beside it.

On DDEV the app runs as the project's user, so these are the project's own files. On the other runtimes the web container runs it as the same user.

The row's Backup archives the project's folder, so the archive holds config/. Its database files are the live ones, taken as they were mid-write: the recorder writes the states and the events of every device as they change, and a file copied while it is written can hold half of a change. So the plugin declares the core's database hook (webship/workspace#937, core 1.0.42), which the row's Backup and Restore ask first, on every runtime:

  • Backup writes one of Home Assistant's own backups beside the archive (<archive>-db.tar): the app makes it as its Backups page makes one, the whole of config/ with the recorder's database, taken while the recorder holds its writes. It is not protected by a password. The builder copies it out of config/backups/ and takes it out of the app's own list again, so the app's backups do not pile up in the project. A stopped app is started for it and stopped again after it.
  • Restore from the backups list puts the archive back, starts the project, then imports that backup, over the archive's files: the -db.tar beside the archive is what a Restore ends with, not the archive's database files. The row's Import does the same with a backup you choose. Either works in this order:
    1. It checks the backup: a tar that holds its backup.json, then, by the app's script in its container, the whole backup read (its homeassistant.tar.gz to its end, with gzip's own check), not protected by a password, and of a release not newer than the app's (Home Assistant restores a backup of its own release or an older one). A backup that is not leaves everything as it was.
    2. It uploads it to the app's backups, as the Backups page does, and asks Home Assistant to restore it with its database. Home Assistant restarts to restore it (serve.sh starts it again), reads the whole backup into a folder of its own first, then puts it in place of config/, but for config/backups/, and starts on it. A backup it cannot read leaves config/ as it was.
    3. Once the app answers and its owner signs in, the uploaded copy is taken out of its backups again.

After a restore Home Assistant says once that it "could not validate that the sqlite3 database … was shutdown cleanly", and ends the session the backup holds ("Ended unfinished session"). Its backups are taken from the running app, its recorder's session open: that is its own restore at work, not a damaged database (PRAGMA integrity_check stays ok).

A name ending in .gz (the safety dump the core takes before a remove or a clone asks for a .sql.gz) gets the same backup, gzipped: the plugin's import reads both, under any name.

On a terminal, in the project's folder:

cd ~/workspace/dev/home
bash ~/workspace/core/scripts/runtime-verb.sh export-db --file=../home-before.tar
bash ~/workspace/core/scripts/runtime-verb.sh import-db --file=../home-before.tar

Proven with the row's own actions: the Backup and the Import on all four runtimes, the Restore from the backups list on DDEV and Docker Compose:

  • Backup:
    • the archive held config/, home-assistant_v2.db with its -wal and -shm among it;
    • the plugin's backup beside it (1.4 MB: backup.json and homeassistant.tar.gz) held the automation the app had;
    • the app's own config/backups/ was empty again after it.
  • The row's Import: an automation added after the Backup, the Import put the backup back (Home Assistant restored it in 8.5 s), with the core's export of the app as it was taken first. The app then listed the one automation.
  • The Restore from the backups list ends with the plugin's backup, not with the archive's files:
    • an automation was added after a Backup, and a second Backup taken;
    • the backup beside the second archive was then made the first Backup's, so the archive's own automations.yaml held both automations and the backup beside it one;
    • after the row's Remove, the Restore of the second archive from the backups list ended with the backup's one automation.
  • Across the lines (DDEV): a 2026.11.3 backup is refused by a 2026.5.4 app ("…is a backup of Home Assistant 2026.11.3, newer than this app's 2026.5.4: an app restores a backup of its own release or an older one."), which keeps its configuration. A 2026.5.4 backup goes into a 2026.11.3 app: Home Assistant restores it and migrates it as it starts, takes the http: lines it brings on trial, and the restore keeps them in its store and takes them out of configuration.yaml.

Its settings: the demo and analytics

core/config/plugin.home-assistant.settings.yml holds two settings the builder applies to each app it makes:

Setting Default here Home Assistant's default What it is
demo "on" off The demo integration: lights, switches, a lock, covers, sensors and more, without hardware, the devices the step pack's scenarios turn on and off. "off" makes an app with only the devices added to it.
analytics "off" off, asked at the onboarding Home Assistant's analytics send what an app runs to its makers once a day. Off here: no call out of a test workspace. "on" turns on its basic analytics at the onboarding.

Both can be changed later in the app itself: the line demo: in config/configuration.yaml; Settings, System, Analytics.

Test an app

bash cmd-tools-testing.sh home                                  # webship-js, the step pack, the account, a first feature
bash cmd-tools-testing.sh home --run --path tests/features/site.feature

The testing setup does four things:

  • adds @webship-js/home-assistant-steps to the project, with webship-js 2.0.20 or newer, and lists the pack's step definitions in cucumber.js;
  • gives the suite the app's address;
  • adds the account the scenarios name: admin, its password from HA_ADMIN_PASSWORD (the workspace's by default), as the pack's own tests take it;
  • writes tests/features/site.feature.

It changes nothing in a project that is not an app of this builder.

Every page of the app needs JavaScript. Its REST API answers without it.

Feature: The first devices
  Scenario: A light of the demo turned on and off from its details
    Given I am signed in to the smart home as "admin"
    When I turn "Bed Light" on
    Then "Bed Light" should be on
    When I close the device's details
    And I turn "Bed Light" off
    Then "Bed Light" should be off

Runtimes

The commands are the same on every runtime. The builder speaks DDEV's verbs, and on another runtime the core's layer gives each verb its meaning there (webship/workspace#694 and #841):

  • the app's image is the stack, without its s6 (ENTRYPOINT []): the runtime's own start runs as it is;
  • the web container runs the builder's serve.sh as the host user, its configuration in the project's config/.
Runtime The address of the app Where the configuration is Proven with this builder
DDEV (the default) https://<name>.ddev.site <project>/config (the app's /var/www/html/config) Built and served in 29 to 34 s with the image already pulled, the app a service of the project and DDEV's db omitted; its onboarding and owner made by the builder, the HTTP configuration kept in the app's store and its lines taken out of configuration.yaml; its first page and its API answered through DDEV's router, the files the project's user's; Home Assistant's own restart, a stop and the database after it (see Its restarts and its stop); the row's Backup and Import, and the Restore from the backups list (see Its configuration and its backups); the testing setup from npm (home-assistant-steps 2.0.0, webship-js 2.0.20) and its first feature (3 scenarios, 17 steps), twice; the skill's five examples (10 scenarios, 62 steps)
Docker Compose (--runtime docker) http://127.0.0.1:<port>, a free port kept in compose.yaml <project>/config (in the web container: /var/www/html/config) Built in 13 to 17 s, the web image built on the app's; the same checks, with no http: lines and Home Assistant's own HTTP configuration; its own restart and a stop; the row's menu with Export, Import and Backup, the same Backup and Import, and the Restore from the backups list; the testing setup and its first feature, twice; the skill's five examples
Podman (--runtime podman) http://127.0.0.1:<port> <project>/config Built in 7 min 31 s, the image taken into Podman's own storage on that first build; the same checks; its own restart and a stop; the row's menu with Export, Import and Backup, and the same Backup and Import
Kubernetes (--runtime kubernetes) http://<node address>:<NodePort> <project>/config too: the web pod mounts the project's folder by hostPath (see below) On kind: built in 6 min 13 s (the web image built by Docker on the app's image and loaded into the node), served at the node's address; the same checks; its own restart and a stop, the pod's log read through the cluster; the row's menu with Export, Import and Backup, and the same Backup and Import; the recorder's database the app wrote in its pod read from the project's folder on this machine; the testing setup on the cluster and its first feature, twice

On Kubernetes the configuration is in the project too. The web pod mounts the project's folder at /var/www/html by hostPath, and the app's configuration is its config/. The workspace's kind cluster has /home mounted into its node at the same path (and the workspace's root when it lives elsewhere), so the hostPath is the project's folder on this machine: the database the app writes in its pod is <project>/config/home-assistant_v2.db here, and the row's Backup archives it, as on the other runtimes. On a cluster of your own (WORKSPACE_KUBE_CONTEXT), the hostPath is a folder of the node the pod runs on: the configuration is in this machine's project only when that node sees this machine's folder at the same path.

A project of the builder is known by DDEV's file on DDEV and by its claim on another runtime. So the testing setup, the Users tools, the database hook and the dashboard's row work the same on each. Lando and Docksal are runtimes of the workspace too, not proven with this builder yet: it says so and stops, before anything is made.

Its owner

Account Made by
admin ("Webship admin") --add-users, or cmd-tools-add-users.sh <name> homeassistant: through the app's own onboarding, as its onboarding pages make it

The owner is the app's first account. It gets the workspace's password, which the builder never prints: it reaches the onboarding on the script's input, never on a command line. On an app that has its owner already, cmd-tools-add-users.sh says so and checks that the password signs it in; when it does not, it says so and changes nothing (the password is changed in the app: the profile, Security).

cmd-tools-cancel-users.sh <name> homeassistant changes nothing: the owner can be neither removed nor kept from signing in, and it says so.

What the onboarding leaves

The builder's onboarding is the app's own, through its API, without the onboarding pages' map. So:

  • The home is not placed on a map: the weather integration the onboarding adds (Met.no) does not set up ("No home location has been set") until it is, in Settings, System, General.
  • No country is set: Home Assistant lists the repair "The country has not been configured" until it is, in the same place.
  • The onboarding also adds the integrations it adds for a person (Google Translate text-to-speech, Radio Browser, Shopping List).

The AI items

Item Kind What it is for
home-assistant-app-builder agent Builds and fixes Home Assistant apps: their container, their configuration and backups, their owner, their restarts, what to read when one does not answer
home-assistant-tester agent Writes and runs scenarios with the step pack: signing in, devices by their names, helpers and automations, notifications and the activity, the API, test content deleted, never a fixed wait
home-assistant-scenarios skill The step pack's phrases, the traps of the two lines, five example features
/home-assistant-test <app> command Sets the pack up when missing, matches every step, runs, reports
home-assistant-build-and-test prompt Builds an app and proves it with its first feature
home-assistant-scenarios-for-an-app prompt Writes and runs the scenarios of an app of the workspace: its devices, its helpers and automations, its notifications, its API

Every item says the workspace is container-based (DDEV by default), and the agents and the skill send the reader to the book Automated Functional Testing Recipes first.

Develop it

npm install
npm test        # builds, then the unit tests: the manifest, the scripts (serve.sh run with a stand-in app), the AI items, the needs
npm run lint    # the TypeScript compiler, no output

CI runs the same on Node.js 24 and 26, and checks that every shell script parses. It also runs the plugin's webship-js features against a dashboard with the plugin installed (the reusable workflow webship/workspace/.github/workflows/plugin-browser-suite.yml):

  • before the features it builds the app the manifest names (featuresSite: cmd-home-assistant-project.sh ci-home-assistant --install --add-users --runtime docker);
  • so the scenarios of features/home-assistant-runtimes.feature tagged @needs-runtime-docker drive a real app on Docker Compose;
  • the Podman and Kubernetes ones run where such an app is.

tests/fixtures/step-definitions.txt holds the step definitions of the step pack and of webship-js, read from their packages: every phrase an AI item shows must match one of them.

License

ISC (see LICENSE).

The logo is Home Assistant's mark from Simple Icons (homeassistant, CC0-1.0), filled with the colour Simple Icons lists for the brand, #18BCF2, so it reads on a light and a dark page. Home Assistant and its mark are the Open Home Foundation's: the logo names the software the plugin builds. It is not covered by this package's licence.