Xiaomi Miflora Plant Sensor Not Working In HASSIO

I purchased a Xiaomi Mi flower plant sensor that specifically stated that it is the international version, and the supplier confirmed this and I have installed their app and it is in English and working well, but it is not pulling in the sensor values to home assistant. I have the standard Hassio installed, and apparently Bluetooth and the plant sensor should work by default. Here are my configuration files for this sensor:

plant.yaml

################################################
## Xiaomi MiFlora Plant Sensor 1
################################################

  xiaomi_miflora_1_sensor:
    sensors:
      moisture: sensor.xiaomi_miflora_1_moisture
      conductivity: sensor.xiaomi_miflora_1_conductivity
      brightness: sensor.xiaomi_miflora_1_brightness
      temperature: sensor.xiaomi_miflora_1_temperature
      battery: sensor.xiaomi_miflora_1_battery
    min_moisture: 20
    max_moisture: 60
    min_conductivity: 500
    max_conductivity: 3000
    min_brightness: 10
    max_brightness: 1200
    check_days: 3 # Time interval (in days) used when checking min_brightness. Default value: 3
    min_temperature: 15
    min_battery: 17

sensor.yaml

- platform: miflora
  mac: 'XX:XX:XX:XX:XX:XX' (did place actual values here)
  name: Back Garden
  force_update: false
  median: 3
  monitored_conditions:
    - moisture
    - light
    - temperature
    - conductivity
    - battery

What am I missing?

How long are you waiting to see data in HA? Data is pulled every 20 min by default.
Also what is your plant.yaml file?

Thanks for the reply I have been waiting since yesterday for anything to show up, & I have restarted my Raspberry pi 3B+ a few times, but no luck. The plant.yaml is just the way I break things out in Home Assistant, here is an example my configuration.yaml with all the .yaml files located in the main config directory.

speedtestdotnet:
  scan_interval:
    minutes: 30
  monitored_conditions:
    - ping
    - download
    - upload

################################################
## Include
################################################

alarm_control_panel: !include alarm_control_panel.yaml
binary_sensor: !include binary_sensor.yaml
camera: !include camera.yaml
climate: !include climate.yaml
conversation: !include conversation.yaml
group: !include groups.yaml
automation: !include automations.yaml
device_tracker: !include device_tracker.yaml
intent_script: !include intent_script.yaml
input_boolean: !include input_boolean.yaml
input_number: !include input_number.yaml
input_select: !include input_select.yaml
input_text: !include input_text.yaml
script: !include scripts.yaml
google: !include google.yaml
light: !include light.yaml
media_player: !include media_player.yaml
mycroft: !include mycroft.yaml
panel_iframe: !include panel_iframe.yaml 
mqtt: !include mqtt.yaml
plant: !include plant.yaml
sensor: !include sensor.yaml
stream: !include stream.yaml
notify: !include notify.yaml
shopping_list: !include shopping_list.yaml
switch: !include switch.yaml
tplink: !include tplink.yaml 
tts: !include tts.yaml
#konnected: !include konnected.yaml
variable: !include variable.yaml
weather: !include weather.yaml
weblink: !include weblink.yaml
zone: !include zone.yaml

Not sure if it will change anything if I place the plant: entity directly in the configuration.yaml.

ok I wasn’t aware of the plant component.
and I think this is where it’s not set up correctly. Do me a favour and confirm that when clicking on <> under developer tools in the front end, you can find a several sensors starting sensor.back_garden_
If so your miFlora component is set correctly, but your plant isn’t and I believe it should be:

  xiaomi_miflora_1_sensor:
    sensors:
      moisture: sensor.back_garden_moisture
      conductivity: sensor.back_garden_conductivity
      brightness:sensor.back_garden_brightness
      temperature: sensor.back_garden_temperature
      battery: sensor.back_garden_battery
    min_moisture: 20
    max_moisture: 60
    min_conductivity: 500
    max_conductivity: 3000
    min_brightness: 10
    max_brightness: 1200
    check_days: 3 # Time interval (in days) used when checking min_brightness. Default value: 3
    min_temperature: 15
    min_battery: 17

@riaandeyzel Is your Sensor white or Green in colour?

@jimpower The Sensor is Pure White like the one on the left

@lolouk44, I tried that but id did not make a difference. the sensors do show up in Home Assistant, but the values just stays on “Unknown”.

This is how I have mine

Firstly add Mi Flora Sensors

  - platform: miflora
    mac: 'C4:7C:8D:xx:xx:xx'
    name: Bougainvillea
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

Then reboot and add you plant component like this

plant:
  Bougainvillea:
    sensors:
      moisture: sensor.bougainvillea_moisture
      battery: sensor.bougainvillea_battery
      temperature: sensor.bougainvillea_temperature
      conductivity: sensor.bougainvillea_conductivity
      brightness: sensor.bougainvillea_light_intensity
    min_moisture: 10
    min_battery: 15

after you’ve amended your plant component, restart HA and wait a bit for the data to populate. Might take a few minutes

@lolouk44 @jimpower Thanks for your help so far, I have commented out the plant monitor, and I am now restarting HA, will wait for 40 min (Default Time) to see if any values appear.

Another question, Is it safe to use these sensors outdoors directly in the rain, or are they not that waterproof?

Mine have been outside in the elements for over 12 months and they are still chugging along

1 Like

Sensor values still displaying “Unknown”

Not sure what else could be wrong.

Stupid question, but are you sure you have the correct MAC Address then?
My MAC address is entered in all caps (no idea whether that makes a difference or not but worth a try)

I used my phone to bind the sensor with the app, and sometimes before it actually renames the sensor to Plantcare it displays the device MAC Address, that is how I got the MAC address. There are no other Bluetooth devices around. I have entered the MAC in all CAPS as displayed on the phone.

Ah I remember I had a similar issue. Remove the device from the Xiaomi app.
For me when using the app, HA would not manage to get the data, as if the app was locking the BT connection with the sensor…

I am working remotely from the office, and not at the sensor. should it not work in this case?, or should I be connected to the sensor via bluetooth with my phone and then just remove the device?

Can’t remember exactly, but I do remember that when the device was paired with the app on my phone it would not show up on HA.
So a test to run later on maybe?

@lolouk44 @jimpower Thanks for your help, It was the Mac Address that was wrong, I installed the “SSH & Web Terminal” Add-on in Hass.io and ran the commands “bluetoothctl”, then “scan on” and found that the MAC Address that my phone displayed for the sensor was different to what the Raspberry Pi detected. My phone must have displayed the MAC Address from an old paired device while scanning for the new sensor.

2 Likes

@riaandeyzel can you please share your full configuration?

Sure here you go