JsBergbau / MiTemperature2

Read the values of the Xiaomi Mi Bluetooth Temperature sensor 2 including custom encrypted format.
694 stars 163 forks source link

Add TLDR docs with minimal working project+influx #146

Open bitrate16 opened 8 months ago

bitrate16 commented 8 months ago

Please add minimal working example of project+influx. Setup requires in-detail knowledge of how to setup everything starting from MQTT broker ending with configuring proper telegraf value types for MQTT scraper because using bash script as root listener callback is insecure/unappliable in case of userspace/docker deployment for reason of sendToInflux file forgery and token/password in-file hardcoding and unavailability of it in docker.

Current approach that I could figure out now is to use MQTT broker + docker-compose MiTemperature2 + Telegraf MQTT to automatically insert everything from MQTT to influx, but It took me 4 hours to setup single sensor temperature monitoring in docker compose

JsBergbau commented 8 months ago

Hallo bitrate16,

thanks for your interest. There is an example callback file for influxdb https://github.com/JsBergbau/MiTemperature2/blob/master/sendToInflux.sh You don't need telegraf or even MQTT for getting the values into influxdb. You don't have to run the script as root, as explained here https://github.com/JsBergbau/MiTemperature2#requirements-for-reading-sensors-in-passive-mode

The sendToInflux.sh callback is explained in the last paragraph here https://github.com/JsBergbau/MiTemperature2#callback-for-processing-the-data