Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon

Tags: #<Tag:0x00007f1e5b6b5758> #<Tag:0x00007f1e5b6b5500> #<Tag:0x00007f1e5b6b52a8>
(Markus) #141

maybe this will help you:


(Kim Skatun) #142

Thanks, how should the config.ini file look like with the new inbuilt broker? I have now successfully created a miflora.things file and updated my miflora.items… So now I only need to be able to connect to the broker:

[2019-02-05 21:52:26] Connecting to MQTT broker ...
[2019-02-05 21:52:26] MQTT connection error. Please check your settings in the configuration file "config.ini"

(Markus) #143

Have you installed the addon “Embedded MQTT Broker” (to be found under Misc) besides the MQTT binding?

1 Like

(Kim Skatun) #144

Thanks that did the trick, I will share my setup sometime next week when everything is working again.


(Kim Skatun) #145

It is a common fact that the physical bluetooth range of the miflora devices are not the best… So to extend this my idea is to use a rpi zero. So does anyone has an image for this purpose, it seems overkill to install openhabian for this. (or is it possible to easily deactivate OH server somehow?)

The second thing is that the config.ini file is located on the OH master, and this should be updated to rpi zero slave every time the file are edited on the master, i.e every time you add a new sensor(so not super often…).

By this strategy we will spam the MQTT broker with same sensor information, if the sensor are picked up the OH master as well as rpi zero slave, not a big issue but it could be avoided or? So can the slave subscribe to MQTT topic and check if the topic has same value as what is suppose to send just now? Or is this already implemented, that it only send messages if it has changed it value?


(Thomas Bail) #146

openHabian assembles a lot of things. Currently i am not using the script anymore because i use the 3rd Party Bluetooth binding with the mifloras. Anyhow i have range problem too as expected with bluetooth le.

I use some old Raspberry pi version 1 with a DietPi Image. DietPi is small and lightweight and the MiFlora script should run on a pi zero as well


(Kim Skatun) #147

This makes it hard to make a slave, because then miflora needs to be connected to the master only.

Do you have an image file for this? Or should we make one where it comes preinstalled with miflora and share it somewhere here?


(Thomas Bail) #148

Yeah, my approach is different, but you should be able to download a DietPi imange install it on a pi zero and trasfer some scripts from openHabian to the pi zero. i Think an onwn image is to much


(Thomas Bail) #149

Has someone manged to use a BlueGiga Adapter instead of a HCI Adapter? Currently i am struggeling at installing the pygatt library

Any hints?


(Thomas Bail) #150

Ok, slved the problem with pygatt. Just include it in the requirements.txt. Next step is then to change the BT BAckend in the script. Unfortunately the script is not working properly with two sensors and bluegiga adapters. Have to digg in it more deaply.


(Alexander) #151

Hey guys,
having some issues getting updates on the miflora items in OH 2.4 with firmware 3.1.9.
I do get feedback on the command line

[2019-03-28 23:48:51] Retrieving data from sensor "sensor1" ...
[2019-03-28 23:48:51] Result: {"temperature": 19.6, "moisture": 15, "battery": 100, "conductivity": 131, "light": 14}
[2019-03-28 23:48:51] Publishing to MQTT topic "miflora/sensor1"

But when I add items to OH I don’t get the updates…

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", port=1883, secure=false, username="___", password="___", clientID="openhab" ] {
    Thing topic FicusBen "Ficus Benjamin"   {
            Type number : light         "Light Intensity"   [ stateTopic="miflora/sensor1", transformationPattern="JSONPATH:$.light" ]
            Type number : battery       "Battery Charge"    [ stateTopic="miflora/sensor1", transformationPattern="JSONPATH:$.battery" ]
            Type number : temperature   "Temperature"       [ stateTopic="miflora/sensor1", transformationPattern="JSONPATH:$.temperature" ]
            Type number : conductivity  "Soil Fertility"    [ stateTopic="miflora/sensor1", transformationPattern="JSONPATH:$.conductivity" ]
            Type number : moisture      "Soil Moisture"     [ stateTopic="miflora/sensor1", transformationPattern="JSONPATH:$.moisture" ]


Number    Ficus_Moisture      "Soil Moisture Ficus [%d %%]"       <humidity>       { channel="mqtt:broker:mosquitto:FicusBen:moisture" }

The only thing log viewer throws out is this:

Link 'Ficus_Moisture-mqtt:broker:mosquitto:FicusBen:moisture' has been added.

…but that’s it - no updates.

Any idea what’s wrong here?

Edit: Solved it! Maybe this helps user openhabFan, too.
For the item I used the channel mqtt:broker:mosquitto:FicusBenjamin:moisture while it needed to be mqtt:topic:mosquitto:FicusBenjamin:moisture.
Works like a charm now :slight_smile:


(Thomas Bail) #152

Hi There,

has someone used the miflora deam with the homeassistant message format and the new mqtt binding?

I tried that and the binding discovered a lot of things. As i am nit familiar with the format my question is, if this is right that i get a thing in the inbox for each sensores channel (temperatur, moisture, …)

My expectation was one Thing with some channels