https://github.com/niktheblak/ruuvitag-gollector
Collect measurements from RuuviTag sensors to InfluxDB and other databases
https://github.com/niktheblak/ruuvitag-gollector
go golang influxdb iot rawv2 ruuvitag ruuvitag-sensor
Last synced: 2 months ago
JSON representation
Collect measurements from RuuviTag sensors to InfluxDB and other databases
- Host: GitHub
- URL: https://github.com/niktheblak/ruuvitag-gollector
- Owner: niktheblak
- License: agpl-3.0
- Created: 2019-09-20T12:56:46.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-08-19T22:32:57.000Z (2 months ago)
- Last Synced: 2025-08-21T23:26:31.916Z (2 months ago)
- Topics: go, golang, influxdb, iot, rawv2, ruuvitag, ruuvitag-sensor
- Language: Go
- Size: 830 KB
- Stars: 8
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ruuvitag-gollector
RuuviTags are an amazing way to collect environmental data. But sometimes, you want full control over how that data is stored, visualized, or processed. ruuvitag-gollector is a self-hosted solution that listens to BLE broadcasts and pushes sensor data to platforms like InfluxDB, PostgreSQL, AWS, GCP and more.
Whether you're monitoring a greenhouse, a guitar case, a terrarium, or just love collecting atmospheric data with Raspberry Pi; this project gives you full flexibility without needing a subscription. You will need to self-host or host in the cloud some the server stuff, such as a database and Grafana though. But for collecting and seeing their data, all you need is the cheapest possible Raspberry Pi and a Go compiler.
Supports the RAWv2 format emitted by RuuviTags with 2.x or later firmware.
## Setup
Compile and install the `ruuvitag-gollector` binary:
```bash
git clone https://github.com/niktheblak/ruuvitag-gollector.git
cd ruuvitag-gollector
task build
task install
```
Then copy the example configuration file `configs/example-config.toml` to `$HOME/.ruuvitag-gollector/config.toml` or `/etc/ruuvitag-gollector/config.toml` if you're installing the collector globally.
and fill your preferred configuration values. For reference of possible configuration
values, run `ruuvitag-gollector -h`.
At the very least you need to add the MAC addresses and human-readable names of your
RuuviTags into the config file under the `ruuvitags` key:
```toml
[ruuvitags]
"CC:CA:7E:52:CC:34" = "Backyard"
"FB:E1:B7:04:95:EE" = "Upstairs"
"E8:E0:C6:0B:B8:C5" = "Downstairs"
```
If you want to save data to InfluxDB (local or remote), add the following options to your config file:
```toml
[expoters.influxdb]
type = "influxdb"
addr = "http://localhost:8086"
bucket = "ruuvitag"
measurement = "ruuvitag"
token = "abc123"
```
For a complete configuration example, see [example config](#complete-example-configuration).
The following exporters are supported for sending measurements:
- InfluxDB
- PostgreSQL (and TimescaleDB)
- Webhook, meaning a URL that accepts an HTTP POST request with the measurement as JSON in the request body
- AWS DynamoDB
- AWS SQS
- GCP Pub/Sub
- MQTT
See the command-line help for the arguments needed by each exporter:
```bash
ruuvitag-gollector -h
```
You can specify custom column names for the data fields ruuvitag-gollector sends out to match your database schema.
You can also exclude columns whose value you don't need. The default columns and their names are:
```toml
[columns]
time = "time"
mac = "mac"
name = "name"
temperature = "temperature"
humidity = "humidity"
pressure = "pressure"
acceleration_x = "acceleration_x"
acceleration_y = "acceleration_y"
acceleration_z = "acceleration_z"
movement_counter = "movement_counter"
measurement_number = "measurement_number"
dew_point = "dew_point"
battery_voltage = "battery_voltage"
tx_power = "tx_power"
```
## Running
Now you can try to run it manually (you typically need to run as root to allow the collector
process access to Bluetooth hardware):
```bash
sudo ruuvitag-gollector collect
```
To collect values continuously, run:
```bash
sudo ruuvitag-gollector daemon
```
## Complete Example Configuration
```toml
interval = "0m"
device = "default"
[ruuvitags]
"CC:CA:7E:52:CC:34" = "Backyard"
"FB:E1:B7:04:95:EE" = "Upstairs"
"E8:E0:C6:0B:B8:C5" = "Downstairs"
[exporters]
[exporters.influxdb]
type = "influxdb"
addr = "https://eu-central-1-1.aws.cloud2.influxdata.com"
bucket = "ruuvitag"
measurement = "ruuvitag"
token = "abc123"
async = true
batch_size = 20
flush_interval = "5s"
[exporters.dynamodb]
type = "dynamodb"
table = "ruuvitag"
access_key_id = "MYAWSAKKESSKEY"
secret_access_key = "my+aws+secret+key"
region = "us-east-2"
[exporters.sqs]
type = "sqs"
queue.url = "https://us-east-2.queue.amazonaws.com/321667262165/measurements"
access_key_id = "MYAWSAKKESSKEY"
secret_access_key = "my+aws+secret+key"
region = "us-east-2"
[exporters.postgres]
type = "postgres"
host = "my-instance-name.eu-central-1.aws.neon.tech"
port = 5432
database = "ruuvitag"
username = "myorg@example.com"
password = "some_secret_password"
table = "ruuvitag"
sslmode = "require"
[exporters.http]
type = "http"
url = "https://my-api.herokuapp.com/receive"
token = "MyHerokuToken"
[exporters.mqtt]
type = "mqtt"
addr = "tcp://localhost:8883"
client_id = "ruuvitag-gollector"
username = "mqtt_user"
password = "my_secret_password"
ca_file = "root_ca.pem"
auto_reconnect = true
reconnect_interval = 30
[columns]
time = "time"
mac = "mac"
name = "name"
temperature = "temperature"
humidity = "humidity"
pressure = "pressure"
movement_counter = "movementCounter"
measurement_number = "measurementNumber"
```