Install the module, get a token and send a first command.
Home Assistant, typed, in Go.
Control Home Assistant over REST, WebSocket or MQTT, and serve your own devices through MQTT discovery. One package per entity domain, generated from Home Assistant's own code.
Two directions, one set of types
The same climate package drives a thermostat Home Assistant already has, and creates one that Home Assistant discovers.
Control an entity
thermostat := climate.Get(client, "living_room")
state, err := thermostat.State(ctx)
err = thermostat.SetHVACMode(ctx, climate.HVACModeHeat)
err = thermostat.SetTemperature(ctx, 21.5)Serve a device
device, err := climate.NewDevice(ctx, mqttClient, "hvac",
climate.WithName("Living Room HVAC"),
)
device.OnTemperatureCommand(func(ctx context.Context, t float64) error {
return device.ReportTargetTemperature(ctx, t)
})Guides
The code in them is compiled and run by the test suite.
Read, command and watch entities over HTTP or MQTT with the same calls.
Announce entities through MQTT discovery and answer Home Assistant's commands.
What the client reads, which topics it needs, and its limits.
Call Home Assistant's APIs directly and subscribe to events.
Reconnects, errors that have no caller, ordering and broker limits.
Fake Home Assistant above the wire or at it.
How the reference stays true
The entity pages are built from the generated Go code on every change.
From Home Assistant's code
The packages are generated from what Home Assistant core declares, at one pinned release. A nightly job reports where the newest release differs.
Nothing left off
The build fails if an exported name is missing from its page. Each page also lists the services that have no method, with the reason.
Official pages linked
Home Assistant's documentation is linked, not copied. A check fetches those links on every change.