Skip to content
Raspberry Pi GPIO to MQTT and Hemtjänst
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
.gitignore
.goreleaser.yml
.travis.yml
LICENSE
README.md
example.conf
go.mod
go.sum
gpio_in.go
gpio_out.go
hallonlarm.service
main.go
struct.go

README.md

HallonLarm

HallonLarm is:

  • The Swedish words "Hallon" (Raspberry) and "Larm" (Alarm)
  • An RaspberryPi application that:
    • Forwards GPIO events to MQTT
    • Listens to MQTT topics and sets GPIO outputs
    • Implements the Hemtjänst protocol for automatic discovery

Usage

Build and install HallonLarm:

# Install dep and dependencies
go get -u github.com/golang/dep/cmd/dep
dep ensure

# Build for ARMv6, Raspberry Pi 1-2:
env GOOS=linux GOARCH=arm GOARM=6 go build -o hallonlarm_armv6 .

# Build for ARMv7, Raspberry Pi 3+:
env GOOS=linux GOARCH=arm GOARM=7 go build -o hallonlarm_armv7 .

# Copy the binary to /usr/local/bin
sudo cp hallonlarm_armv[67] /usr/local/bin/hallonlarm

# Install the unit file
sudo cp hallonlarm.service /etc/systemd/system/

# Edit the unit file to change mqtt address
sudo vim /etc/systemd/hallonlarm.service

# Reload systemd
sudo systemctl daemon-reload

# Copy and edit the sample configuration
sudo cp example.conf /etc/hallonlarm.conf
sudo vim /etc/hallonlarm.conf

# Start the service
sudo systemctl start hallonlarm.service

# Enable at boot
sudo systemctl enable hallonlarm.service

Configuration

The default configuration path is /etc/hallonlarm.conf. This can be changed by adding the argument -hl.config path/to/hallonlarm.conf to the start command

A minimal configuration looks like this (the configuration language is HCL:

device "sensor/contact/bedroom_window" {
  name = "Bedroom Window"
  type = "contactSensor"
  feature "contactSensorState" {
    gpioIn = {
      pin = 24
    }
  }
}

For a complete example with more options, see example.conf

You can’t perform that action at this time.