Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Moderator: leecollings
-
- Posts: 4
- Joined: Tuesday 17 March 2015 7:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
I ordered 2 MiFlora sensors and 2 Xiaomi Temperature/Humidity sensors over Amazon (Germany). When I conntacted the seller, that my MiFlora's are for wrong Country and if I send back those two, can I get the replacement (International version), I got an answer that they don't have EU version and got my money back for whole purchase (also for my T/H sensors) ... later found out, that MiFlora's are working with Domoticz, regardless of version...
At the and I sent the money back... Still, very nice gesture from seller
At the and I sent the money back... Still, very nice gesture from seller
-
- Posts: 317
- Joined: Thursday 12 January 2017 15:30
- Target OS: Linux
- Domoticz version: Beta Ch
- Location: Finland
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Hi, im a newb, trying to follow the wiki
Should this be apt-get install python3-pip, not python-pip ? :
Is this optional :
Looks like im getting info from miflora, but updating to domoticz doesnt seem to work..
Thnx

Should this be apt-get install python3-pip, not python-pip ? :
Code: Select all
Python-to-bluetooth[edit]
Next, Install required Python libraries that let Python scripts talk to Bluetooth.
sudo apt-get install python-pip sudo pip3 install pygatt pip3 install requests
Is this optional :
Code: Select all
Connecting via MQTT via Python
Code: Select all
sudo python3 domoticz.py
1: Vrouwentong (sansevieria trifasciata)
Mi Flora: C4:7C:8D:62:48:99
Firmware: 2.8.6
Name: Flower care
Temperature: 25.0°C
Moisture: 0%
Light: 220 lux
Fertility: 0 uS/cm?
Battery: 100%
Traceback (most recent call last):
File "domoticz.py", line 97, in <module>
update("C4:7C:8D:62:48:99","141","137","138","140")
File "domoticz.py", line 79, in update
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_temp + "&nvalue=0&svalue=" + val_temp + "&battery=" + val_bat)
File "domoticz.py", line 30, in domoticzrequest
response = urllib.request.urlopen(request)
File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.4/urllib/request.py", line 461, in open
response = meth(req, response)
File "/usr/lib/python3.4/urllib/request.py", line 571, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.4/urllib/request.py", line 499, in error
return self._call_chain(*args)
File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/lib/python3.4/urllib/request.py", line 579, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
Thnx

-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Not my problem...Lol just remeber that Xiaomi officially only sell to China market.
So I have to take it lying down, cuz this was calculated "import" risk, no!You made import, this your risk !
I am disputing all my sensors. And I would suggest everyone does the same!
Xiaomi bricked you're device knowingly! They know they sell a lot of unit outside china recently, that is probably the whole reason for bringing out this international version... To squeeze some more dollars/euros out of your fat western wallets.
So everyone please get your money back...
It is not ok!
To brick devices.
- 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
Yes. As I mentioned earlier, you have to find a VPN Service which has servers IN China. Then you can bind your devices and use the as before. The China IP/mock location is only neeeded for the binding (pairing) process.JC38 wrote:@LouiS22 and Justinb81
So, do you succeed using your "china only" sensor. I've got a VPN but I can't go to Mainland China, I've only found servers in Honk-Kong or Macau.
Can you use them with the android Mi Home and Flower Care applications ?
One more thing: If you don't need the mobile app, all sensors are working perfectly with Domoticz using trixwood's script and the BTLE method.
- 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
I think you're wrong in this case.woodtrix wrote:Not my problem...Lol just remeber that Xiaomi officially only sell to China market.
So I have to take it lying down, cuz this was calculated "import" risk, no!You made import, this your risk !
I am disputing all my sensors. And I would suggest everyone does the same!
Xiaomi bricked you're device knowingly! They know they sell a lot of unit outside china recently, that is probably the whole reason for bringing out this international version... To squeeze some more dollars/euros out of your fat western wallets.
So everyone please get your money back...
It is not ok!
To brick devices.
As mentioned before: to this day Xiaomi produced this sensor to China Mainland and not for international distribution. Yes, you can purchase it from Aliexpress/Gearbest/Banggood etc. Now they decided to change this - probably they're going international, who knows? I really doubt Aliexpress would pay back you any dime - you're way behind that. You can only blame/Xiaomi making this decision.
To help you (as you helped me with your script) I can offer you a VPN (I paid for it) to fiddle with your sensor (I noticed you have iphone - I read some trick for iphone over 4pda.ru, but not sure). Maybe a temp solution could be to borrow an android device and do the binding from that (after the binding you won't need the VPN and the android, the sensors are tied to your xiaomi account). If you need the VPN access, drop me a PM.
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Could someone please upload an example of their domoticz.py including idx and adress ? 

-
- Posts: 317
- Joined: Thursday 12 January 2017 15:30
- Target OS: Linux
- Domoticz version: Beta Ch
- Location: Finland
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
i quess only think you need to change in script, is very last lines, there u change MAC address, and IDX of the virtual devices in domoticz, and i think they need to be in correct order said in comments above last lines. If you have only one miflora, you need only one line.olskar wrote:Could someone please upload an example of their domoticz.py including idx and adress ?
I got data from mi flora, but as i posted before, having difficulties to update them to domoticz...
Code: Select all
@raspberrypi:~/domoticz/scripts/miflora $ python3 domoticz.py
1: Mi Flora
Mi Flora: C4:7C:8D:62:48:99
Firmware: 2.8.6
Name: Flower care
Temperature: 23.9°C
Moisture: 0%
Light: 71 lux
Fertility: 0 uS/cm?
Battery: 100%
Traceback (most recent call last):
File "domoticz.py", line 97, in <module>
update("C4:7C:8D:62:48:99","141","137","138","140")
File "domoticz.py", line 79, in update
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_temp + "&nvalue=0&svalue=" + val_temp + "&battery=" + val_bat)
File "domoticz.py", line 30, in domoticzrequest
response = urllib.request.urlopen(request)
File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.4/urllib/request.py", line 461, in open
response = meth(req, response)
File "/usr/lib/python3.4/urllib/request.py", line 571, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.4/urllib/request.py", line 499, in error
return self._call_chain(*args)
File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/lib/python3.4/urllib/request.py", line 579, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized
-Tomi
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
-
- Posts: 317
- Joined: Thursday 12 January 2017 15:30
- Target OS: Linux
- Domoticz version: Beta Ch
- Location: Finland
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
I got data from mi flora, but as i posted before, having difficulties to update them to domoticz...
Can anyone help with this ?
-Tomi[/quote]
EDIT:
Ok, i got it sorted, it really needed login/password even tho i have set it isnt needed in local network
Works now. This should be mentioned in the wiki too.
Code: Select all
@raspberrypi:~/domoticz/scripts/miflora $ python3 domoticz.py
1: Mi Flora
Mi Flora: C4:7C:8D:62:48:99
Firmware: 2.8.6
Name: Flower care
Temperature: 23.9°C
Moisture: 0%
Light: 71 lux
Fertility: 0 uS/cm?
Battery: 100%
Traceback (most recent call last):
File "domoticz.py", line 97, in <module>
update("C4:7C:8D:62:48:99","141","137","138","140")
File "domoticz.py", line 79, in update
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command¶m=udevice&idx=" + idx_temp + "&nvalue=0&svalue=" + val_temp + "&battery=" + val_bat)
File "domoticz.py", line 30, in domoticzrequest
response = urllib.request.urlopen(request)
File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.4/urllib/request.py", line 461, in open
response = meth(req, response)
File "/usr/lib/python3.4/urllib/request.py", line 571, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.4/urllib/request.py", line 499, in error
return self._call_chain(*args)
File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/lib/python3.4/urllib/request.py", line 579, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized
-Tomi[/quote]
EDIT:
Ok, i got it sorted, it really needed login/password even tho i have set it isnt needed in local network

-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
-
- Posts: 37
- Joined: Wednesday 25 November 2015 18:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Germany / France
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Hello,
I have problems including my flower sensor into domoticz.
I followed the wiki article (with no result of this part, because it did not find the folder:
Does anybody have a clue?
Thank you in advance and thanks for the work!
I have problems including my flower sensor into domoticz.
I followed the wiki article (with no result of this part, because it did not find the folder:
I found my flower sensor, and tried the demo.py, with the following result:If all goes well, one last thing is to copy the Gatt tool to the directory where your linux version keeps its programs. It's location is different for different Linux flavours. Try:
sudo cp attrib/gatttool /usr/local/bin/ or sudo cp attrib/gatttool /usr/bin/
Code: Select all
Traceback (most recent call last):
File "demo.py", line 6, in <module>
print("Temperature: {}°C".format(poller.parameter_value("temperature")))
File "/home/pi/domoticz/scripts/miflora/miflora/miflora_poller.py", line 256, in parameter_value
self._mac)
OSError: [Errno Could not read data from Mi Flora sensor %s] C4:7C:8D:62:7C:CE
Thank you in advance and thanks for the work!
-
- Posts: 1
- Joined: Sunday 12 March 2017 20:04
- Target OS: Linux
- Domoticz version: git
- Location: Amsterdam, NL
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Just received 3 sensors. Registered them with the app on iOS (indeed does not work unless set to China). Updated to 2.8.6. Works like a charm 
The sensor can store the values it recorded over time and the app can read them when it contacts the sensor. I saw a bit on another forum about this but it would be interesting to be able to push that entire history to Domoticz in some sort of timestamp-key-value tuple (which the API does not support AFAIK).
(Am I now correctly understanding that any further sensors will not work or is the above "China setting" all there is to it?)

The sensor can store the values it recorded over time and the app can read them when it contacts the sensor. I saw a bit on another forum about this but it would be interesting to be able to push that entire history to Domoticz in some sort of timestamp-key-value tuple (which the API does not support AFAIK).
(Am I now correctly understanding that any further sensors will not work or is the above "China setting" all there is to it?)
- 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
Once you binded your sensor with the mobile app, you're set.DennisF wrote:Just received 3 sensors. Registered them with the app on iOS (indeed does not work unless set to China). Updated to 2.8.6. Works like a charm
The sensor can store the values it recorded over time and the app can read them when it contacts the sensor. I saw a bit on another forum about this but it would be interesting to be able to push that entire history to Domoticz in some sort of timestamp-key-value tuple (which the API does not support AFAIK).
(Am I now correctly understanding that any further sensors will not work or is the above "China setting" all there is to it?)
- 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
Code: Select all
connect error: Transport endpoint is not connected (107)
-
- 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
How far are the sensors from the controller? I stopped getting errors on the last firmwareLouiS22 wrote:This error message is so annoying and still haven't found a way to defeat it. Any suggestions?Code: Select all
connect error: Transport endpoint is not connected (107)
-
- Posts: 37
- Joined: Wednesday 25 November 2015 18:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Germany / France
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Just a quick idea: apparently I do not get any sensor values.
Is this a raspberry pi error or an error with Bluetooth?
Do I have to install the app to initiate the sensors? Above was written, that the sensors would work without the app..
Best regards
Is this a raspberry pi error or an error with Bluetooth?
Do I have to install the app to initiate the sensors? Above was written, that the sensors would work without the app..
Best regards
physiker123 wrote:Hello,
I have problems including my flower sensor into domoticz.
I followed the wiki article (with no result of this part, because it did not find the folder:
I found my flower sensor, and tried the demo.py, with the following result:If all goes well, one last thing is to copy the Gatt tool to the directory where your linux version keeps its programs. It's location is different for different Linux flavours. Try:
sudo cp attrib/gatttool /usr/local/bin/ or sudo cp attrib/gatttool /usr/bin/
Does anybody have a clue?Code: Select all
Traceback (most recent call last): File "demo.py", line 6, in <module> print("Temperature: {}°C".format(poller.parameter_value("temperature"))) File "/home/pi/domoticz/scripts/miflora/miflora/miflora_poller.py", line 256, in parameter_value self._mac) OSError: [Errno Could not read data from Mi Flora sensor %s] C4:7C:8D:62:7C:CE
Thank you in advance and thanks for the work!
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
I got a couple of sensors reading the address only but no value's out of the package, the started working after an hour or so when I planted them in the soil. I can not recall If I used the app then.
All the other sensors (20+) work instantly, pull the platic from the battery, have hciscan?.. whatever it is called running and the address of the new device pops up, fill it in your script with idx and run it...
All the other sensors (20+) work instantly, pull the platic from the battery, have hciscan?.. whatever it is called running and the address of the new device pops up, fill it in your script with idx and run it...
- 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
woodtrix wrote:I got a couple of sensors reading the address only but no value's out of the package, the started working after an hour or so when I planted them in the soil. I can not recall If I used the app then.
All the other sensors (20+) work instantly, pull the platic from the battery, have hciscan?.. whatever it is called running and the address of the new device pops up, fill it in your script with idx and run it...
Code: Select all
sudo hcitool lescan
-
- Posts: 331
- Joined: Wednesday 21 December 2016 9:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: current
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
@tontze: looks like the script can't find your domoticz server. The 503 error: server not found. Did you add your server information to the top of the script?
Have a look at the Wiki for a walkthrough:
https://www.domoticz.com/wiki/Mi_Flora_Bluetooth_LE
Have a look at the Wiki for a walkthrough:
https://www.domoticz.com/wiki/Mi_Flora_Bluetooth_LE
Last edited by blauwebuis on Monday 13 March 2017 11:08, edited 1 time in total.
-
- Posts: 331
- Joined: Wednesday 21 December 2016 9:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: current
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
You don't need to use the Xiaomi app to use these sensors by the way. My sensors are working fine, and I never even touched the app.
The only reason to use the app would be to update the firmware. But you'll always run the risk of breaking things if you do.
The only reason to use the app would be to update the firmware. But you'll always run the risk of breaking things if you do.
-
- Posts: 317
- Joined: Thursday 12 January 2017 15:30
- Target OS: Linux
- Domoticz version: Beta Ch
- Location: Finland
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
Yes i got it working by adding user information, i thought it isnt needed since domoticz have option not to need for login in local networkblauwebuis wrote:@tontze: looks like the script can't find your domoticz server. The 503 error: server not found. Did you add your server information to the top of the script?
Have a look at the Wiki for a walkthrough:
https://www.domoticz.com/wiki/Mi_Flora_Bluetooth_LE

-Tomi
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
-
- Posts: 25
- Joined: Monday 10 October 2016 13:37
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Xiaomi Mi Flora [Temp/Light/Moisture] BLE Sensor
I know this is more a question about flora and less about Domoticz: How can you use these sensors to keep your plant alive when not using the app?blauwebuis wrote:You don't need to use the Xiaomi app to use these sensors by the way. My sensors are working fine, and I never even touched the app.
The only reason to use the app would be to update the firmware. But you'll always run the risk of breaking things if you do.
How do I know how much moisture, sun etc. my plant needs so I can set thresholds in Domoticz? I can see the official app would be useful as a library with such information.. My plants always miserably die.. so I'd like to use these sensors outside of China, but need some knowledge on my plants outside the app.
Who is online
Users browsing this forum: No registered users and 1 guest