Gergő’s Lab / Documentation
← All documentation
Under the hood / PREVIEW 0.2

Architecture & data flow

Adapters, event bus, command layer, pure state model and the boundary between simulated and measured data.

Updated 24 September 2026 · Versioned with the application

Two explicit environments

The HomeOS preview owns simulated household state. Lab Control presents real, read-only website checks. A green lamp in the preview says nothing about the server, and a failed website check never changes a simulated device.

The public UI carries no Home Assistant credentials. No physical lock, appliance or automation can be operated from the demo.

The preview data flow

The browser creates a HomeState with 15 controllable or observable entities, four automation rules and a scripted household timeline. A pure reducer applies each action and returns the next state. The session layer retains the most recent 120 snapshots.

Device control / Ask HomeOS / simulation tick
                    ↓
              Command or action
                    ↓
            State model + automation rules
                    ↓
        Updated devices + events + power estimate
                    ↓
             Workspace + session history

The adapter names describe the intended source of an event. In this preview they are labels on generated events, not live network connections. The event bus keeps the latest 40 messages. The device inspector derives state changes from retained snapshots, rather than claiming every tick was a physical observation.

The command layer

Ask HomeOS maps supported phrases to a small set of tools. A tool call changes the same state that the controls use. The developer inspector exposes the exact arguments. Unknown phrases return help and do not run arbitrary commands.

An eventual model-backed assistant would need validated arguments, permission checks and an execution boundary before connecting those tools to actual devices. That integration is planned, not present in this preview.

Real monitoring data flow

Scheduled collector → fixed public HTTP / HTTPS endpoints
         ↓
Bounded history in a persistent Docker volume
         ↓
Read-only application mount → filtered status API
         ↓
Lab Control, refreshed every 30 seconds

The collector probes independently of visitor traffic. Opening the dashboard does not launch an extra probe. The application does not expose a target URL parameter or relay arbitrary requests.

Where the code lives

  • src/lib/homeos.ts: devices, commands, automations and simulation.
  • src/lib/homeos-session.ts: session snapshots and device history.
  • src/components/homeos/: workspace, inspector and documentation search.
  • src/content/homeos/: versioned Markdown handbook.
  • deploy/monitor.mjs: scheduled website collector.
  • src/lib/monitoring.ts: validation, coverage and public summaries.

For the planned real device connection, Home Assistant provides an authenticated WebSocket API. That connection belongs behind a server-side adapter, not inside a public visitor’s browser.

Go somewhere

Tab to move · Enter to open · Esc to close