Xiaomi LYWSD03MMC BLE Temperature and Humidity Display

Is it possible to run it on the same device where i have HA? or I need to buy other RPi?

I have only run this on a separate Raspberry Pi zero w. They are quite cheap. I have a prototype running using an ESP32 as the hub. This will make it very cheap. I will be posting this soon!

1 Like

Tahnk you very much for your answer. I asked bcs right now I jave got only one RPi.
Running this chip on ESP32 is the best idea ( the cheapest and the lowest power consumption solution), It will be possible launch more than one sensor?

Yes. It supports up to twenty sensors.

I have posted about my esp32 code now https://github.com/AnthonyKNorman/Xiaomi_LYWSD03MMC_for_HA

1 Like

How to connect to mqtt with user and password ?
The script has only the server address.

In terms of bluetooth LE range, what would be better? Pi Zero W or ESP32?
How about ESP32 with an external antenna?

Anyone got this working on a RPi2? As it does not have a default bluetooth adapter. Thanks!

Hi @KoalaBear, There is no straightforward way to do this on RPi 2. You would need an external BLE adapter of course. You might like my later solution Interfacing Xiaomi LYWSD03MMC to HA using ESP32 that uses and ESP32 instead.

Thanks @Beantree

Sad that it is not supported. OK, I’ll ask my brother, he has some experience with ESP32/Python.

Does a single ESP32 supports multiple sensors? (4 for me). Thanks again! Also this would be my first not-out-of-the-box thing :slight_smile: Looks like that is how it is supposed to work, hopefully it can pickup the sensors through 2 walls :slight_smile:

A single ESP32 supports multiple sensors. Good luck!

Hi, Tony
thanks for your help, I worked perfectly with an ESP 32 and I have 6 connected Xiaomi devices
It happens that after a few hours you lose the connection and you have to reconnect the ESP32, I don’t know if the same thing happens to you?

How can I put the time of the last reading on the card?
I want to see the same data that appears when you click on the sensor but on the dashboard card

Thank you

Captura de Pantalla 2020-07-13 a la(s) 20.59.09

This might help you. Last_updated State and last-changed in Lovelave

Can you help me with this repository https://github.com/AnthonyKNorman/ESP32_GPS
I couldn’t find it on this site. If you can help I will send you equipment being used and software problems. Thank you for your consideration.

Here is an easiest way to get the bind key for the Xiaomi LYWSD03MMC sensor. I used a mobile phone.

  1. Keep the Xiaomi Mijia LYWSD03MMC sensor close to the mobile phone.
  2. On the mobile phone, make sure that the bluetooth connection is enabled.
  3. Using the mobile phone’s browser, navigate to https://atc1441.github.io/TelinkFlasher.html.
  4. Enlarge the mobile phone’s screen for better readability.
  5. Now, click the [Connect] button and wait until it shows “Connected.” See the Log section at the bottom.
  6. Once connected, click the [Do Activation] button and wait until the “Mi Bind Key” shows the information.

Source: https://www.youtube.com/watch?v=NXKzFG61lNs at around the 11:40 mark.


If you found that video, use the updated firmware so you don’t need the encryption key anymore. I flashed 4 of them, and they report great using openmqttgateway on an esp32.

ESPHome 1.15 is released yesterday which means support is now in stable!

So there are 2 ways to integrate the sensors:

  1. Custom fork of the Xiaomi Mija BLE integration with Bind Key (which has become quite easy to get in the meantime, even without installing an unknown apk)
  2. Flashing another firmware without needing Bind Key and installing another custom module (openmqttgateway)

So there is still no way to integate it into basic installation…? A custom module is required anyway. Right?

AFAIK, yes, however,

openmqttgateway works too without custom firmware, the orginal firmware works without bindkey, but it connects to the LYWSD03MMC (just as the Custom fork of the Xiaomi Mija BLE integration with Bind Key ) and that has negative impact on the battery life.

This works brilliantly