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 »

devros wrote:i have problems with Mi Flora, sensor works only when is really near with script (1-2m) and event then reading is often with timeout,
but when is about 5 meters and one window

Code: Select all

connect: No route to host (113)
but with hcitool lescan is visible

Code: Select all

LE Scan ...
C4:7C:8D:61:B4:DA (unknown)
C4:7C:8D:61:B4:DA Flower mate
any idea what wrong, is really BE really so poor with signal?

tried to check singal, but dunno what numbers to check

Code: Select all

> HCI Event: LE Meta Event (0x3e) plen 35                     [hci0] 115.727966
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C4:7C:8D:61:B4:DA (OUI C4-7C-8D)
        Data length: 23
        Flags: 0x06
C4:7C:8D:61:B4:DA Flower mate
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (partial): 1 entry
          Xiaomi Inc. (0xfe95)
        Service Data (UUID 0xfe95): 3102980006dab4618d7cc40d
        RSSI: -77 dBm (0xb3)

Code: Select all

[bluetooth]# scan on
Discovery started
[CHG] Controller 34:C3:D2:E4:13:E3 Discovering: yes
[CHG] Device C4:7C:8D:61:F7:83 RSSI: -78
[CHG] Device C4:7C:8D:60:F5:2A RSSI: -82
[CHG] Device C4:7C:8D:61:B2:D2 RSSI: -86
[CHG] Device C4:7C:8D:60:96:75 RSSI: -76
[CHG] Device C4:7C:8D:60:84:99 RSSI: -84
[CHG] Device C4:7C:8D:61:5F:4D RSSI: -86
[CHG] Device C4:7C:8D:60:84:8F RSSI: -74
[CHG] Device C4:7C:8D:61:B6:52 RSSI: -74
[CHG] Device C4:7C:8D:61:B6:62 RSSI: -70
[CHG] Device C4:7C:8D:61:9A:01 RSSI: -92
3-5 meters, connect is ok
devros
Posts: 183
Joined: Saturday 29 October 2016 20:55
Target OS: -
Domoticz version:
Contact:

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

Post by devros »

found that BE Mi Flora works only when i restart machine on first try....., on second try i have
connect: No route to host (113)
so its some BE problem machine :(

EDIT: ok it was problem with old Bluetooth daemon, upgraded to 5.44 version and it works now
tontze
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

Post by tontze »

RSSI is the one to check, lower rssi = better signal, sort of. It still doesnt tell quality of the connection. Connection might be poor, even when signal is strong.
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
tontze
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

Post by tontze »

devros wrote:found that BE Mi Flora works only when i restart machine on first try....., on second try i have
connect: No route to host (113)
so its some BE problem machine :(

EDIT: ok it was problem with old Bluetooth daemon, upgraded to 5.44 version and it works now
works wit longer distance too ?
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
devros
Posts: 183
Joined: Saturday 29 October 2016 20:55
Target OS: -
Domoticz version:
Contact:

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

Post by devros »

tontze wrote:
devros wrote:found that BE Mi Flora works only when i restart machine on first try....., on second try i have
connect: No route to host (113)
so its some BE problem machine :(

EDIT: ok it was problem with old Bluetooth daemon, upgraded to 5.44 version and it works now
works wit longer distance too ?
Yup miflora is still on same place and sensor now works....

Code: Select all

connect: Device or resource busy (16)
Mi Flora: C4:7C:8D:61:B4:DA
Firmware: 2.6.2
connect: Device or resource busy (16)
edit: noticed that its not 100% ok sometimes its not working (weird is thas when i run hcitool lescan before script it works almost everytime)
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 »

devros wrote:
tontze wrote:
devros wrote:found that BE Mi Flora works only when i restart machine on first try....., on second try i have
connect: No route to host (113)
so its some BE problem machine :(

EDIT: ok it was problem with old Bluetooth daemon, upgraded to 5.44 version and it works now
works wit longer distance too ?
Yup miflora is still on same place and sensor now works....

Code: Select all

connect: Device or resource busy (16)
Mi Flora: C4:7C:8D:61:B4:DA
Firmware: 2.6.2
connect: Device or resource busy (16)
edit: noticed that its not 100% ok sometimes its not working (weird is thas when i run hcitool lescan before script it works almost everytime)
if you use App Flower Care on your phone, you should close it!
devros
Posts: 183
Joined: Saturday 29 October 2016 20:55
Target OS: -
Domoticz version:
Contact:

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

Post by devros »

Coldman wrote:
devros wrote:
tontze wrote:
works wit longer distance too ?
Yup miflora is still on same place and sensor now works....

Code: Select all

connect: Device or resource busy (16)
Mi Flora: C4:7C:8D:61:B4:DA
Firmware: 2.6.2
connect: Device or resource busy (16)
edit: noticed that its not 100% ok sometimes its not working (weird is thas when i run hcitool lescan before script it works almost everytime)
if you use App Flower Care on your phone, you should close it!
i only closed app and disabled bluetooth, or i have to unpair device somehow ?
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 »

devros wrote:
Coldman wrote:
devros wrote:
Yup miflora is still on same place and sensor now works....

Code: Select all

connect: Device or resource busy (16)
Mi Flora: C4:7C:8D:61:B4:DA
Firmware: 2.6.2
connect: Device or resource busy (16)
edit: noticed that its not 100% ok sometimes its not working (weird is thas when i run hcitool lescan before script it works almost everytime)
if you use App Flower Care on your phone, you should close it!
i only closed app and disabled bluetooth, or i have to unpair device somehow ?
With the last and the penultimate firmware you do not need to pair Bluetooth, there is working perfectly without pairing
dakipro
Posts: 49
Joined: Thursday 17 December 2015 22:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Norway
Contact:

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

Post by dakipro »

how does one upgrade to 5.44 after having installed 5.43?
Is it just running
cd /home/pi
wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.44.tar.gz
tar -xvf bluez-5.44.tar.gz
cd bluez-5.44
sudo ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-tools --disable-test --disable-systemd
sudo make all
and then
export PATH=$PATH:~/bluez-5.44/attrib/

?
As last time I tried to copy gatttool from 5.44 i got cp: cannot stat 'attrib/gatttool': No such file or directory

Problem is that everything worked fine when I installed the script, and some time after that, but then it sort of stopped. Now if I run script manually I do get some values first time (but I do not see light signal on the flora as I did when I first tested).
But second time I try to manually pull values, I get


osmc@kodi:~/bluez-5.44$ /usr/bin/python3 /home/osmc/miflora/domoticz.py

21: ()
Mi Flora: C4:7C:8D:62:00:EC
connect error: Function not implemented (38)
connect error: Transport endpoint is not connected (107)
Raspberry Pi 2 B - MySensors (dimmers, switches, motion, temperature, lux, humidity sensors)
zWave (220v switches)
various 433 via RFLink
dakipro
Posts: 49
Joined: Thursday 17 December 2015 22:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Norway
Contact:

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

Post by dakipro »

And now I tested few more times, and it seems to work... Strange...
Distance between the flora and pi is 4m without obstacles (i tried from 20cm distance, but received also sometimes confused responses)
(bluetooth on phone is turned off, app connects fine each time and gets historical data fine)
Raspberry Pi 2 B - MySensors (dimmers, switches, motion, temperature, lux, humidity sensors)
zWave (220v switches)
various 433 via RFLink
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 »

dakipro wrote:And now I tested few more times, and it seems to work... Strange...
Distance between the flora and pi is 4m without obstacles (i tried from 20cm distance, but received also sometimes confused responses)
(bluetooth on phone is turned off, app connects fine each time and gets historical data fine)
RPi2+USB BT dongle?
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 »

dakipro wrote:how does one upgrade to 5.44 after having installed 5.43?
As last time I tried to copy gatttool from 5.44 i got cp: cannot stat 'attrib/gatttool': No such file or directory
Is Gatttool included in 5.44? I had to go for 5.43 to get Gatttool.
Why do you want to upgrade to 5.44?
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 »

Update: after the new update Mi Home on iOs the flower monitor is now successfully connecting. Yeah!
dakipro
Posts: 49
Joined: Thursday 17 December 2015 22:24
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Norway
Contact:

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

Post by dakipro »

Well I was having problems with connecting to the Flora (connect error: Transport endpoint is not connected (107) - see previous post for details), so I was under impression that 5.44 fixed this and wanted to update.
But now I see that everything works fine on my raspberry Pi 3 (onboard bluetooth, wifi not active on the board if that matters)
Raspberry Pi 2 B - MySensors (dimmers, switches, motion, temperature, lux, humidity sensors)
zWave (220v switches)
various 433 via RFLink
woodtrix
Posts: 34
Joined: Saturday 18 February 2017 17:54
Target OS: -
Domoticz version:
Contact:

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

Post by woodtrix »

I've been looking into the region ban,

It seems there camera are also effected, but blocking a couple of dns hosts works to bypass it, maybe it also works for the miflora app.

https://github.com/fritz-smh/yi-hack/is ... -219249830
Jumper3126
Posts: 105
Joined: Thursday 31 December 2015 15:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Jumper3126 »

Found a way to connect the "mainland china" sensors to your iphone. You need a jailbreak for it though.
I used "cover my ass" VPN to get an IP address in beijing (free first week). then used Cydia app "protect my privacy" to fake that I'm actually in China.

So, the plant sensor only checks your location at the moment of registering the sensor for the first time in the app. I think it does this based on IP address and phone location. Afterwards it doesnt check anymore. For I understand, this is different to the location block in the camera's, as they continuously check where they are.
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 am started to use domoticz.py, it is working fine, but where I can see battery level? Do I need to create a dummy battery device?

In the source I see that we are sending battery level at each device:

Code: Select all

val_bat  = "{}".format(poller.parameter_value(MI_BATTERY))
    
    # Update temp
    val_temp = "{}".format(poller.parameter_value("temperature"))
    domoticzrequest("http://" + domoticzserver + "/json.htm?type=command&param=udevice&idx=" + idx_temp + "&nvalue=0&svalue=" + val_temp + "&battery=" + val_bat)
...but where I can check this battery level?
pvm
Posts: 550
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: 4.10538
Location: NL
Contact:

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

Post by pvm »

In there device list
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
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 »

Thanks, I found it. :)

I am thinking of replacing the battery with lir2032 rechergeable battery (+solar charger), but it's voltage is higher than regular cr2032. What do you think about higher voltage?
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 »

hpapagaj wrote:Thanks, I found it. :)

I am thinking of replacing the battery with lir2032 rechergeable battery (+solar charger), but it's voltage is higher than regular cr2032. What do you think about higher voltage?
Time will tell. Some devices are tolerate a bit higher juice, but generally it's not a good idea to overfeed any device. Worst case in your case: you kill your sensor.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest