Hello all,
I recently set up some ESP32 to listen to my Mi Flora plant sensors. Before that, I used
# Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
A simple Linux python script to query arbitrary Mi Flora plant sensor devices and send the data to an **MQTT** broker,
e.g., the famous [Eclipse Mosquitto](https://projects.eclipse.org/projects/technology.mosquitto).
After data made the hop to the MQTT broker it can be used by home automation software, like [openHAB](https://openhab.org) or Home Assistant.
![Demo gif for command line execution](demo.gif)
The program can be executed in **daemon mode** to run continuously in the background, e.g., as a systemd service.
## About Mi Flora
* [Xiaomi Mi Flora sensors](https://xiaomi-mi.com/sockets-and-sensors/xiaomi-huahuacaocao-flower-care-smart-monitor) ([e.g. 12-17€](https://www.aliexpress.com/wholesale?SearchText=xiaomi+mi+flora+plant+sensor)) are meant to keep your plants alive by monitoring soil moisture, soil conductivity and light conditions
* The sensor uses Bluetooth Low Energy (BLE) and has a rather limited range
* A coin cell battery is used as power source, which should last between 1.5 to 2 years under normal conditions
* Food for thought: The sensor can also be used for other things than plants, like in the [fridge](https://community.openhab.org/t/refrigerator-temperature-sensors/40076) or as [door and blind sensor](https://community.openhab.org/t/miflora-cheap-window-and-door-sensor-water-sensor-blind-sensor-etc/38232)
## Features
* Tested with Mi Flora firmware v2.6.2, v2.6.4, v2.6.6, v3.1.4, others anticipated
* Build on top of [open-homeautomation/miflora](https://github.com/open-homeautomation/miflora)
This file has been truncated. show original
with a Raspberry Pi Zero for this, which worked fine. But as I wanted more receivers for the BLE signal throughout the house and garden, the ESP32 were the cheaper option.
But with OpenMQTTGateway, I do not get the battery information from the plant sensors. I think this is useful for giving a warning when the battery is running low.
I found something about this here, in an old topic of 2018 (Mi flora ESP32 Problem ), but from the content, I cannot really tell if the battery info should be available or not, because the battery was not the only problem in this thread.
Should I get battery info with the most recent OMG version?
The sensors do have the most recent firmware according to the Mi Flora app.
Thanks & Kind Regards,
Nadine
No, retrieving battery info of mi flora require OMG to connect to the device. This is not yet supported.
Is the Mi Flora battery status on the horizon any time soon? Not that I am pushing you to look at it right now, you have been more than kind enough to help me out this far.
Battery sensor of miflora has been implemented from v0.9.7 for info
I’m sorry but I’m not getting battery info from any of the 5 pieces of Mi Flora.
I use OMG version 1.4.0
What could be the reason for this.
OMG version 1.4.0 is installed on an esp32 DEV module.
I get: (MQTT Explorer)
tempc
tempf
lux
moi
fer
DigiH
February 20, 2023, 12:27pm
6
Hi @helste64 ,
Can you have a look at what your intervalcnct
is set to? You can see it in the BTtoMQTT topic.
The battery for the Mi Floras is retrieved by connection only, in regular intervals defined by intervalcnct
, which can be set with
One gateway, many technologies: MQTT gateway for ESP8266, ESP32, Sonoff RF Bridge or Arduino with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, beacons detection, mi flora / mi jia / LYWSD02/ Mi Scale compatibility, SMS & LORA.
Hope this helps.
After update version v1.6.0 mi flora battery “Unknown”
DigiH
June 25, 2023, 12:43pm
8
I suppose you are talking about your pink Mi Flora HHCCJCY10 version, for which we collaborated on creating a decoder, correct?
Pressing boot at upload solved upload problem tnx.
i am testing sensors now
data is coming now in two packets with mqtt explorer
id, name ,rssi packets are coming every minute
sensor data packets are coming every 3 minute or so ,
but sensor values ​​do not change very often with mqtt , values are changing about every 40 minutes or so
but with sensor native app “smart life” values are changing about every 3 seconds.
could it be that the sensors are bluetooth5 but the esp32 i am using ope…
The decoder hasn’t been touch at all since the initial submission, so it should be working the same as in your final results in the above thread.
Did you possibly update the firmware on the Mi Flora?
Can you double check with MQTT Explorer again, to see what the actual decoded messages look like?
pink Mi Flora is ok but green and white is not showing battery %
DigiH
June 25, 2023, 7:47pm
10
The green and white Mi Floras get the battery level through connecting to the devices.
We are looking into it.
I’m getting the battery updates on my Mi FLora:
{"model":"HHCCJCY01HHCC","id":"C4:7C:88:55:66:66","batt":100}
Did you check the connect interval and the sensor distance from the gateway?