Xiaomi Mi Plants Monitor Flower

Hi guys,
been following the thread for some time. Actually being able to access the MiFlora data remotely, was the sole (or final) reason to jump into the RasPi adventure in the first place (with no prior knowledge of Linux other the Ubuntu-GUI). After an interesting learning curve, I’ve now managend to set-up mi Pi Zero W headless with HA, Samba, Influx-DB and Grafana running. The two MiFlora sensors also show up in HA (0.41), unfortuntely I don’t get any readings.

hciconfig

shows:

  hci0:   Type: BR/EDR  Bus: UART
        BD Address: B8:27:EB:AD:99:D1  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:923048 acl:0 sco:0 events:131755 errors:0
        TX bytes:1451149 acl:0 sco:0 commands:131744 errors:0

And sudo hcitool lescan also shows the two MiFlora devices with the same Mac-Adress i use in the config.yaml.

Any suggestions? :slight_smile:

Thanks!

Similar issues here as well… I have 2 sensors, they worked fine in the beginning until all of a sudden, one of them doesn’t want to update anymore.

Below is what I tried with like 5 minutes in between… So not a consistent error message I would say…

pi@hassbian:~ gatttool --device=C4:7C:8D:62:E2:66 --char-read -a 0x35
connect error: Transport endpoint is not connected (107)
pi@hassbian:~ $ gatttool --device=C4:7C:8D:62:E2:66 --char-read -a 0x35
Characteristic value/descriptor: aa bb cc dd ee ff 99 88 77 66 00 00 00 00 00 00 

I replaced the battery, deactived the other (working) sensor, all without succes…

For the record, sudo hcitool lescan shows me both sensors. One thing ‘strange’ is that the name is different for both of them but it worked before, so no clue what may be causing this…

C4:7C:8D:62:3F:FA Flower mate
C4:7C:8D:62:E2:66 Flower care

What else… I put these on the built-in bluetooth controller of my RPI3. I did add another one (ASUS BT400) as I also wanted to implement flic-buttons and various sources (+ own experience) already showed that that was going to be an issue. For what it’s worth, the built-in was HCI0 first but become HCI1 after I started using the ASUS dongle as well. But in the configuration.yaml file, I made sure to have the right adapter mentioned.

pi@hassbian:~ $ hciconfig
hci1:	Type: BR/EDR  Bus: UART
	BD Address: B8:27:EB:81:E8:0C  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:4278 acl:18 sco:0 events:265 errors:0
	TX bytes:3062 acl:18 sco:0 commands:160 errors:0

hci0:	Type: BR/EDR  Bus: USB
	BD Address: 5C:F3:70:7E:7C:E2  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:748478 acl:0 sco:0 events:65 errors:0
	TX bytes:2195 acl:0 sco:0 commands:323 errors:0

  - platform: miflora
    mac: !secret sensor_miflora_planter1_mac
    name: planter1
    adapter: hci1
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

  - platform: miflora
    mac: !secret sensor_miflora_planter2_mac
    name: planter2
    adapter: hci1
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

Suggestions are welcome.

Have you guys seen this?

https://github.com/ChristianKuehnel/plantgateway

The author has also made a pull request into Home Assistant. Looks promising!

2 Likes

I dont’ receive any message (witho or without sudo)!

Is bluetooth running?

Good question.

How can I discover that? Sorry for the newbie question!

Also make sure that the phone is not still connected, since the sensor can only be connected to one bt at a time.

sudo systemctl status bluetooth

will display the bluetooth status

Pretty sure this is due to the firmware version of the sensor. 2.6.(something) shows up as “flower mate”, once you update to 2.7 or higher it is listed as flower care. Could you figure out, which one is the faulty one?

this is the results

● bluetooth.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

Hmmm looks like you haven’t installed the bluetooth files.

What does…

sudo /etc/init.d/bluetooth restart

give you, it should look like this…

[ ok ] Restarting bluetooth (via systemctl): bluetooth.service.

Then if you do …

ps -ef | grep blue

you should see the bluetooth service running.

I’ve no idea what the error is, mine is now showing the same and so far the MiFlora’s are all dorment :frowning:

I found this http://raspberrypi.stackexchange.com/questions/40839/sap-error-on-bluetooth-service-status

which may help get rid of the error

Ok, this is super embarrassing! :flushed:

When setting up HA it took me some time to figure out the .yaml-thing, and I played around quite a bit with the code in the yaml-validator because I could not get HA to boot initially. Apparently I added a backspace in the field for the mac address> ( " XX:XX…") at some point. Still proper yaml-code but HA doesn’t any read the sensor data with this extra backspace.

Long story short: IT WORKS! HOLY SMOKES IT WORKS. :grin: The data also shows up on Grafana! Suddenly everything falls into place. My very first Pi Project!

Thanks for everything ( software, forum, tutorials) !

Nota bene: I can confirm that the Mi Flora Sensors does run with the latest firmware in the sensor (2.9.something) and the latest version of HA (0.41) on a PI ZERO W. Rasbian was installed with PiBakery and only runs HA, Samba, InfluxDB and Grafana so far.

:grinning:

1 Like

The one that identifies as ‘flower care’ (with mac address ending 66) is the faulty one.

Have you managed to figure out why it returns aa bb cc dd ee ff 99 88 77 66 00 00 00 00 00 00 mine also does it.
Its running firmware version 2.7.0

no, I gave up and disconnected the sensor for now

@farstreet i have no idea what changed but now i get data from mine the temp is 0 so that is totally wrong but its better than the dummy values i was getting before.

I receive an error:

sudo: /etc/init.d/bluetooth: command not found

so I suppose that bluez-5.9 is not installed right?

I would guess so, did you get an error when installing?

No. No error until the command sudo hciconfig hci0 up.

Do you suggest me to restart the process again?