Home Asssistant Xiaomi Mijia LYWSD03MMC Temperature and Humidity Sensor Tutorial September 2022

I recently bougth few of these sensors and flashed them to zigbee using this tutorial: https://smarthomescene.com/guides/convert-xiaomi-lywsd03mmc-from-bluetooth-to-zigbee/ They are placed quite away from my NUC with HA and didn’t wanted to add additional BLE proxies so decided to flash them to Zigbee and use with Sonoff ZBDongle-E which is connected directly to NUC. So far so good, everything works well :slight_smile:

1 Like

Interesting. How’s the range, and better than Bluetooth? What other advantages are there for Zigbee over BLE? I think Zigbee has repeaters easily available, unlike BLE.

Range seems to be quite good I think. The furthest device is located around 15m from the Sonoff dongle on different floor so the signal have to go through few walls and floor ceiling and Z2M shows LQI = 128. I think it’s quite good considering that my old, non-display, device located next to it have LQI = 56

That sounds a little better than what I’m getting with Bluetooth. I guess the advantages are a bit more range and the ability to use repeaters. If I had a Zigbee dongle I might give it a go.

Guys, I integrated mine yesterday via BTHome and it showed up in HA. Things is noticed:

It reported values quite often, about every 10 seconds (didn’t change any settings in the flasher).
Well this morning I moved the thermometer to a different place (where it lost connection) and now its seams pretty reasonable without any changes in the settings. I can imagine that with this jitter it always thinks its a significant change and spits out the new value


Is there a way to reduce thesensitivity?

Next thing. I have an entity Power and I have now idea whats the meaning of it. It sometimes changes its state to normal. Do you also have it?


Also I have 2 hidden entities Packet Id and Signal Strength showing no values. At least having the signal strength would be a nice feature.

Try changing the flashing settings as I suggest above. That will reduce the frequency of logging, most people don’t need it logging that often and it takes up disk space. I also find that if the sensor is further from the Bluetooth receiver, some packets are lost and you get fewer readings, but it’s probably still transmitting often and using power.

I don’t know what the power entity is. Can you tell us an English what the different values it can take are?

Are you using the built-in BT home or passive BLE monitor? I still use passive BLE monitor instead of the built-in BTHome, I think there was a feature the built in one didn’t have a while ago, it might by now.

Hi Tim,

I changed the values according to the settings above and now the jiitter has gone.
However, the values now differ from what is shown on the display by about 1/2°C and 2% RH, although I didn’t set any offsets. When I changed the name, BTHome lost the device, now it’s no longer available.

The Power entity is really strange, no idea whats the use for it. It showed in the beginning the status Normal, after some time it changed to Available and stayed on that value.

You were also right with the distance, putting it farther away from the recveiver reduced the number of readings. Putting it closer it immediately showed the jitter again.

I am using the built-in BT home.

Not sure what you can do about the variations, it does tend to change on the display more often than it sends data to home assistant. So long as it is consistently close I probably wouldn’t worry about it.

Does anyone know off hand if negative temperatures be displayed on screen with this custom LYWSD03MMC HA sensor FW? I tried Googling a bit but didn’t find an answer. I have some in around the house, outside & in fridge/freezer with default FW right now.

Being able to see temperature below 0C when the freezer is open would be awesome for me and other members of the household that won’t be looking at the HA dashboard (Of course I’m replacing the coin cell since that won’t last in the freezer).

Thanks!

Does this solve the issue of constantly being asked for the bndkey? HA eventually will reject the key extracted with the token_extractor tool. Havent tried the telink one.

I’ve never been asked for a “bndkey”, I’ve never seen that message. I’ve had 6 or 7 of these temperature sensors running telink for about 18 months.

@Maxrunner Follow this tutorial, at the top of this page. It installs a custom firmware that sends the data unencrypted.

1 Like

Will it still work with the mi home?

I just did a scan for a temperature sensor in the Android Xiaomi Home application, it couldn’t find the sensor, so I guess no. You can use the sensors with the Xiaomi app, or Home Assistant.

I’ve build dashboards in HA that show me the temperatures and humidity in various ways. One is a list, one is a grid, I have the most important temperatures underneath the air conditioning controls.

1 Like

Happy to report I got my LYWSD03MMC sensors working using BTHome without needing to flash custom firmware.

I obtained a bindkey using Telink Flasher using these instructions: TIP: Getting the bind key for the Xiaomi Mijia LYWSD03MMC sensor · Issue #277 · mKeRix/room-assistant · GitHub

NB it’s really important to obtain the bindkey BEFORE you configure the device in home assistant - this is because each time you “do activation” it generates a new bindkey. If you “do activation” after you configure the device in home assistant, the new bindkey won’t decrypt any broadcasts that HA has previously received from the device and it will whinge about the bindkey being incorrect until it receives an updated broadcast from the device.

I then let Home Assistant automatically discover the devices, and configured them via the UI (Settings->Devices and Services->Integrations).

At first, all you get is a signal strength entity. Then after waiting for quite a long time (in some cases up to 24 hours) other entities appear for temperature, humidity, battery %, and battery voltage. They may appear in dribs and drabs over the course of several hours, i.e. you might get temperature and humidity first, then battery % and voltage several hours later. At some point an error also comes up on the integrations page asking you to reconfigure the devices (i.e. enter the bindkey). All entities except signal strength will show as unavailable until you enter the correct bindkey.

The signal strength entity is initially disabled - you might need to enable it before the other entities will appear. These entities are also initially disabled - you might also need to enable them before HA will ask you for the bindkey.

This worked with some LYWSD03MMC devices I bought in 2020, and also with some I bought last week (Feb 2024).

I’m running HA version 2024.2.0 on an Intel NUC 3rd Gen (DN2820FYKH).

Hint: if you have multiple devices, do the reconfigure step from the Settings->Devices and Services->Integrations->Xiaomi BLE page, so you can see the MAC address of the device you are entering the bindkey for. If you click the “reauthenticate integration” that pops up on the Settings page, it doesn’t show the MAC address, so you won’t know which bindkey to enter.

Hope this is helpful!

1 Like

Can anyone point me to steps, or a procedure for changing my unit back to Bluetooth after flashing the zigbee firmware? I successfully flashed one of my units to zigbee, and it’s working but I honestly prefer the Bluetooth telink firmware for now as after moving to zigbee I no longer have the ability to easily upgrade the units firmware again or change the settings should I so desire.

The custom firmware can be flashed via a modern browser and over-the-air (OTA) without opening the device and unlocks several customization options. You can go back to the original firmware at any time. OTA and configuration main page - TelinkMiFlasher.html.

I am aware of this, just not sure if the process is documented as now that the unit is running the new firmware it doesn’t show up in telink flasher over the air so I suspect I will need to connect up somewhere to flash the original firmware.
Thanks

You should be able to flash back via zigbee OTA.
With zigbee2mqtt you should be able to do the things you described without going back to BLE, like running OTA updates or change settings really easily. only downside is higher power consumption compared to ble.