Page 4 of 5

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 09 April 2019 6:56
by mgabor
Dear PatrickM,
I have same problem as you. I use MIJIA BLE Temp&Hum sensor and after a couple of hours there's a bluetooth error and this breaks the domoticz python plugin system. Do you have found any solution the problem?
Regards,
Gabor

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 09 April 2019 21:11
by tonbor
No, I use the script not the plugin, that works fine

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Friday 12 April 2019 23:39
by krizzz
For the ones where the script is working. What is your distantice between your Pi and your plant with the sensor?


Verzonden vanaf mijn iPhone met Tapatalk

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 16 April 2019 10:54
by tonbor
I got 13 mi flower, largest distance is 11 meters.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 16 April 2019 12:26
by krizzz
tonbor wrote:I got 13 mi flower, largest distance is 11 meters.
WoW! Nice! So the script is working for you?

Are there any wals beteren your pi and the mi flower?


Verzonden vanaf mijn iPhone met Tapatalk

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Wednesday 01 May 2019 18:57
by tonbor
Yes 11 meter and two wals, one thin other big......

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Sunday 05 May 2019 0:01
by sincze
1 wall... And nothing here :(

Sent from my ONEPLUS A6003 using Tapatalk


Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Sunday 05 May 2019 7:01
by krizzz
sincze wrote:1 wall... And nothing here :(

Sent from my ONEPLUS A6003 using Tapatalk
I have got exactly the same.

@tonbor, which USB Bluetooth adapter are you using?



Verzonden vanaf mijn iPhone met Tapatalk

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Sunday 05 May 2019 11:36
by sincze
krizzz wrote: Sunday 05 May 2019 7:01
sincze wrote:1 wall... And nothing here :(

Sent from my ONEPLUS A6003 using Tapatalk
I have got exactly the same.

@tonbor, which USB Bluetooth adapter are you using?



Verzonden vanaf mijn iPhone met Tapatalk
Good question I am using the internal one in a geekworn metal enclosure.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Thursday 09 May 2019 9:38
by tonbor
A got the original from the rasp 3B+ in a plastic enclosure, metal blocks the bluetooth signal to much and at my second rasp a external one hanging at an usb cable in the right place.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Thursday 09 May 2019 11:52
by sincze
Tnx. I have to go external. Now in metal enclosure indeed. Specific dongle??

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Thursday 09 May 2019 17:36
by tonbor
I bought a CSR 4.0, first I received a fake one so beware. A logilink 100 meter had a worse performance compered to the CSR 4.0.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Thursday 09 May 2019 17:47
by sincze
Found one (mini) in the box of spares :)
Now searching for extension cable. Fingers crossed.
Tnx.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Thursday 27 June 2019 18:53
by coen17st
Does this plugin works in Domoticz on Windows OS or only Raspbian?

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Saturday 28 March 2020 4:37
by dheuts
Really nice plugin, thanks a lot!
Unfortunately I can't get it up and running.
I get A "Poller error" on version v2020.1 on a Raspberry with Buster installed.

Didnt use the plugin before. Also Tried both Python updating commands as mentioned in the Readme, no difference.

Can someone please help me? Thanks a lot!

UPDATE: Before, I added the devices manually with their Mac addresses. After reinstalling and leaving the script plugin at Automatic, it only found one of them. I think the other one was out of range and caused the “poller error”.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Wednesday 30 September 2020 13:50
by MadMedic
Hi guys,

Got all of the Xiaomi mi flower sensors (international version), 5 of them, working perfectly for a month now, with a Rpi 3B with the internal BLE chip.
Once in a while a poller error with the last of the 5 sensors. Only twice a week or so,

But, the problem I have now is the very poor lifetime of the CR 2032 batteries.
The first set of batteries (that came with the sensors) only lasted for 3 weeks.
The second set of batteries which I bought at Action (5 for € 1,49) lasted only 5 days ! 220mAh

Now I bought a third, i hope better, set of CR 2032 buttoncells batteries, 'Energizer' brand, which are 280 mAh (10 for € 19,- )
Going to put them in now and hope they will last a little bit longer.

But the question I have remains, since I'm only polling once a day at the most... how can it be that those batteries last so short ?
They supposed to have enough charge for at least half a year !

Anyone have an idea with can be the issue here ?

Just FYI..
  1. polling done only 1 times a day, via the timer of the manual switch,
  2. In the plugin settings the mac adresses were captured automaticly,
    now changed it into manually, to see if it will give a better result.
  3. mi flora python script is not being updated automaticly
  4. no entries in logs that sensors are being updated more then once a day
  5. distances between sensors and Rpi is 5 mtr at the most, through one thin wall, reception is mostly OK, except for a very few polling errors
  6. and lastly, no water in the sensors, all rubber sealings intact, all batteries and contacts are dry, so no short circuits
I'm totally puzzled. Hope someone can help me with this.


And this is how it looks in 'homehabit'
Spoiler: show
hh2.png
hh2.png (166.66 KiB) Viewed 1638 times

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Wednesday 07 October 2020 22:52
by MadMedic
No visionairy answers or insights ? hmm

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Tuesday 13 October 2020 23:03
by lwolf
MadMedic wrote: Wednesday 30 September 2020 13:50 But, the problem I have now is the very poor lifetime of the CR 2032 batteries.
The first set of batteries (that came with the sensors) only lasted for 3 weeks.
The second set of batteries which I bought at Action (5 for € 1,49) lasted only 5 days ! 220mAh
You can try to scan MiFlower sensors passively to see if it changes battery life.
RPIEasy "Environment - BLE Xiaomi sniffer" plugin supports them.

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Thursday 05 November 2020 15:06
by appelflap
Passively scanning for BLE data is best option then. GATT takes a lot of battery life from the sensor

This is an awesome place to start if you want to write a python plugin: https://github.com/frawau/aioblescan
It's also being used by this plugin for homeassistant: https://github.com/custom-components/sensor.mitemp_bt

In bash you could use `hcitool -i hci0 lescan --duplicate` with `btmon` and process the incoming lines with a while loop and `read`. Filtering on Miflora like data with uuids 0xfe95.

Code: Select all

hcitool -i hci0 lescan --duplicate >/dev/null 2>&1 &

Code: Select all

while IFS= read -r line; do  <your-script-here> "$line" ; done < <(unbuffer btmon | grep "Service Data" | grep 0xfe95 2>&1)
The above script outputs something equal to this. You could parse it further or stash it in a logfile.

Code: Select all

Service Data (UUID 0xfe95): 712098002118506a8d7cc40d0910023f04
Service Data (UUID 0xfe95): 71209800ec85bf6a8d7cc40d071003f20000
Service Data (UUID 0xfe95): 712098002118506a8d7cc40d0910023f04
Service Data (UUID 0xfe95): 712098002218506a8d7cc40d041002de00
Service Data (UUID 0xfe95): 71209800ed85bf6a8d7cc40d08100164
Service Data (UUID 0xfe95): 712098002218506a8d7cc40d041002de00
Take the last row for example. This data (0x712098002218506a8d7cc40d041002de00) contains a prefix (0x71209800), msg counter (0x22), hw address (18506a8d7cc4 -> C4:7C:8D:6A:50:18) , 0x0d, and the actual part we want (0x041002de00).

This last part contains a data type, the 0x10 (i guess the number base: 16), the length of the data and the value of the sensor. For the four sensor types it could give:

Code: Select all

type  ?  length  data
04    10 02      c900    -> temperature in 0.1°C  0x00c9 = 201 (20.1°C) 
07    10 03      d24101  -> light in lux          0x0141d2 = 82386 lux  
08    10 01      38      -> moisture in %         0x38 = 56%            
09    10 02      7011    -> conductivity in µS/cm 0x0619 = 1561 µS/cm  
Parsing data from the first step gives:

Code: Select all

2020-11-05 12:49:46 - C4:7C:8D:6A:BF:85 [0x07] - 197 (0x0000C5) is light in lux
2020-11-05 12:49:52 - C4:7C:8D:6A:50:18 [0x04] - 22.1 (0x00DD) is temperature degrees C
2020-11-05 12:49:56 - C4:7C:8D:6A:BF:85 [0x08] - 100 (0x64) is moisture in %
2020-11-05 12:50:03 - C4:7C:8D:6A:BF:85 [0x09] - 4591 (0x11EF) conductivity in uS/cm
2020-11-05 12:50:04 - C4:7C:8D:6A:50:18 [0x07] - 645 (0x000285) is light in lux
2020-11-05 12:50:11 - C4:7C:8D:6A:50:18 [0x08] - 50 (0x32) is moisture in %
2020-11-05 12:50:16 - C4:7C:8D:6A:BF:85 [0x04] - 18.9 (0x00BD) is temperature degrees C
2020-11-05 12:50:23 - C4:7C:8D:6A:50:18 [0x09] - 1097 (0x0449) conductivity in uS/cm
2020-11-05 12:50:26 - C4:7C:8D:6A:BF:85 [0x07] - 257 (0x000101) is light in lux
2020-11-05 12:50:32 - C4:7C:8D:6A:50:18 [0x04] - 22.1 (0x00DD) is temperature degrees C
You could parse it to JSON and throw it at Domoticz. Implementation details depends on your setup.

Code: Select all

{"timestamp":"2020-11-05 12:59:37","hwaddr":"C4:7C:8D:6A:50:18","type":"moisture","cnt":"30","value":"50"}
{"timestamp":"2020-11-05 12:59:37","hwaddr":"C4:7C:8D:6A:BF:85","type":"temperature","cnt":"fb","value":"18.9"}
{"timestamp":"2020-11-05 12:59:37","hwaddr":"C4:7C:8D:6A:50:18","type":"conductivity","cnt":"31","value":"1087"}
{"timestamp":"2020-11-05 12:59:40","hwaddr":"C4:7C:8D:6A:BF:85","type":"luminocity","cnt":"fc","value":"230"}

Re: Python plugin: Xiaomi Mi Flower Mate

Posted: Thursday 05 November 2020 20:19
by joostnl
I don't wanna steal the thread, but i finally got the sensors working stable. Plugins and scripts didn't work for me.

Buy an esp32 from aliexpress and put openmqqt gateway on it.
With help of nodered transfer the sensors values. No battery info because it's not really connecting to the sensors.
Let me know if you need help

viewtopic.php?f=51&t=30637&p=259485#p259485