Site Overlay

Xiaomi Mi Flora (Plant Sensor) to MQTT

Xiaomi Mi Flora is a plant sensor which can be used to measure:

  • light
  • moisture
  • temperature
Mi Flora Balcony
Plant Sensor used outside for more than 1,5 years now

The Xiaomi Mi Flora will provide this information via BLE and is capable to run out of one battery (3V) around 1 year. From my experience even more. My measurement over the last year was showing a voltage drop of 25% over our 8 months of summer usage. If you store your sensor inside over the winter they should be able to run a second season.

As this Xiaomi Mi Flora is only capable to send data via BLE and my home server is let’s say not so close to our balcony, I was looking for a smart solution to pick up all the data and send this than via MQTT over wifi.

The Solution which fits best for me was to use an ESP32 / ESP32S as this has wifi + BLE onboard out of the box. They are not heavy overpriced and can be bought for around 7-12€ if you buy on amazon.

The good part is if you don’t plan to use the Xiaomi app, you don’t have to care which version you order. I’m using a mix out of versions from China and Europe, all of them work like a charm. I didn’t test the second market copies yet but would be interesting to know if these work as well.

The arduino code for the ESP32S can be found here:

You have to fill in the values for your Xiaomi Mi Flora Bluetooth mac addresses as well as your wifi and MQTT information. If you are working on the windows you can use „Bluetooth LE Explorer“ to capture the mac addresses of your devices.

BLE Scanner

The only pitfall than is that you have to change the default partition size for your ESP board, as this sketch is a bit too huge to fit into the default 1.2MB. Changing the partition size is quite easy as you can use one of the defaults here (Any sizing with at least 2MB for „app“ should work)

Arduino partition change

All the collected information are pushed on my end into ioBroker and stored in an influx DB. Afterwards, this data can be used for graphing, I’m using Grafana for this purpose.

Grafana Darstellung MI Flora Daten