Ruuvitag Bluetooth listener ("client") & Prometheus metrics server ("server").
Client - server model communicates via AWS SQS, so the Raspberry Pi I use to listen to Ruuvi traffic doesn't have to have anything extra.
The client has pluggable outputs:
- Print to console (doesn't need the server component at all)
- AWS SQS
The client tries its best to send observations in two-second batches to minimize AWS service charges.
How to build & develop (with Turbo Bob, our build tool). It's easy and simple!
Prerequisites: $ apt install bluez-hcidump
.
Download suitable binary for your architecture from Bintray download link from the top of this README.
Configure config.json
. Example with SQS:
{
"sensor_whitelist": {
"aa:bb:cc:dd:ee:ff": "Bedroom",
"ff:ee:dd:cc:bb:aa": "Outside"
},
"output": "sqsoutput",
"sqsoutput_config": {
"queue_url": "https://sqs.us-east-1.amazonaws.com/123456789/Ruuvinator",
"aws_access_key_id": "AKIA...",
"aws_access_key_secret": "E+mEut..."
}
}
Don't worry if you don't know your sensors' Bluetooth addresses. For non-whitelisted Ruuvis, you can find log lines like these:
observation from unknown Ruuvi fb:72:36:09:90:15
Example config with just printing to console:
{
"sensor_whitelist": {
"aa:bb:cc:dd:ee:ff": "Bedroom"
},
"output": "console"
}
Now try running it (you might need to run it with sudo):
$ ./ruuvinator client
To make it start on system startup - you'll get nice help tips as well:
$ ./ruuvinator client write-systemd-unit-file
Wrote unit file to /etc/systemd/system/ruuvinator-client.service
Run to enable on boot & to start now:
$ systemctl enable ruuvinator-client
$ systemctl start ruuvinator-client
Troubleshooting: if Bluetooth gives you grief, have you tried turning it off and on again?
$ hciconfig hci0 down && hciconfig hci0 up
You can find the Docker image from the Docker link from the top of this README.
The server is designed to run as a Docker container. Define these ENV variables:
QUEUE_URL
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Prometheus metrics will be available at http://ip/metrics