ruuviscanner is an application listening for RuuviTag broadcasts and converting them to measurements suitable for storing in InfluxDB or publishing to an MQTT topic for Home Assistant integration.
The code is inspired by https://github.com/Scrin/RuuviCollector, but I needed a more lightweight application that can run on a RaspberryPi Zero W.
- Begin with setting up the backend, consisting of influxdb for storing observations and grafana for showing observations.
docker-compose up -d
./create-database.sh
- Install dependencies. Note: the scanner only works on Linux.
apt install bluez-hcidump
- Build and run the scanner
go build && ./ruuviscanner
- Open
http://localhost:3000/ruuvi/
in your browser to view the collected observations.
-
Enable remote access accoding to https://www.raspberrypi.org/documentation/remote-access/ssh/
-
Cross-compile for Linux ARM
GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -o ruuviscanner.linux-arm32
- Copy the binary to your pi
scp ruuviscanner.linux-arm32 pi@<your-pis-ip>:/usr/local/bin/ruuviscanner
- Install the dependencies on your Pi
apt install bluez-hcidump
- Create a systemd unit file to automatically start up at boot
cat << EOF > /etc/systemd/system/ruuviscanner.service
[Unit]
Description=RuuviScanner
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root
ExecStart=/usr/local/bin/ruuviscanner -influx-addr http://<your-ip-to-the-influx-backend>:8086
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable ruuviscanner.service
systemctl start ruuviscanner.service