Xiaomi Mi Plants Monitor Flower

Works for me on 0.71, thanks for pointing that out. Nice feature!

I had to do a total restart of HA, reloading customize didn’t do it.

Screenshot%20from%202018-06-15%2013%3A50%3A40

Wonder if you can use a camera stream…

I’ve had mine a week now and it just doesn’t work with Home Assistant. I paired it with the app to see if it actually works and it did, so I updated it and unpaired it and it is still the same. BT finds it fine but it shows up as unknown and the debug error is

2018-06-16 09:58:07 INFO (SyncWorker_6) [homeassistant.components.sensor.miflora] Polling error Exit read_ble, no data (<Thread(SyncWorker_6, started daemon 139648797959936)>)
2018-06-16 09:58:07 DEBUG (SyncWorker_3) [homeassistant.components.sensor.miflora] Polling data for Greenhouse Temperature
2018-06-16 09:58:07 DEBUG (SyncWorker_3) [miflora.miflora_poller] Using cache (0:17:04.302044 < 0:20:00)
2018-06-16 09:58:07 INFO (SyncWorker_3) [homeassistant.components.sensor.miflora] Polling error Could not read data from Mi Flora sensor C4:7C:8D:66:5F:A4
2018-06-16 09:58:07 DEBUG (SyncWorker_8) [homeassistant.components.sensor.miflora] Polling data for Greenhouse Light intensity
2018-06-16 09:58:07 DEBUG (SyncWorker_8) [miflora.miflora_poller] Using cache (0:17:04.379128 < 0:20:00)
2018-06-16 09:58:07 INFO (SyncWorker_8) [homeassistant.components.sensor.miflora] Polling error Could not read data from Mi Flora sensor C4:7C:8D:66:5F:A4
2018-06-16 09:58:08 DEBUG (SyncWorker_7) [homeassistant.components.sensor.miflora] Polling data for Greenhouse Moisture
2018-06-16 09:58:08 DEBUG (SyncWorker_7) [miflora.miflora_poller] Using cache (0:17:04.769768 < 0:20:00)
2018-06-16 09:58:08 INFO (SyncWorker_7) [homeassistant.components.sensor.miflora] Polling error Could not read data from Mi Flora sensor C4:7C:8D:66:5F:A4
2018-06-16 09:58:08 DEBUG (SyncWorker_8) [homeassistant.components.sensor.miflora] Polling data for Greenhouse Conductivity
2018-06-16 09:58:08 DEBUG (SyncWorker_8) [miflora.miflora_poller] Using cache (0:17:04.802385 < 0:20:00)
2018-06-16 09:58:08 INFO (SyncWorker_8) [homeassistant.components.sensor.miflora] Polling error Could not read data from Mi Flora sensor C4:7C:8D:66:5F:A4
2018-06-16 09:58:08 DEBUG (SyncWorker_7) [homeassistant.components.sensor.miflora] Polling data for Greenhouse Temperature
2018-06-16 09:58:08 DEBUG (SyncWorker_7) [miflora.miflora_poller] Using cache (0:17:04.875416 < 0:20:00)
2018-06-16 09:58:08 INFO (SyncWorker_7) [homeassistant.components.sensor.miflora] Polling error Could not read data from Mi Flora sensor C4:7C:8D:66:5F:A4
2018-06-16 09:58:08 DEBUG (SyncWorker_5) [homeassistant.components.sensor.miflora] Polling data for Greenhouse Light intensity
2018-06-16 09:58:08 DEBUG (SyncWorker_5) [miflora.miflora_poller] Using cache (0:17:04.908035 < 0:20:00)
2018-06-16 09:58:08 INFO (SyncWorker_5) [homeassistant.components.sensor.miflora] Polling error Could not read data from Mi Flora sensor C4:7C:8D:66:5F:A4
2018-06-16 09:58:08 DEBUG (SyncWorker_0) [homeassistant.components.sensor.miflora] Polling data for Greenhouse Battery

and

gatttool --device=C4:7C:8D:66:5F:A4 --char-read -a 0x35
Characteristic value/descriptor: aa bb cc dd ee ff 99 88 77 66 00 00 00 00 00 00

gatttool --device=C4:7C:8D:66:5F:A4 --char-read -a 0x3
Characteristic value/descriptor: 46 6c 6f 77 65 72 20 63 61 72 65


any ideas please? it is currently sat 5 ft away from the NUC

Cheers
Mark

My bad! The file wasn’t included in my commit, works fine now. Thanks!

Using ESP32 to communicate with Xiaomi flora (miflora) plant sensor using BLE and posting the values on MQTT server. I also demonstrate the use of Home Assistant miflora sensor component.

GitHub: GitHub - sidddy/flora: ESP32 BLE client for Xiaomi Mi Plant sensors
Change ESP32 Partition: https://desire.giesecke.tk/index.php/2018/04/20/change-partition-size-arduino-ide/
Home Assistant miflora sensor: Xiaomi BLE - Home Assistant

9 Likes

@debsahu Thanks for sharing your great work. Would it be possible to use more than one Xiaomi flora plant sensor with your sketch (e.g. an array of MAC addresses)? Thx

It is possible. I think that is in the pipeline. Please note that I didn’t write the code, but rather adapted the excellent code by github user Sidddy. You could create an issue there and all for that feature. The function is easily scalable to more than one sensor.

There is a fork from github user SubOrbit which supports multiple devices.

1 Like

@debsahu thanks for the link and video.
I’m struggling with my ESP32, keeps restarting after uploading the sketch, getting the following error in the console:

configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1496
load:0x40078000,len:8596
load:0x40080400,len:6980
entry 0x400806f4
ets Jun  8 2016 00:22:57

and can’t solve it.
Any help is appreciated.

Open an issue here: https://github.com/sidddy/flora/issues

Solved.
I was using the wrong board.

I got it working on the esp32 side, its connected to my mqtt server but it keeps getting disconnected,(1543100320: New client connected from 192.168.1.220 as miflora-client (c1, k15, u’miflora’).
1543100341: Client miflora-client has exceeded timeout, disconnecting.
1543100341: Socket error on client miflora-client, disconnecting.)

Do you know whats the problem?
I made a new user within my mqtt mosquitto server for miflora.

Hi!

I beginer with Home assistant.
I have two BLE sensor.
Mi Plants Flower monitor and Xiaomi BLE Temperature and Humidity sensor.
I use Homeassistant with Synology (Intel) with Docker.
Both BLE sensor works well if I add only one.
But If I add both BLE sensors, home assistant recongizes datas (temperature, humidity and battery ) only second one (Xiaomi LCD sensor in my sample) in configuration.yaml.

My sample code:

Xiaomi Mi plant sensor

sensor:

  • platform: miflora
    mac: C4:7C:8D:67:3B:XX
    name: Flower 1
    force_update: false
    median: 3
    monitored_conditions:
  • moisture
  • light
  • temperature
  • conductivity
  • battery

Xiaomi LCD sensor living room

sensor:

  • platform: mitemp_bt
    mac: 4C:65:A8:X8:AD:A1
    name: Kids Room Temp
    force_update: false
    median: 3
    monitored_conditions:
  • temperature
  • humidity
  • battery

Ha you got any idea?

I am struggeling to get the picture show.
in my customize.yaml file I put:

group.Main_Flower_Sensor_WZ:
friendly_name: Yucca Palme (WZ)
entity_picture: /local/Yucca_Palme.jpg

I see it when I click the group, but I want to see it already in the main view.
image

Hi guys,
I’m trying to set up irrigation with MI flora sensor and water drop pump that is connected to Xiaomi smart plug. I had to install clean Hassio for it to see the mi flora sensor and receive the data.
Could you please point me to the right direction, and example of code? I assume I need to create automation that looks at the moisture level every hour or so, and if its bellow a specific target turn on the plug for 20-30 seconds and then turn off again. Someone already did something similar, would really appreciate the help.

How do I get such a nice card in the overview?
I just added my Flora sensor to hass.io. I can see the sensor values in the states but there is nothing showing up in the overview.

I did exactly that for my plants in summer.
go to configuration -> automations
set a trigger that reads the numeric state of sensor.nameofyourplant_moisture
and set up an action to turn on your power.plug instance, another action to wait for 30 seconds and a third action to turn it off again.

for my setup I did include the automation to not fire when the sensors reads 0, because this sometimes happened because of a bad connection to the mi flora sensors (thick wall between my raspberry pi and the plants)

Thanks for the note, Ive managed to set it up!

I just got 6 sensors and 2 of them are running a old version of the firmware (i can’t even read them with HA), if i upgrade them with the app will they still work with HA?

noob question here.
I have an ESP8266 that I wanted to use for this.
More specifically: Geekcreit-NodeMcu-Lua-ESP8266-ESP-12E-WIFI-Development-Board
The compile has problems finding BLEDevice.h
Not every ESP8266 has BT?

no ESP8266 does not have Bluetooth.