Xiaomi Flower Care and ESPHome Bluetooth Gateway

Xiaomi Flower Care is a small battery powered sensor that can be integrated in Home Assistant by the ESPHome firmware using the xiaomi_ble platform and the esp32_ble_tracker component.

Uploaded on an ESP32 board the esp32_ble_tracker component creates a Bluetooth gateway so that you can track Bluetooth low energy devices to communicate sensor readings to HA. This gateway can support multiple Bluetooth sensors, in this guide we will use the xiaomi_ble platform to manage a Xiaomi MIFlora sensor readings for temperature, moisture, ambient light and nutrient levels in the soil.

The advantage having this gateway are:

  • can be placed nearby your Bluetooth devices and it will extend the range of the Home Assistant Raspberry builtin Bluetooth
  • can manage multiple Bluetooth devices and platform
  • it’s quite chip, just need an ESP32 board

Official ESPHome documentation for:

  • esp32_ble_tracker (link)
  • xiaomi_ble (link)

Xiaomi Flower Care Sensor

Just open the back plastic cover from the sensor and remove the insulation from the battery to turn on the device.

Now we need to discover the MAC address using any Bluetooth scanner application, for example WiFiman application for Android:

  • Open WiFiman app on your mobile, tap on Wireless and Bluetooth
  • Find out the Flower Care device and tap on it
  • Take note of the MAC address

ESP32 Board

This board is quite famous so I’m not going to talk about it in details, what we care for this projects is:

  • Supports Wifi and Bluetooth communication, so can communicate with the sensor by the Bluetooth and with Home Assistant by the Wifi Connection
  • Is fully supported by ESPHome firmware, that easy integrates any input to Home Assistant and automatically generates sensors entities.

Connect it to your PC using a Micro USB cable and prepare to flash the firmware.

ESPHome Firmware

ESPHome addon must be already up and running on your HA instance to proceed:

  • Open the ESPHome addon from your Home Assistant menu
  • Click + NEW DEVICE button
  • Type a Name for this project
  • Cick NEXT
  • Click SKIP THIS STEP
  • Select a generic ESP32 board
  • Click NEXT
  • Click SKIP
  • Click EDIT on the new project
  • Replace all the code with the one posted below:
  • Replace the mac_address with the one from your device and choose the name for each of the sensor entities
  • Pay attention to the board parameter, it depends on the ESP32 board model you have, the one I’ve used is this one (LINK)
  • Click INSTALL
esphome:
  name: gateway-bluetooth-esphome
  platform: ESP32
  board: esp32doit-devkit-v1

logger:

api:

ota:
  password: "670d70c6dd4ea29b3b9b66b1109dc0d8"
  
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

esp32_ble_tracker:

sensor:
  - platform: xiaomi_hhccjcy01
    mac_address: C4:7C:8D:6D:DE:E9
    temperature:
      name: "Miflora Gelsomino Temperature"
    moisture:
      name: "Miflora Gelsomino Humidity"
    battery_level:
      name: "Miflora Gelsomino Battery"
    illuminance:
      name: "Miflora Gelsomino Illuminance"
    conductivity:
      name: "Miflora Gelsomino Soil Conductivity"
  • Press the RESET button on the ESP32 board until you see Connecting status on the screen, than release it
  • Wait for the upload completion

Home Assistan Integration

  • Go to SettingsIntegrations, devices, entities and helpers
  • You will find a newly discovered ESPHome device, confirm to add it to your HA instance
  • So you will have your Sensor entities ready to use

As stated in the documentation “Newer versions of HHCCJCY01 ship with firmware 3.2.1, and they don’t send the battery level data anymore”, so battery level entity is not available.