Xiaomi Mijia bluetooth temperature & humidity sensor compatibility

I’m testing custom component :slight_smile: It stops reading sensor data even if I move it like 1.5-2 meters from the RPi. That is probably caused by interference from other radios.

I am about to play with ESP8266 or Arduino + HM-10 BT module and set up OpenMQTTGateway. I may also go with bt-mqtt-gateway on RPi 1 or RPi Zero that I own. It looks promising and I will definitely need much more range than a few meters :wink:

I have also external BT USB dongle from my older RPi, but I’m afraid that it may negatively affect ConBee. That’s why I will probably try to go other solutions that will hopefully work stably as standalone units – “set it and forget it”.


How to set the /tmp to RAM as adviced in the repository running HASSIO after installing the custom_component?

Were you able to get LYWSD03MMC data dumps from someone and getting it to work yet?


Unfortunately, no. There are dumps, but everything is complicated there… The format is different from what we saw before. Here is a discussion on this.

I confirm this behaviour after moving from rp3 to rp4. Previously sensors were working from tens of meters and now they need to be almost next to raspi :confused:

Does anyone have any experience with the ‘new Xiaomi Mijia Temperate and Humidity Sensor with LCD Screen’

Described as a new version, I hoped it would work as the same as the previous, over bluetooth, but appears not.

I wouldn’t know where to start with testing the new version’s compatibility, can anyone advise or better still help?

Thanks in advance.

With the current firmware version it doesn’t use the same principle of sensor data broadcasting (service data) compared to its brothers.

And by the way not so easy to integrate as its brothers.

I have 6 new square Xiaomi LCD sensors. Using hcitool lescan I found their MACs and names (LYWSD03MMC), and by using gatttool interactive mode, after connecting to the sensors I start getting every few seconds this kind of info:

[email protected]:~$ sudo hcitool -i hci1 lescan
[sudo] password for bogdan:
LE Scan ...
A4:C1:38:3C:66:EF (unknown)
A4:C1:38:3C:66:EF LYWSD03MMC
[email protected]:~$ gatttool -i hci1 -I
[                 ][LE]> connect A4:C1:38:3C:66:EF
Attempting to connect to A4:C1:38:3C:66:EF
Connection successful
Notification handle = 0x0036 value: 06 09 1f 15 0c
Notification handle = 0x0036 value: 06 09 1f 15 0c
Notification handle = 0x0036 value: 06 09 1f 15 0c

I could determine that the first 2 bytes are the temperature in celsius (0x0906 = 2310 >> 23.1C), and the third byte is the humidity (0x1f = 31 >> 31%). I assume that the last 2 bytes contain info about the battery, but I can’t figure out the format. For the temperature and humidity values I confirmed this format on all 6 sensors (hex values correspond to the display values).
Can someone help with integrating this in HASS?

For those interested: here’s a discussion and search for a solution with passive receiving of LYWSD03MMC advertisements.

this is cool, thanks. i have to try this out.

for now, i created an automation to check my ble devices regarding their last update. If it has been longer than 30 minutes, i restarts hassio automatically. but yours seem a much better choice, i will give it a try.

But that discussion is just about passive receieving. And author said that options as mentioned by Lokkje are not acceptable. But anyway it might be interesting to have at least such option (untill they found passive solution).

Yes, I’m just tired of many times rejecting solutions with a connection to the sensor, since the Xiaomi passive BLE monitor component implements a different principle. Boiled a little…
In the situation with LYWSD03MMC, the best solution at the moment, as it seems to me, is to write a separate component. But now I just can’t do it… By the way, the link that I gave the post above has a link to the repository with a working python script for reading LYWSD03MMC sensor - MiTemperature2.
Maybe there is a person who can competently tie this to HA…

I’m considering switching to a Rpi 4. Has anyone compared the bluetooth range of a Rpi 3B+ vs the Rpi 4 ? I have quite a lot of Xiaomi bluetooth temperature sensors and I wouldn’t like to lose connection with some of them.

Hi everobody, you should consider adding mi_temp custom_component in HACS store…

Why? It is already there… :smiley: Look under integrations in HACS it is called “Xiaomi passive BLE monitor sensor platform”.

Btw the install instruction say the same…
The easiest way is to install it with HACS. First install HACS if you don’t have it yet. After installation you can find this custom component in the HACS store under integrations.

not working with the square version LYWSD03MMC

The custom component does support the LYWSD03MMC. You do need to add a key in the encryptions option (https://github.com/custom-components/sensor.mitemp_bt#encryptors) however.

1 Like

:star_struck: Thank’s Ernst, it’s working now ! :innocent:
I download the software on me Android and get the pairings.txt file containing the Bindkey.

software = https://ru.kapiba.ru/mihome/files/old/MiHome_5.6.65_63005_vevs.apk
more info = https://github.com/custom-components/sensor.mitemp_bt/issues/7

1 Like

ooops. New to the forum, not used to…

Has anyone compared the bluetooth range of a Rpi 3B+ vs the Rpi 4 ? I have quite a lot of Xiaomi bluetooth temperature sensors and I wouldn’t like to lose connection with some of them.