Bibliotek ('library' in Swedish) provides common primitives and utilities for integrating with and extending the Hemtjänst platform.
The client package should be used if what you want to do is publish/control your own devices but do not care about other devices in the system.
For example, lets say you want to control devices connected to a Z-Wave network, or republish external datasources like an HTTP API as a device (e.g a temperature sensor).
The server package allows you to fetch all devices, their updates and send them commands. It does not allow for the creation of devices.
It can be used to implement things like a HomeKit bridge or to watch for and republish device data, like sensor readings, to another platform (e.g Prometheus).
Take a look at cmd/explorer
on how to
use it.
The transport/mqtt package
contains everything needed to transport device data over MQTT. It
also contains the Flags()
and MustFlags()
helpers that provide a set of flags to configure common MQTT options.
Contributions are very welcome. Do ensure you run the tests:
$ go test -race -v -coverprofile=profile.cov $(go list ./...)
...
Note that in CI the _integration_test.go
will run too. You can
run them locally as well by setting BIBLIOTEK_TEST_INTEGRATION=1
.
In order for these test to complete successfully you'll have to spin
up an MQTT broker and if the MQTT broker is not found on localhost:1883
specify a host:port
string in the MQTT_ADDRESS
environment variable.
$ env BIBLIOTEK_TEST_INTEGRATION=1 go test -race -v -coverprofile=profile.cov $(go list ./...)
...