barnybug / gohome

Home automation for the geek home. Built in Go.
64 stars 6 forks source link

Gohome

Home automation for the geek home. Built in Go.

Build Status GoDoc

Features

Devices supported

Services supported

Installation

Installation is easy, just download the binary from the github releases page (builds are available for Linux 32-bit, 64-bit and ARM): https://github.com/barnybug/gohome/releases/latest

For the raspberry pi, download the ARM build.

Rename and make the download executable:

$ cp gohome-my-platform /usr/local/bin; chmod +x /usr/local/bin/gohome

You also will need mosquitto installed:

Debian/Ubuntu/Raspbian:

$ apt-get install mosquitto
$ service mosquitto start

ArchLinux

$ packer -S mosquitto
$ systemctl enable --now mosquitto

Configuration

An example configuration is at: https://github.com/barnybug/gohome/blob/main/config.yml

Edit this to match your setup and upload:

$ curl -XPOST localhost:8723/config?path=config --data-binary config.yml

Running

gohome runs as a set of distributed and independent processes/services. They can run across different hosts connecting to the same network, with the pubsub bus (MQTT) connecting all the components together.

To manually run a gohome service:

$ gohome run <service>

The best way to manage the whole set of services is using your user systemd - because you probably want to ensure they are restarted if they happen to crash. Any recent Archlinux comes with this preconfigured, you just need to install the gohome services by running the script setup.sh provided:

$ cd systemd && ./setup.sh

This will enable and start all the services defined in by SERVICES=... in setup.sh.

The 'services' don't necessarily have to be gohome itself - you can add scripts to the system of your own crafting. The script service can wrap external scripts and passes on any events printing to stdout by the external script into gohome, allowing quick and easy integration.

Building from source

To build yourself from source:

$ go get github.com/barnybug/gohome
$ cd $GOPATH/src/github.com/barnybug/gohome
$ make install

This will produce a binary gohome in ~/go/bin (ie. $GOPATH/bin), after this follow the steps as above.