Mi Flora with Tasmota

I’m trying to connect Mi Flora device to my HA using a ESP module with Tasmota firmware.
I bought an ESP32 with builtin Bluetooth LE, but when I configure it I cannot read Moisture and Fertility that are both always reading 0.
I then tried to usa an ESP8266 with an HM-10 Bluetooth LE module and from there I get even less data. Here are some screenshots:


Does anyone has a clue?
thx

Have you tried updating the firmware of your sensors?

Perhaps not the response you were looking for, but have you tried using ESPhome?

1 Like

Thx for your reply. The actually firmware is 3.2.1 and there is only 3.2.2 available. I’ll try updating…
Haven’t tried ESPhome… I think I’ll need to setup a docker container for that, but I wonder If I can add several different sensor to it.

Hi there,

i had the same problems with this. It seems to be a displaying problem in tasmota. I did some debugging and recognized that the sensor values are transmitted correctly. Only the display in MQTT-messages and on webinterface are incorrect. I will add an issue on tasmota firmware pages. For quick fix you could try to modify xsns_62_MI_HM10.ino file (Tasmota v8.3.1)

lines 1180 to 1184:

          if(!isnan(MIBLEsensors[i].moisture)){
            ResponseAppend_P(PSTR(",\"" D_JSON_MOISTURE "\":%d"), (int)MIBLEsensors[i].moisture);
          }
          if(!isnan(MIBLEsensors[i].fertility)){
            ResponseAppend_P(PSTR(",\"Fertility\":%d"), (int)MIBLEsensors[i].fertility);

The values are meant to be displayed in integer format but indeed they are float.

Also do modifications in lines 1225 to 1230:

          if(!isnan(MIBLEsensors[i].moisture)){
            WSContentSend_PD(HTTP_SNS_MOISTURE, kHM10SlaveType[MIBLEsensors[i].type-1], (int)MIBLEsensors[i].moisture);
          }
          if(!isnan(MIBLEsensors[i].fertility)){
            WSContentSend_PD(HTTP_HM10_FLORA_DATA, kHM10SlaveType[MIBLEsensors[i].type-1], (int)MIBLEsensors[i].fertility);
          }

Casting the values here is quick and dirty! I found out there is also a function which can convert float to string but not yet how to use it correctly. Anyway, in this cases integer should be enough because decimal place is not used.

Hope it helps…
Greetings

Edit: Using dtostrfd() is not the correct way. The method I described above is absolutely right. The developer who added the Mi Flora sensor declared a format string which expects also an integer value. So simply adding a (int/uint) cast should also be enough here…

What template did you use to integrate it into Home Assistant ?

Hello

Someone have the template for Tasmota ?? I did not find…

Hello. Problem solved. NO template needed. Only needed to activate BLE with setoption115 to 1

1 Like