raspi-gpio-mqtt

command module
v0.0.0-...-59971b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2022 License: MIT Imports: 7 Imported by: 0

README

raspi-gpio-mqtt

A little app written in Go to watch for changes to GPIO pins on the Raspberry Pi and relay them to an MQTT topic.

The app uses the os.select() to receive changes from the kernel rather than polling to keep CPU usage to a minimum. It also debounces the input so that the MQTT topic does not get spammed.

Dependencies: github.com/brian-armstrong/gpio, github.com/eclipse/paho.mqtt.golang

Setup

git clone git@github.com:heathbar/raspi-gpio-mqtt.git
cd raspi-gpio-mqtt
go get
go build

# root/sudo is required to access the GPIO pins on the raspberry pi. 
sudo ./raspi-gpi-mqtt -b tcp://my-mqtt-server.com:1883
systemd
sudo cp ./raspi-gpio-mqtt.service /etc/systemd/system/
sudo systemd enable raspi-gpio-mqtt
sudo systemd start raspi-gpio-mqtt

TODO

  • mqtt security
  • mqtt QoS
  • configurable debounce timeout

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL