/ESP32_MiFlora_MQTT

ESP32 BLE client for XIaomi Mi Flora Plant sensors using MQTT.

Primary LanguageC++

If you prefer to use ESPHome instead of MQTT then check this - ESP32_MiFlora_ESPHome

ESP32_MiFlora_MQTT

Arduino sketch - ESP32 BLE client for XIaomi Mi Flora Plant sensors. ESP32 can be powered with LiPo battery and battery level is read from ADC pin. ESP32 battery level and Mi Flora sensor measurements are pushed to the MQTT server.

Hardware & Software used

Setup

  1. Install the Espressif Arduino-ESP32 support - https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
  2. Edit settings in config.h:
  • FLORA_DEVICES - MAC address(es) of your Xiaomi Mi Plant sensor(s)
  • SLEEP_DURATION - sleep duration between sensor reads
  • EMERGENCY_HIBERNATE - emergency hibernate countdown when something gets stuck
  • BATTERY_INTERVAL - Mi Flora battery status read interval
  • RETRY - device retry count when something fails
  • WIFI_SSID - WLAN SSID
  • WIFI_PASSWORD - WLAN password
  • ADC_Pin - ESP32 ADC pin number where the Battery is connected to
  • MQTT Server settings
  1. Open sketch in Arduino, compile & upload.

  2. esp_miflora.yaml - Example MQTT sensor config for Home Assistant (replace MAC addresses in the file for your MiFlora & ESP32)

Credits