solectrus / mqtt-collector

Collect data from MQTT broker and push it to InfluxDB 2 for use with SOLECTRUS
Other
6 stars 2 forks source link
mqtt photovoltaic smarthome

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

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 georg@ledermann.dev and contributors.\ Inspired by code provided by Sebastian Löb (@loebse) and Michael Heß (@GrimmiMeloni)