An open API service indexing awesome lists of open source software.

https://github.com/solectrus/mqtt-collector

Collect data from MQTT broker and push it to InfluxDB 2 for use with SOLECTRUS
https://github.com/solectrus/mqtt-collector

mqtt photovoltaic smarthome

Last synced: 11 days ago
JSON representation

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

Awesome Lists containing this project

README

          

[![Continuous integration](https://github.com/solectrus/mqtt-collector/actions/workflows/push.yml/badge.svg)](https://github.com/solectrus/mqtt-collector/actions/workflows/push.yml)
[![Maintainability](https://qlty.sh/gh/solectrus/projects/mqtt-collector/maintainability.svg)](https://qlty.sh/gh/solectrus/projects/mqtt-collector)
[![wakatime](https://wakatime.com/badge/user/697af4f5-617a-446d-ba58-407e7f3e0243/project/233968fc-9ac5-4c50-952f-ec1a37b3df85.svg)](https://wakatime.com/badge/user/697af4f5-617a-446d-ba58-407e7f3e0243/project/233968fc-9ac5-4c50-952f-ec1a37b3df85)
[![Code Coverage](https://qlty.sh/gh/solectrus/projects/mqtt-collector/coverage.svg)](https://qlty.sh/gh/solectrus/projects/mqtt-collector)

# 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:

- [ioBroker](https://www.iobroker.net/) with the integrated MQTT broker and the [SENEC Home 2.1 adapter](https://github.com/nobl/ioBroker.senec)
- [evcc](https://evcc.io/) with the [senec-home template](https://github.com/evcc-io/evcc/blob/master/templates/definition/meter/senec-home.yaml) and the [HiveMQ MQTT Broker](https://www.hivemq.com/public-mqtt-broker/)

Note: For a SENEC device there is a dedicated [senec-collector](https://github.com/solectrus/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:

```bash
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](https://github.com/rbenv/rbenv).

### Run the app

```bash
bundle exec app.rb
```

### Run tests

```bash
bundle exec rake
```

### Run linter

```bash
bundle exec rubocop
```

## License

Copyright (c) 2023-2026 Georg Ledermann and contributors.\
Inspired by code provided by Sebastian Löb (@loebse) and Michael Heß (@GrimmiMeloni)