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

Others (MiLight, Hue, Toon etc...)
bertbigb
Posts: 134
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 » Tuesday 09 May 2017 7:18

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 DS1515+ - DSM 6.1
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: 191
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

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

Post by madrian » Thursday 11 May 2017 2:03

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: 12
Joined: Friday 31 July 2015 13:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Szwuntex » Thursday 11 May 2017 8:02

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: 191
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

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

Post by madrian » Thursday 11 May 2017 8:14

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: 191
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

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

Post by madrian » Thursday 11 May 2017 19:18

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: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz » Friday 26 May 2017 23:55

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: 134
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 » Saturday 27 May 2017 10:00

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 DS1515+ - DSM 6.1
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: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz » Saturday 27 May 2017 17:07

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: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz » Tuesday 13 June 2017 22:52

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: 55
Joined: Thursday 01 October 2015 8:25
Target OS: Raspberry Pi
Domoticz version: beta
Location: Poland, Wrocław
Contact:

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

Post by Abbadon » Thursday 22 June 2017 9:12

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
Domoticz version:
Contact:

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

Post by JoannaMel » Saturday 24 June 2017 0:52

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 1049 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: 398
Joined: Friday 27 February 2015 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: Budapest, Hungary
Contact:

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

Post by LouiS22 » Saturday 24 June 2017 8:14

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
Domoticz version:
Contact:

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

Post by JoannaMel » Monday 26 June 2017 17:59

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: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz » Monday 26 June 2017 21:45

Do not seem to get my miflora backup again. It still giving me the
Transport endpoint is not connected (107)
error message...

krizzz
Posts: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz » Monday 26 June 2017 21:46

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: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

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

Post by krizzz » Monday 26 June 2017 21:51

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: 398
Joined: Friday 27 February 2015 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: Budapest, Hungary
Contact:

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

Post by LouiS22 » Tuesday 27 June 2017 9:22

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: 43
Joined: Saturday 07 November 2015 13:30
Target OS: Windows
Domoticz version: Beta
Location: Sweden
Contact:

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

Post by Ricard1 » Sunday 02 July 2017 10:48

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: 9
Joined: Tuesday 27 June 2017 9:02
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: The Netherlands
Contact:

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

Post by Stefan » Friday 04 August 2017 9:38

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: 1
Joined: Saturday 05 August 2017 10:58
Target OS: -
Domoticz version:
Contact:

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

Post by AVBoX » Saturday 05 August 2017 11:00

After following the Wiki I have this error

Code: Select all

[email protected] ~ $ /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 2 guests