The plan is to implement a microdrip irrigation system on my balcony. Since at some point I will be unable to access the soil of some fabric pots I want to get a rough estimate how much moisture each section has.

To do so I ordered 8 (technically I ordered 10 but 3 of them had the same MAC address rendering 2 of them useless.) Mi Flora Plant sensors on aliexpress.

14.23CHF 35% OFF|HHCC Flora Monitor Garten Care Pflanzen Gras Boden Wasser Fruchtbarkeit Smart Tester Sensor Blume Gartenarbeit Detektor Für XiaoMi|Smart Remote Control| - AliExpress
Smarter Shopping, Better Living! Aliexpress.com

These things work via bluetooth. I tested them by integrating them in homeassistant... on my Raspberry Pi... that had bluetooth... and was on the balcony where the sensors were...

It worked perfectly. The only issue I have is that 1) I switched from Raspberry Pi to a SFF Desktop that is located in my storage room and does not have bluetooth.

The solution

There are these nifty little microcontrollers called ESP32 which have bluetooth and wifi capabilities. They are also quite cheap to buy and integrate nicely into homeassistant via ESP-Home.

2.11CHF 13% OFF|ESP32 ESP 32 ESP32S ESP 32S CP2102 Drahtlose WiFi Bluetooth Entwicklung Bord Micro USB Dual Core Power Verstärker Filter Modul|Replacement Parts & Accessories| - AliExpress
Smarter Shopping, Better Living! Aliexpress.com

I also printed a case of thingiverse for it on my 3D Printer.

esp32-case by bdmihai
Remix of https://www.thingiverse.com/thing:2786523 using OpenSCAD. Thanks to Sergio Vilches for the rounded corners!

Setup

First step is to use any kind of bluetooth sniffer to get all the MAC Addresses of each Mi Flora Plant sensor (Hint: Dont test them all at once so you can label each Sensor with the correct MAC).

Plug in your ESP32 into ESP-Home and add the following code:

esp32_ble_tracker:
sensor:
  - platform: xiaomi_hhccjcy01
    mac_address: '80:EA:CA:60:05:05'
    temperature:
      name: "P1 Temperature"
    moisture:
      name: "P1 Moisture"
    illuminance:
      name: "P1 Illuminance"

  - platform: xiaomi_hhccjcy01
    mac_address: 'c4:7c:8d:6d:ff:17'
    temperature:
      name: "P2 Temperature"
    moisture:
      name: "P2 Moisture"
    illuminance:
      name: "P2 Illuminance"
      
  - platform: xiaomi_hhccjcy01
    mac_address: 'c4:7c:8d:6d:8c:f5'
    temperature:
      name: "P3 Temperature"
    moisture:
      name: "P3 Moisture"
    illuminance:
      name: "P3 Illuminance"

  - platform: xiaomi_hhccjcy01
    mac_address: 'c4:7c:8d:6e:14:bf'
    temperature:
      name: "P4 Temperature"
    moisture:
      name: "P4 Moisture"
    illuminance:
      name: "P4 Illuminance"

  - platform: xiaomi_hhccjcy01
    mac_address: 'c4:7c:8d:6e:16:54'
    temperature:
      name: "P5 Temperature"
    moisture:
      name: "P5 Moisture"
    illuminance:
      name: "P5 Illuminance"
      
  - platform: xiaomi_hhccjcy01
    mac_address: 'c4:7c:8d:6e:16:85'
    temperature:
      name: "P6 Temperature"
    moisture:
      name: "P6 Moisture"
    illuminance:
      name: "P6 Illuminance"
      
  - platform: xiaomi_hhccjcy01
    mac_address: 'c4:7c:8d:6e:15:f1'
    temperature:
      name: "P7 Temperature"
    moisture:
      name: "P7 Moisture"
    illuminance:
      name: "P7 Illuminance"
      
  - platform: xiaomi_hhccjcy01
    mac_address: 'c4:7c:8d:6d:fe:59'
    temperature:
      name: "P8 Temperature"
    moisture:
      name: "P8 Moisture"
    illuminance:
      name: "P8 Illuminance"

This should work pretty much as is. It might take some time to get the initial reading on every sensor.

In homeassistant you should be able to see every sensor now. I have set them up with Horizontal Stacks and Minigraph as follows:

type: horizontal-stack
cards:
  - type: custom:mini-graph-card
    entities:
      - sensor.p1_moisture
    line_color: blue
    line_width: 8
    font_size: 75
  - type: custom:mini-graph-card
    entities:
      - sensor.p1_temperature
    line_color: '#e74c3c'
    line_width: 8
    font_size: 75
  - type: custom:mini-graph-card
    entities:
      - sensor.p1_illuminance
    line_color: orange
    line_width: 8
    font_size: 75

I wouldnt run any Node-Red tasks on them because sometimes they lose their readings and display NaN for a second. I will just use this as a visual guide to let me know when to enable the water pump I guess.

Small Update: This Issue seems to have been fixed by either an update to the ESP or Homeassistant itself. Im getting consistent readings now but I water on a schedule anyway.

More on https://mka-chili.ch

Great! Next, complete checkout for full access to KHDev.
Welcome back! You've successfully signed in.
You've successfully subscribed to KHDev.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.