Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hemtjanst/bibliotek
Go library shared across Hemtjänst components
https://github.com/hemtjanst/bibliotek
domotic golang home-automation mqtt smarthome
Last synced: 4 days ago
JSON representation
Go library shared across Hemtjänst components
- Host: GitHub
- URL: https://github.com/hemtjanst/bibliotek
- Owner: hemtjanst
- License: apache-2.0
- Created: 2018-07-08T20:18:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-20T12:31:50.000Z (12 months ago)
- Last Synced: 2024-10-17T16:48:27.005Z (21 days ago)
- Topics: domotic, golang, home-automation, mqtt, smarthome
- Language: Go
- Homepage: https://lib.hemtjan.st
- Size: 146 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🏛️ Bibliotek 📚 [![Build Status](https://travis-ci.org/hemtjanst/bibliotek.svg?branch=master)](https://travis-ci.org/hemtjanst/bibliotek) ![GitHub release](https://img.shields.io/github/release/hemtjanst/bibliotek.svg) [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/lib.hemtjan.st/)
Bibliotek ('library' in Swedish) provides common primitives and utilities for
integrating with and extending the Hemtjänst platform.## Usage
### `client` [![client godoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/lib.hemtjan.st/client)
The [client package](https://pkg.go.dev/lib.hemtjan.st/client)
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).### `server` [![server godoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/lib.hemtjan.st/server)
The [server package](https://pkg.go.dev/lib.hemtjan.st/server)
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`](../master/cmd/explorer/main.go) on how to
use it.### `transport/mqtt` [![mqtt transport godoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/lib.hemtjan.st/transport/mqtt)
The [transport/mqtt package](https://pkg.go.dev/lib.hemtjan.st/transport/mqtt)
contains everything needed to transport device data over MQTT. It
also contains the [`Flags()`](https://pkg.go.dev/lib.hemtjan.st/transport/mqtt#Flags)
and [`MustFlags()`](https://pkg.go.dev/lib.hemtjan.st/transport/mqtt#MustFlags)
helpers that provide a set of flags to configure common MQTT options.## Contributing
Contributions are very welcome. Do ensure you run the tests:
```sh
$ 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.```sh
$ env BIBLIOTEK_TEST_INTEGRATION=1 go test -race -v -coverprofile=profile.cov $(go list ./...)
...
```