For a while I have looked into making a better connection to my plant sensor. The MiFlora plant sensor is a BLE device, that you can connect directly to Home Assistant if you have a BLE device (like Raspberry Pi with Wifi, or a NUC with a Bluetooth device on).
But this connection has proven not to be reliable, primarily because my Home Assistant server is located on a different floor than the plant sensor.
So to try to make a better, more reliable BLE connection I have installed a couple of ESP32 sensors. This is a cheap device (around $4 )that works as a bridge between WiFi and BLE.
This device is pretty easy to install in Home Assistant. All you need to do to start with ESP32 is to install an add-on. Start with the official guide for ESP32 installation here: https://esphome.io/guides/getting_started_hassio.html
Note: I found that setting the WiFi information in “secrets” (upper right corner after the ESP32 installation is done), makes the setup of a new device much easier.
To set up the MiFlora plant sensor in ESP32, there is just a couple of steps you need to perform.
- You first need to obtain the MAC address for the device.
- For Windows, you could use the Bluetooth LE Explorer
- Add the following code below to your ESP32 device, using “edit” on the device (replace “mac_address” with correct address)
- Save and install the code
esp32_ble_tracker:
sensor:
- platform: xiaomi_hhccjcy01
mac_address: 'xx:xx:xx:xx:xx:xx'
temperature:
name: "P1 Temperature"
moisture:
name: "P1 Moisture"
illuminance:
name: "P1 Illuminance"
conductivity:
name: "P1 Conductivity"
battery_level:
name: "P1 Battery level"
After the code has been saved and uploaded to the device, you should see the sensors and the battery level.

Note – if your MiFlora device has firmware 3.2.1 or newer, the battery information is not sent from the device anymore. If the device has firmware newer than 3.2.1 it would only show “Unknown” in Home Assistant.
The advantage of this integration is that it just listens passively to advertisement packets and does not pair with the device. So the battery life is not impacted.
Some of the links in this article are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.