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

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

Moderator: leecollings

bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

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

Post by bertbigb »

pvm wrote:You can also make a slave Domoticz and have Domoticz sent these values over to the other one
Hi pvm, Thanks for the suggestion, I know and that works also but I would like to make use of MQTT for other purposes also.
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

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

Post by madrian »

Today I needed to reinstall my Orange Pi Zero, before I had armbian's Ubuntu server mainline /experimental/ version, now I installed stable kernel.

At least I 3x reinstalled things (bluez 5.44, 5.45), but I can't get it work. :x Before reinstall it worked perfectly.

Code: Select all

# python3 demo.py 
Getting data from Mi Flora
FW: 2.9.4
connect: Device or resource busy (16)
Name: Flower care
connect: Device or resource busy (16)
connect: Device or resource busy (16)
Traceback (most recent call last):
  File "demo.py", line 8, in <module>
    print("Temperature: {}".format(poller.parameter_value("temperature")))
  File "/root/miflora/miflora/miflora_poller.py", line 259, in parameter_value
    self._mac)
OSError: [Errno Could not read data from Mi Flora sensor %s] C4:7C:8D:62:6E:22

# python3 demo.py 
Getting data from Mi Flora
FW: 2.6.2
connect: Device or resource busy (16)
Name: Flower mate
connect: Device or resource busy (16)
connect: No route to host (113)
connect: No route to host (113)
connect: No route to host (113)
Traceback (most recent call last):
  File "demo.py", line 8, in <module>
    print("Temperature: {}".format(poller.parameter_value("temperature")))
  File "/root/miflora/miflora/miflora_poller.py", line 259, in parameter_value
    self._mac)
OSError: [Errno Could not read data from Mi Flora sensor %s] C4:7C:8D:61:AA:A8
No other process/mobile is connected to the miflora.

sudo hcitool lescan works.
bluetoothctl -> scan on -> nothing shows up here, but it worked before.

What the...? :roll:
Szwuntex
Posts: 9
Joined: Friday 31 July 2015 13:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Szwuntex »

madrian wrote:Today I needed to reinstall my Orange Pi Zero, before I had armbian's Ubuntu server mainline /experimental/ version, now I installed stable kernel.

At least I 3x reinstalled things (bluez 5.44, 5.45), but I can't get it work. :x Before reinstall it worked perfectly.
Have you tried 5.43?
It didn't work with 5.44 for me so I had to downgrade to 5.43.
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

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

Post by madrian »

I will try today, if it does not help I am going to reinstalo the whole system.

Edit:

Oh yes, and Parrot Flower Power works (uses similar code).
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

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

Post by madrian »

Final solution for OrangePi zero users: armbian experimental (mainline) version, which comes with Bluez 5.37. Works!

...unfortunately this version of armbian comes with kernel where built in wlan is disabled.
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz »

My Bluetooth USB adapter for my Raspberry pi 2 Sems to work quite unreliable. I need to reset the USB (pulling iut the adapter) about Every day now.

So the script works to readout the Miflora
Sensor but maybe it makes the Life difficult for the USB adapter
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

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

Post by bertbigb »

Hi Krizzz,
What is your exact question to us?
What makes you think there is something wrong with the script, I can't find any info/logging about that.
Can you provide info if it was working ok before? For how long. Was there a change in your system and after that change it wasn't working anymore?
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz »

bertbigb wrote:Hi Krizzz,
What is your exact question to us?
What makes you think there is something wrong with the script, I can't find any info/logging about that.
Can you provide info if it was working ok before? For how long. Was there a change in your system and after that change it wasn't working anymore?
Hi Bert, sorry for my unclear message. No there is nothing in the script that makes the USB dongle unreliable. Lets make that clear.

Please see my message as a emotional post about a piece of hardware that is not doing something I want to do :).

Because I do not hear anyone about this problem here, I have to continue my search somewhere else.


Verzonden vanaf mijn iPhone met Tapatalk
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz »

The devices for the Mi Flora sensor were not updated for a time so I decided to plug out the bluetooth usb stick and to reset the HCIconfig tool. I did this, and executed the domoticz.py script in the Miflora folder and received the following message. Did not see this one before

Code: Select all

 connect error: Transport endpoint is not connected (107))
The other point is when doing the HCICONFIG command, it scans the bkuetooth device without any problem. So i do not really know why this error is coming up. Any tips?
Abbadon
Posts: 40
Joined: Thursday 01 October 2015 8:25
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Poland, Wrocław
Contact:

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

Post by Abbadon »

Same problem here.. I have to restart my bt doongle with script

Code: Select all

#!/bin/bash
now=$(date +"%T")
echo "Current time : $now"
id=`lsusb |grep Bluetooth |awk '{ print $4 }'| sed 's/://g'`
sudo ./usbreset /dev/bus/usb/001/"$id"
sleep 5
python3 /home/pi/flora/domoticz.py 
I did that to sudo crontab to wxecute every 5 mins,, funny fact is., if i do that by my finger (execute script) its working fine but cron dont work like it should

Usbreset script source
https://askubuntu.com/questions/645/how ... mmand-line

Crontab entry
*/5 * * * * sh /home/pi/flora/rebooter.sh >> /home/pi/temp/rebooter.txt
JoannaMel
Posts: 2
Joined: Friday 23 June 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by JoannaMel »

I joined purely to post this. :)
While i do not have/use Domoticz at the moment, it does look like something right up my street...
If any other unfortunate souls end up here trying to make their China-only Xiaomi Mi Flora Smart Plants monitor work with Flower Care app, here's my guide.

The error shown on the screen when trying to pair the sensor is: "The device is for China Mainland user only, please contact the reseller for international version"
Screenshot_20170623-170727.png
Screenshot_20170623-170727.png (74.92 KiB) Viewed 5910 times
I have followed some advice earlier in this thread, but found the advice lacking in detail.

It seems that you only need to convince the app you are in china when first linking the device. Once you have done so it shall remain accessible in the app, even when no longer spoofing location.

To make it work, on my android phone i did the following:
1) turn off mobile network totally (for me: settings - sim cards - sim1- disable) - this prevents your mobile using mobile network masts to approximate location.
2) enable developer mode (settings - about phone - tap "build number" 10 or so times)
3) get a location spoofing app. I chose the first one i found : https://play.google.com/store/apps/deta ... akegps.fre
4)Select it under settings- developer - select mock location app
5) open the app, tap a location in china and start "faking" location
6) get free vpn with chinese servers. I had to try a couple. One that worked was: https://play.google.com/store/apps/deta ... .flyclient (3 x 20mins free daily)
7) connect to Chinese server via vpn. For me this was shanghai.
8) open the Flower care app and connect the new sensor as normal. (i have taken the battery out of the sensor immediately prior to this, in case it somehow "remembered" the previous failed pairing, but i expect this was not necessary)
I also set my timezone to manual and chose a location in china, but have a feeling this was not necessary either.
It should now allow you to connect.
9) return back to normal settings, remove the no-longer-needed apps, and enjoy your now-working sensor!

Hope this helps somebody.
Jo
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 »

I believe you wrote almost the same as I did in my first how-to :)

Step 1 and time zone setting is not neccesary.
JoannaMel
Posts: 2
Joined: Friday 23 June 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by JoannaMel »

LouiS22 wrote:Step 1 a... is not neccesary.
The reason I included this is that I do not change location settings to use only (spoofed) GPS for location - I was under the impression that is the spoofed location and Mobile network inferred position did not agree it could cause issues...
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz »

Do not seem to get my miflora backup again. It still giving me the
Transport endpoint is not connected (107)
error message...
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz »

Do not seem to get my miflora backup again. It still giving me the
Transport endpoint is not connected (107)
error message...Anyone any ideas?
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz »

Do not seem to get my miflora backup again. It still giving me the

Code: Select all

 Transport endpoint is not connected (107)
error message...And then after a reboot back to the

Code: Select all

Connection refused (111)
Anyone any ideas?
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 »

krizzz wrote:Do not seem to get my miflora backup again. It still giving me the

Code: Select all

 Transport endpoint is not connected (107)
error message...And then after a reboot back to the

Code: Select all

Connection refused (111)
Anyone any ideas?
By any chance do you have a running MiFlora app on your phone? I've noticed it could disturb the communication with the sensor. Just and idea, though.
Ricard1
Posts: 62
Joined: Saturday 07 November 2015 12:30
Target OS: Windows
Domoticz version: Beta
Location: Sweden
Contact:

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

Post by Ricard1 »

Hi All!

As this thread is 13 pages I ask here if someone can give a short good advice... :)

Can I use this sensor reliably if I have maximum 15-20 meters distance two the controller (Windows10) running Domotics and lets say two plaster walls as worse case?

If not, do you know any alternative? For measuring soil humidity i.e a 433MHz device would be more straight on simple and also providing better distance, normally.

Kind regards,
Ricard
Stefan
Posts: 6
Joined: Tuesday 27 June 2017 9:02
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: The Netherlands
Contact:

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

Post by Stefan »

Hey guys, my device is on the way and I'm very excited :D

But I'm a bit curios, does it really have a PH sensor? In some descriptions on various websites I see that it haves, but from the readings you guys are posting, it doesn't.

And did anybody try submerging the electrodes in water? If yes, how do the readings look? If it works, it might be a perfect tool also for aquariums, as it can measure some quite important variables.
AVBoX
Posts: 2
Joined: Saturday 05 August 2017 10:58
Target OS: -
Domoticz version:
Contact:

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

Post by AVBoX »

After following the Wiki I have this error

Code: Select all

pi@raspberrypi ~ $ /usr/bin/python3 /home/pi/domoticz/scripts/python/miflora/domoticz.py
Traceback (most recent call last):
  File "/home/pi/domoticz/scripts/python/miflora/domoticz.py", line 4, in <module>
    from miflora.miflora_poller import MiFloraPoller, \
  File "/home/pi/domoticz/scripts/python/miflora/miflora/miflora_poller.py", line 12, in <module>
    from subprocess import PIPE, Popen, TimeoutExpired
ImportError: cannot import name TimeoutExpired
Did you have a solution to the problem ?

Thx
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest