Skip to content

Collect data from MQTT broker and push it to InfluxDB 2 for use with SOLECTRUS

License

Notifications You must be signed in to change notification settings

solectrus/mqtt-collector

Repository files navigation

Continuous integration Maintainability wakatime Test Coverage

MQTT collector

Collect data from MQTT broker and push it to InfluxDB 2. The mappings of MQTT topics to InfluxDB fields and measurements is customizable.

The main use case is to collect data for SOLECTRUS, but it can be used for other purposes as well, where you want to collect data from MQTT and store it in InfluxDB.

It has been tested in the following setups:

Note: For a SENEC device there is a dedicated senec-collector available which communicates directly with the SENEC device via its API and does not require a MQTT broker. Also, it is able to collect additional and more accurate data from the SENEC device.

Requirements

  • InfluxDB 2
  • MQTT broker
  • Linux machine with Docker installed

Getting started

  1. Make sure that your MQTT broker and InfluxDB2 database are ready (not subject of this README)

  2. Prepare an .env file (see .env.example)

  3. Run the Docker container on your Linux box:

    docker compose up

The Docker image supports multiple platforms: linux/amd64, linux/arm64, linux/arm/v7

Development

For development you need a recent Ruby setup. On a Mac, I recommend rbenv.

Run the app

bundle exec app.rb

Run tests

bundle exec rake

Run linter

bundle exec rubocop

License

Copyright (c) 2023-2024 Georg Ledermann [email protected] and contributors.
Inspired by code provided by Sebastian Löb (@loebse) and Michael Heß (@GrimmiMeloni)