Go to file
HomeOS Bootstrap ea9e35883b Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state
Real bidirectional MQTT so devices are live, not mock (handoff §13.3):
- Mosquitto 2 broker (auth + per-client ACLs for laravel/shelly/sidecar from day
  one); passwd generated by docker/mosquitto/gen-passwd.sh (gitignored).
- mqtt-listener daemon: subscribes `+/status/#`, parse + dispatch only (H2),
  exponential reconnect backoff, graceful SIGTERM. php-mqtt/laravel-client.
- Ingest path (H4): IngestShellyMessage resolves device by mqtt_prefix, upserts
  device_states, refreshes last_seen, broadcasts DeviceStateChanged
  (ShouldBroadcastNow) on the private `home` channel.
- Control path (H1): DeviceDriver contract + ShellyMqttDriver (command topic +
  Shelly.Reboot RPC) behind DeviceCommandService, which audits every command to
  the new `commands` table. Device detail toggles + restart route through it;
  flash reflects the real result.
- Live UI: dashboard + device pages listen via Echo (#[On('echo-private:home,
  .DeviceStateChanged')]) and re-render instantly.
- Vendor specifics isolated in Support/Mqtt + Support/Drivers (H3).

Verified end-to-end in a real browser: publishing an MQTT status turned a light
"An" on the dashboard in 3.0s with no reload, 0 console errors. R12 30/30;
15 feature tests green (incl. ingest + command audit). README/bootstrap document
the broker passwd step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 22:51:14 +02:00
app Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
bootstrap Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
config Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
database Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
docker Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
lang Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
public Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
resources Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
routes Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
storage Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
tests Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
.editorconfig Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
.env.example Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
.gitattributes Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
.gitignore Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
.npmrc Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
CLAUDE.md Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
README.md Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
artisan Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
composer.json Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
composer.lock Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
design-mockup.html Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
docker-compose.yml Phase 3: MQTT ingest — Mosquitto bus, Shelly driver, live device state 2026-07-17 22:51:14 +02:00
handoff.md Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
package-lock.json Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
package.json Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
phpunit.xml Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
rules.md Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00
vite.config.js Phase 1: bootstrap — Docker stack, Laravel 13, design system, auth 2026-07-17 21:06:20 +02:00

README.md

HomeOS

Self-built smart-home control plane — single household, self-hosted, LAN-first. Laravel 13 · Livewire v3 · Tailwind v4 · PostgreSQL 17 + TimescaleDB · Redis/Horizon · Reverb.

Everything runs in Docker; the host needs only Docker (no PHP/Composer/Node). Authoritative spec: handoff.md · conventions: rules.md · guide: CLAUDE.md.

First-run setup

cp .env.example .env                                        # dev defaults work as-is
docker compose build                                        # build the app image
docker compose run --rm app bash docker/app/bootstrap.sh    # deps + key + assets + migrate/seed
bash docker/mosquitto/gen-passwd.sh                         # broker credentials (fills empty MQTT_*_PASSWORD)
docker compose up -d                                        # start the full stack

docker compose up alone is not the first command — vendor/, node_modules, public/build and the Mosquitto passwd file are not committed, so the steps above must run first.

Then open http://localhost and sign in with the seeded dev admin:

Production

.env.example ships development defaults. For a real deployment you must:

  • set APP_ENV=production and APP_DEBUG=false (otherwise exceptions are exposed and the demo household is seeded into your real database);
  • set strong values for DB_PASSWORD, the REVERB_APP_* keys and HOMEOS_ADMIN_PASSWORD (seeding aborts if the admin password is unset outside local/testing), and run php artisan key:generate.

The demo seeder (DemoHomeSeeder) only runs in local/testing.

Everyday commands (in-container, R8)

docker compose exec app php artisan …    # artisan
docker compose exec app composer …       # composer
docker compose exec app npm run build    # rebuild assets (or `npm run dev` for HMR)
docker compose exec app php artisan test # test suite
docker compose logs -f app               # logs

Services & ports

Service Role Host port
app php-fpm + nginx + supervisor ${APP_PORT:-80}
reverb websockets (proxied same-origin via nginx /app) ${REVERB_HOST_PORT:-6001}
horizon · scheduler queue workers · cron
db PostgreSQL 17 + TimescaleDB 127.0.0.1:${DB_HOST_PORT:-5432}
redis cache / queue

All ports and HOST_UID/HOST_GID are env-driven in .env.