Xiaomi Mi Plants Monitor Flower

@Danielhiversen
Since I put your code is not working.

I upgraded to 38.1 and not working, after changed to your latest code and still not working.

No data displayed

Any errors in the log?
Is the component working with default code (without my changes) ?

Upgrading to 38.1 did not over write your code?

Do not think so.

Ahh

Well so is still your code.
No error in log

This is what I mean about the odd light sensor readings. It seems to be in the same constant range all night, then a random spike to 400 at about 16:00

in configuration.yaml try:

logger:
  logs:
    miflora.miflora_poller: debug
    homeassistant.components.sensor.miflora: debug

ValueError: Expecting value: line 1 column 1 (char 0)
17-02-15 21:08:20 DEBUG (Thread-3) [homeassistant.components.sensor.miflora] Polling data for Flower 1 Light intensity
17-02-15 21:08:20 DEBUG (Thread-3) [miflora.miflora_poller] Enter read_ble (<Thread(Thread-3, started daemon 1955591264)>)
17-02-15 21:08:20 DEBUG (Thread-3) [miflora.miflora_poller] Created lock in thread <Thread(Thread-3, started daemon 1955591264)>
17-02-15 21:08:20 DEBUG (Thread-3) [miflora.miflora_poller] Running gatttool with a timeout of 20
17-02-15 21:08:29 ERROR (Thread-7) [homeassistant.components.switch.command_line] Command failed: curl “http://192.168.1.52:8080/status.json
17-02-15 21:08:29 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: ‘value_json’ is undefined (value: None, template: {{ value_json.curvals.torch == “on” }})
17-02-15 21:08:29 ERROR (Thread-8) [homeassistant.components.switch.command_line] Command failed: curl “http://192.168.1.50:8080/status.json
17-02-15 21:08:29 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: ‘value_json’ is undefined (value: None, template: {{ value_json.curvals.torch == “on” }})
17-02-15 21:08:40 DEBUG (Thread-3) [miflora.miflora_poller] Killed hanging gatttool
17-02-15 21:08:40 DEBUG (Thread-3) [miflora.miflora_poller] Released lock in thread <Thread(Thread-3, started daemon 1955591264)>
17-02-15 21:08:40 DEBUG (Thread-3) [miflora.miflora_poller] Got from gatttool
17-02-15 21:08:40 DEBUG (Thread-3) [miflora.miflora_poller] Waiting for 10 seconds before retrying
17-02-15 21:08:50 DEBUG (Thread-3) [miflora.miflora_poller] Created lock in thread <Thread(Thread-3, started daemon 1955591264)>
17-02-15 21:08:50 DEBUG (Thread-3) [miflora.miflora_poller] Running gatttool with a timeout of 20
17-02-15 21:08:59 ERROR (Thread-6) [homeassistant.components.switch.command_line] Command failed: curl “http://192.168.1.50:8080/status.json
17-02-15 21:08:59 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: ‘value_json’ is undefined (value: None, template: {{ value_json.curvals.torch == “on” }})
17-02-15 21:09:10 DEBUG (Thread-3) [miflora.miflora_poller] Killed hanging gatttool
17-02-15 21:09:10 DEBUG (Thread-3) [miflora.miflora_poller] Released lock in thread <Thread(Thread-3, started daemon 1955591264)>
17-02-15 21:09:10 DEBUG (Thread-3) [miflora.miflora_poller] Got from gatttool
17-02-15 21:09:10 DEBUG (Thread-3) [miflora.miflora_poller] Waiting for 20 seconds before retrying
17-02-15 21:09:10 DEBUG (Thread-3) [miflora.miflora_poller] Created lock in thread <Thread(Thread-3, started daemon 1955591264)>
17-02-15 21:09:10 DEBUG (Thread-3) [miflora.miflora_poller] Running gatttool with a timeout of 20
17-02-15 21:09:29 ERROR (Thread-8) [homeassistant.components.switch.command_line] Command failed: curl “http://192.168.1.50:8080/status.json
17-02-15 21:09:29 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: ‘value_json’ is undefined (value: None, template: {{ value_json.curvals.torch == “on” }})
17-02-15 21:09:30 DEBUG (Thread-3) [miflora.miflora_poller] Killed hanging gatttool
17-02-15 21:09:30 DEBUG (Thread-3) [miflora.miflora_poller] Released lock in thread <Thread(Thread-3, started daemon 1955591264)>
17-02-15 21:09:30 DEBUG (Thread-3) [miflora.miflora_poller] Got from gatttool
17-02-15 21:09:30 DEBUG (Thread-3) [miflora.miflora_poller] Waiting for 20 seconds before retrying
17-02-15 21:09:30 DEBUG (Thread-3) [miflora.miflora_poller] Exit read_ble, no data (<Thread(Thread-3, started daemon 1955591264)>)
17-02-15 21:09:30 INFO (Thread-3) [homeassistant.components.sensor.miflora] Polling error [Errno Could not read data from Mi Flora sensor %s] C4:7C:8D:61:7C:01
17-02-15 21:09:30 DEBUG (Thread-1) [homeassistant.components.sensor.miflora] Polling data for Flower 1 Temperature
17-02-15 21:09:30 DEBUG (Thread-1) [miflora.miflora_poller] Using cache (0:15:00.013710 < 0:20:00)
17-02-15 21:09:30 INFO (Thread-1) [homeassistant.components.sensor.miflora] Polling error [Errno Could not read data from Mi Flora sensor %s] C4:7C:8D:61:7C:01
17-02-15 21:09:30 DEBUG (Thread-8) [homeassistant.components.sensor.miflora] Polling data for Flower 1 Battery
17-02-15 21:09:30 DEBUG (Thread-8) [miflora.miflora_poller] Enter read_ble (<Thread(Thread-8, started daemon 1906308192)>)
17-02-15 21:09:30 DEBUG (Thread-8) [miflora.miflora_poller] Created lock in thread <Thread(Thread-8, started daemon 1906308192)>
17-02-15 21:09:30 DEBUG (Thread-8) [miflora.miflora_poller] Running gatttool with a timeout of 20
17-02-15 21:09:50 DEBUG (Thread-8) [miflora.miflora_poller] Killed hanging gatttool
17-02-15 21:09:50 DEBUG (Thread-8) [miflora.miflora_poller] Released lock in thread <Thread(Thread-8, started daemon 1906308192)>
17-02-15 21:09:50 DEBUG (Thread-8) [miflora.miflora_poller] Got from gatttool
17-02-15 21:09:50 DEBUG (Thread-8) [miflora.miflora_poller] Waiting for 10 seconds before retrying

May I have the previous code?

FYI - These are on sale for $10 via email only special

http://m.gearbest.com/other-garden-supplies/pp_373947.html?wid=21&utm_source=mail_api&utm_medium=mail&utm_campaign=special.0209&eo=rSDoB3fEKyykH6ho&email=b2t8c0BiYXJyZXR0LnJlZHwxMjI0OQ==

Time to stock up!

It shows up at 12.89$ for me, and they always can be found for less than 10$ on Aliexpress :grinning: :

https://www.aliexpress.com/item/Original-Xiaomi-Mi-Flora-Monitor-Digital-Plants-Grass-Flowers-Soil-Water-Light-Smart-Tester-Sensor-for/32716710859.html

Hi, huge fan and I just ordered four sticks :slight_smile:

A couple of questions if someone can help out:

  1. When using multiple mi flora sticks, is there any other issue then that it takes time a bit extra time until all data are collected? (read something about locking…)
  2. I read something about using Razberry 2 disables bluetooth on the PI3, anyone know the case?
  3. Would it be possible using PI3 to setup another bluetooth USB adaptor, so it does not interfere with the tracker?
  4. IF there are issues, is that the case if you use a Z-wave usb stick like Aeon Labs 5gen (in conjunction with either PI3 bluetooth, or a separate bluetooth usb dongle)?

I can’t get it working anymore. How do you connect it to the HASS (I have mine on a pi3 with bluetooth, but is not picking any bluetooth signel from the miflora).

pi@raspberrypi:~ $ sudo hcitool lescan
Set scan parameters failed: Input/output error
pi@raspberrypi:~ $

  1. Yes, correct. I have several sensors and it is working fine.

3, Yes, from the latest release you can specify which Bluetooth adapter to use for each miflora device

1 Like

From release 0.39 of HA the will be more failure check of the data: https://github.com/home-assistant/home-assistant/pull/6142
So it should be less change of getting invalid data from the sensors.

1 Like

Damn, I wish i knew of this before buying a Parrot Flower power :frowning:

Can some one help integrate it to HASS?

Upgraded to 0.39 and the miflora has finally stabilized. Keeping fingers crossed. :fearful:

1 Like

Hi all,

I’ve just bought 2 of those sensor.

One have been founded by the raspberry pi BLE device tracker (the other one no, but that’s another question).

I took the MAC address and added the sensor in my sensors.yaml.

I can see the icons, but in 24h they don’t received any update (while I can see the situation on the Xiaomi app on my android phone).

Can someone please help me to find out the solution?

Thank you in advance

Just got two of these sensors. They weren’t working with HA so I tried to do some debugging. Data came back as all 0’s, so I tried:

gatttool --device=C4:7C:8D:61:6F:7F --char-write --handle=0x0033 --value=0xA01F

That however seems to never complete, it hangs forever. Anyone encounter this before?

Since I upgraded to 0.39… I’ve not had a single MiFlora update very occasionally HASS shows the battery level for 1 sensor (I have 4), so my question is where did the rest of the data go? B4 0.39 MiFlora worked flawlessly.