lolo
December 1, 2018, 9:01am
1
Hi,
I was hoping to be able to read data from Xiaomi Mi Flora and Xiaomi Temperature sensor but we need to poll data from the sensor through a BLE connection to do that .
Is it possible to install alternative firmware?
How can I do SSH on the current gateway?
Thanks in advance
Is it possible to install alternative firmware?
The main micro controller is ESP32 and the BLE module is nRF52832. You can develop your own firmware for them if you’re family with these chips.
How can I do SSH on the current gateway?
You can’t ssh the gateway. It runs freeRTOS not Linux like system.
BTW: which model xiaomi temperature sensor do you use? Does it need connection or just advertising?
Ok. We’ll buy one temperature sensor and check the advertising data today
lolo
December 4, 2018, 6:42am
6
Great! Please kindly let me know
Hi,
I checked a Xiaomi BLE temperature humidity sensor with LCD. I used a BLE sniffer to scan data. Some sample datas
37 1 4C65A8D0F380 02 01 06 13 16 95 FE 50 20 AA 01 8B 80 F3 D0 A8 65 4C 04 10 02 D5 00 -53
37 1 4C65A8D0F380 02 01 06 15 16 95 FE 50 20 AA 01 8C 80 F3 D0 A8 65 4C 0D 10 04 D4 00 CB 00 -53
37 1 4C65A8D0F380 02 01 06 15 16 95 FE 50 20 AA 01 8D 80 F3 D0 A8 65 4C 0D 10 04 D4 00 CC 00 -53
37 1 4C65A8D0F380 02 01 06 15 16 95 FE 50 20 AA 01 8E 80 F3 D0 A8 65 4C 0D 10 04 D6 00 CE 00 -53
37 1 4C65A8D0F380 02 01 06 12 16 95 FE 50 20 AA 01 8F 80 F3 D0 A8 65 4C 0A 10 01 12 -53
37 1 4C65A8D0F380 02 01 06 15 16 95 FE 50 20 AA 01 90 80 F3 D0 A8 65 4C 0D 10 04 D5 00 CD 00 -53
37 1 4C65A8D0F380 02 01 06 13 16 95 FE 50 20 AA 01 91 80 F3 D0 A8 65 4C 06 10 02 CC 00 -53
37 1 4C65A8D0F380 02 01 06 15 16 95 FE 50 20 AA 01 92 80 F3 D0 A8 65 4C 0D 10 04 D5 00 CC 00 -53
37 1 4C65A8D0F380 02 01 06 15 16 95 FE 50 20 AA 01 93 80 F3 D0 A8 65 4C 0D 10 04 D5 00 CA 00 -53
37 1 4C65A8D0F380 02 01 06 15 16 95 FE 50 20 AA 01 94 80 F3 D0 A8 65 4C 0D 10 04 D5 00 CD 00 -53
I can get data even the iOS Mijia.app reading temperature data. So it doesn’t need connection to get the data.
I also found a Python library to parsing the data from Xiaomi temperature sensor. Please check the repo
lolo
December 5, 2018, 1:38pm
8
Well I m receiving these data as well, but I don’t what it is. The API you are mentioning is doing :
def _parse_data(self):
"""Parses the byte array returned by the sensor.
The sensor returns 14 bytes in total, a readable text with the
temperature and humidity. e.g.:
54 3d 32 35 2e 36 20 48 3d 32 33 2e 36 00 -> T=25.6 H=23.6
"""
data = self._cache
res = dict()
res[MI_HUMIDITY] = float(data[9:13])
res[MI_TEMPERATURE] = float(data[2:6])
return res
But I receiving data similar to yours
020106151695FE5020AA01AC2D06DBA8654C0D100409010502
That’s are not readable.
Please not that if I run the python API from my pc with a bluetooth adaptor it works fine…
Any idea please?
Let’s forget the python library mitemp. It need connect to the sensor.
Here’s another library node-xiaomi-gap-parser . It just parse the advertising data to get temperature and humidity data.
For your sample data:
020106151695FE5020AA01AC2D06DBA8654C0D100409010502
The last two bytes 05:02
is 0x0205, it’s a little endian 16-bit integer equal 517
as in 51.7%
relative humidity.
0901
is 0x0109 = 265 as in 26.5
celsius.
See more information in the section Technical Details
lolo
December 9, 2018, 12:00am
10
This is perfect! I’m working on an integration on your BLE Gateway into Home Assistant
Will keep you posted if you wish…
That’s great! Please keep update with me!