Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Coldman »

Update 2.8.6 date: 2017-01-06

Change log:
1. Fixed a bug of history data lost.
2. Fixed an abnormal issue when synchronize history data.
3. Fixed a bug that abnormal history data came out when temperature was below zero degree.
4. Fixed an issue that device restart unexpectedly due to the interval of connections.
5. Fixed a bug that users cannot connect with devices paired with the phone in the Bluetooth.
6. Cancelled Bluetooth pairing.
Spoiler: show
Screenshot_2017-01-06-22-08-46-409_com.huahuacaocao.flowercare.png
Screenshot_2017-01-06-22-08-46-409_com.huahuacaocao.flowercare.png (77.25 KiB) Viewed 4506 times
Screenshot_2017-01-06-22-08-13-014_com.huahuacaocao.flowercare.png
Screenshot_2017-01-06-22-08-13-014_com.huahuacaocao.flowercare.png (245.62 KiB) Viewed 4506 times
Screenshot_2017-01-06-22-08-25-757_com.huahuacaocao.flowercare.png
Screenshot_2017-01-06-22-08-25-757_com.huahuacaocao.flowercare.png (248.23 KiB) Viewed 4506 times
result of demo.py

Code: Select all

Getting data from Mi Flora
FW: 2.8.6
Name: Flower care
Temperature: 21.5
Moisture: 30
Light: 3
Conductivity: 529
Battery: 86
User avatar
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by LouiS22 »

probably a stupid question, but I'm assuming I have to enter the full path to the script in crontab, ie: /pi/domoticz/scripts/python/python3 domoticz.py?
Itschi
Posts: 18
Joined: Saturday 16 May 2015 14:58
Target OS: Windows
Domoticz version:
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Itschi »

Yes, you need to enter the full path.
Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

Re: RE: Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Coldman »

LouiS22 wrote:probably a stupid question, but I'm assuming I have to enter the full path to the script in crontab, ie: /pi/domoticz/scripts/python/python3 domoticz.py?
I think
python3 /home/pi/domoticz/scripts/python/domoticz.py

Отправлено с моего MI PAD 2 через Tapatalk
User avatar
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: RE: Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by LouiS22 »

Coldman wrote:
LouiS22 wrote:probably a stupid question, but I'm assuming I have to enter the full path to the script in crontab, ie: /pi/domoticz/scripts/python/python3 domoticz.py?
I think
python3 /home/pi/domoticz/scripts/python/domoticz.py

Отправлено с моего MI PAD 2 через Tapatalk
Thanks, that was it!
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by remb0 »

great work all!

I tried it and get:

Code: Select all

python3 domoticz.py
Getting data from Mi Flora: c4:7C:8D:62:48:52
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
FW: None
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
Traceback (most recent call last):
  File "domoticz.py", line 71, in <module>
    update("c4:7C:8D:62:48:52","1478","1476","1477","1479")
  File "domoticz.py", line 42, in update
    print("Name: {}".format(poller.name()))
  File "/home/pi/domoticz/scripts/python/miflora/miflora/miflora_poller.py", line 173, in name
    return ''.join(chr(n) for n in name)
TypeError: 'NoneType' object is not iterable

second time:

python3 domoticz.py
Getting data from Mi Flora: c4:7C:8D:62:48:52
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
FW: 2.8.6
Name: Flower care
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
connect error: Transport endpoint is not connected (107)
Moisture: 136
Light: 61149
Conductivity: 26231
Battery: 100
Temperature: 4804.2

I updated my python to 3. installed request.
have the correct mac and with hcitool scan I see Flower Care.
trixwood

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by trixwood »

the second try looks like it has trouble reading it... it retries... and succeeded :-)

The first try probably related to bad error handling... I usually have issues with new ones...

https://github.com/open-homeautomation/miflora/issues/7

btw conductivity appears to be soil fertility...

My version of the domoticz script... (you have to sleep between readings different devices, or else you get the transport errors...

https://github.com/Tristan79/miflora

If all else fails you could try the mtqq version...:

https://github.com/marcelrv/miflora

And some nice background:

https://wiki.hackerspace.pl/projects:xiaomi-flora
trixwood

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by trixwood »

Also note that moisture is in procents % not soil moisture cb... that is a whole other unit... :D

And soil fertility should be above 500, for blocky or lua use (according to their app)
Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

Re: RE: Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Coldman »

trixwood wrote:Also note that moisture is in procents % not soil moisture cb... that is a whole other unit... :D

And soil fertility should be above 500, for blocky or lua use (according to their app)
Great work!

Отправлено с моего MI PAD 2 через Tapatalk
trixwood

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by trixwood »

connect error: Transport endpoint is not connected (107)

if the sensor is more then 4-5 meters from a pi3 (internal) bluetooth, it seems it's really struggling... to get a reading... :-)
Is that what you experienced?
Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

Re: RE: Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Coldman »

trixwood wrote:connect error: Transport endpoint is not connected (107)

if the sensor is more then 4-5 meters from a pi3 (internal) bluetooth, it seems it's really struggling... to get a reading... :-)
Is that what you experienced?
I'm getting abnormal value sometimes, all of this more than 1000-2000, my sensors (8 pcs) located less than 1 meter and one about 3 meters from my RPi3. And notification: "Domoticz: Battery Low: Adenium obesum (Level: Low)", as example. In next request everything is ok.


Отправлено с моего MI PAD 2 через Tapatalk
trixwood

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by trixwood »

With 6 really close by I get no (transport) retry errors, now with 11, usually it has to retry with 2 or 3... but much wider apart (in circle range of 5 meters of the pi) Still all value's correct read and bridged to domoticz, no spikes, but I will monitor ;-)
And I noticed one of the lux sensors was constant at 47094... (112630 in the app itself)... I think that's broken...

Will update in a couple of weeks about connectivity when I have 21 all around the house :-)

No more plant dehydration and starvation :-) Poor little buggers, suffered long enough.
trixwood

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by trixwood »

I also have abnormal value's, still think there are a lot of bugs in the code...
User avatar
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by LouiS22 »

trixwood wrote:With 6 really close by I get no (transport) retry errors, now with 11, usually it has to retry with 2 or 3... but much wider apart (in circle range of 5 meters of the pi) Still all value's correct read and bridged to domoticz, no spikes, but I will monitor ;-)
And I noticed one of the lux sensors was constant at 47094... (112630 in the app itself)... I think that's broken...

Will update in a couple of weeks about connectivity when I have 21 all around the house :-)

No more plant dehydration and starvation :-) Poor little buggers, suffered long enough.
LOL, that's a forest you live in :D
trixwood

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by trixwood »

Well yeah if you put them all together it would, but spread out in a room. It does what plants do best, be part of the scenery. You hardly notice them...

Uhm, I patched the false readings...

The bad readings I got where:

fertility 26231
moisture 136
temperature 4804.2
lux 61149

consistently... so I was lazy and patch the domoticz scripts... let it max retry 3 times if temperatures are over 200 degree celcius...

Should remove any spikes...

(https://github.com/Tristan79/miflora)
Last edited by trixwood on Friday 20 January 2017 5:09, edited 2 times in total.
Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Coldman »

trixwood wrote: Uhm, I patched the false readings...
.
.
.
Should remove any spikes...
Greate work! Thx.
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by corbin »

trixwood wrote: fertility 26231
moisture 136
temperature 4804.2
lux 61149
so when you got 1 elevated reading, all the others readings were elevated at the same time?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Coldman »

corbin wrote:
trixwood wrote: fertility 26231
moisture 136
temperature 4804.2
lux 61149
so when you got 1 elevated reading, all the others readings were elevated at the same time?
Yes, and all others
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by corbin »

Coldman wrote: Yes, and all others
thanks, I had seen the high readings, but haven't had time to investigate. I've modified the script to exit on a temp reading over 200 as trixwood did.

Also, I'm having a hard time keeping the fertility/conductivity over 500, can anyone offer some advice on this?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Coldman
Posts: 61
Joined: Saturday 17 December 2016 11:51
Target OS: Linux
Domoticz version: Beta
Location: Moscow, Russia
Contact:

Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor

Post by Coldman »

corbin wrote:
Coldman wrote: Yes, and all others
Also, I'm having a hard time keeping the fertility/conductivity over 500, can anyone offer some advice on this?
I use fertilizer when watering - http://www.biobizz.com/home/?lang=enuk
my gardenia blooms already 3 times this year
Spoiler: show
Gardenia.jpg
Gardenia.jpg (335.85 KiB) Viewed 4148 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest