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

Thx anyway :slight_smile:

Helloā€¦ I loaded the integration for the Xiaomi BLE in Home Assistant and the integration found my Xiaomi Temperature/Humidity Sensor F3FE (LYWSD03MMC) which appeared to be awesome.

Only issue, despite the integration loading and discovering the sensorā€¦ this is what the integration shows.

Literally the only parameter it shows is the signal strength of the sensor? I have no idea why it would do this? I havenā€™t loaded any customer firmwares on the sensor, so is that possibly why? The connection to the Xiaomi Temperature/Humidity Sensor F3FE is via an ESP32 acting as a BLE proxy, but I dont see why that would be an issue?

Open to suggestions on what I may have missed, or what I could do to resolve the issue?

I do use BT on the HA host and BTHome integration, but have experienced what you described. You may have to wait for up to 60 minutes for the sensors to publish itā€™s data, and I could not find a way to change this on the stock firmware. My recommendation would be to flash the PVVX firmware and see how you get on with it then; much better in my experience.

Please follow the guide above, particularly the part flashing the sensors with custom firmware. Once youā€™ve followed the guide from start to finish, if you have problems please post and weā€™ll try to help.

Thanks. Due to a series of updates in HA there is zero need to load custom firmware, as HA supports the encryption key for the Xiaomi Temperature/Humidity Sensor. For me I prefer not to load custom firmware, so I followed the setup in this video which is much less complex.

https://youtu.be/5BEhAQwM0A0

Iā€™d recommend the options for non-firmware update and firmware update be spelled out, as some folks may not be that thrilled about changing firmwares.

Interesting. I tried the new BT features a couple of months back, they werenā€™t working quite right yet. Iā€™ll update at some point and try them again.

Once you have this working properly perhaps you could write up a guide and post a link here. Iā€™ll give it a shot and post a link to it.

Iā€™ve seen that video. He uses stock firmware and comments (around 6:33) that the sensor takes a long time for the sensor to send a request for the encryption key and asks if anyone if anyone knows how to fix it.

In my experience (with my particular setup), with stock firmware even after sending the first value it then took ages again to send the next, so the temperature looked like a long flat line for tens of minutes. But with the PVVX custom firmware not only was integration quick, so were the updates.

BT and BTHome have been mostly good.

Hi @n1md4 yes, same experienceā€¦ but I didnā€™t mind waiting.

I configured the sensor integration in HA, then about 20 minutes later HA popped up with a message, I entered the encryption key, then an hour or two later all the sensors were working.

No idea why it works that way, but if retaining the manufacturer firmware means waiting a bit of time then I dont mind. Not saying thereā€™s anything wrong with the custom firmware, but I have been taught in my line of work to question such code sources. Mind you, some original codes have vulnerabilities :stuck_out_tongue:

I am currently working out how far away from the BLE proxy the sensor can be and still work. Seems to be a reasonable distance which surprised me.

I had a spare sensor which I put in the fridge, surprised it worked! :slight_smile:

It would be interesting to move sensors to an area thatā€™s a lot colder or warmer to see if it updates more regularly. With the custom firmware it updates every x minutes or when the temperature changes by a certain threshold.

I have a Bluetooth sensor in the fridge which works fine, given I have the power turned up and a Bluetooth receiver with an antenna. The 433MHz sensors I have that arenā€™t compatible with HA are more reliable, but both works

The custom firmware extends the battery life, allows you to customize the comfort range, change the info on the screen, customize the reporting time and a whole lot more. The battery life alone is worth it, but also no need to deal with keys. Not to mention you can have 5 of them done in the 20 minutes you waited for the HA message to pop up, and have your whole house done in the hour or two it took to get the first update from your first sensor.

1 Like

I do experience frequent sensor disconnects (data becomes unavailable - rebooting the host fixes the issue), and wouldnā€™t know what to pin that on.

My setup is RPI3 ā†’ BalenaOS ā†’ Home Assistant Container ā†’ Bluetooth integration ā†’ BTHome sensor integration.

I guess my issue is due to the layers for Bluetooth, which I have read many issues about. I am contemplating using ESP BLE trackers, as my other ESPhome integrations have been rock solid.

To rule out any issue with the sensor, and regardless of setup, what experiences have other had with connectivity?

Once I put in a Bluetooth receiver with an antenna (Amazon link, tutorial link) itā€™s been solid. It just works. Raspberry Pi 4, Xiaomi bluetooth sensors.

Thanks, good to know. Would need a UK equivalent.

The HA Bluetooth compatibility page says quite a few ZEXMTE adapters are compatible. There are some on Amazon UK. Amazon doesnā€™t list model numbers anywhere I can see, so you might need to check their website for that. There are other brands listed / available as well.

If you manage to find one, please post a link so I can add it to the first post to make it easier for others.

1 Like

I tried setting up a Bluetooth Extender as per the YT video I posted a link to in December.

I got it up and working and the data duly arrived in HA. However as I added more sensors it became unstable to the point it eventually froze. Connecting it via USB to my laptop I could see that it went through a phase where it was still running but I could not connect via WIFI but it was still sending data to HA. Then the WIFI lost connection. I tried various suggestions online about creating a rule to reset the ESP32 if it lost WIFI but to no avail. It seems the ESP32 doesnā€™t like a lot of WIFI and Bluetooth activity at the same time.

I have now tried setting the ESP32 using ESPHome. I believe this polls the Bluetooth devices rather than trying to handle all the incoming BLE alerts. So far it has been stable with 10 of the Mi sensors on it. They are running custom firmware and pvvx advertising.
It reports: Temp, Humidity, Battery Voltage, Battery Level and Signal. I am using them as remote sensors for Zigbee radiator valves.

My house isnā€™t big but has a lot of thick granite walls, I was expecting to have to put several of these around the house but one is working fine. So now I need a new project for the spare ESP32s I had earmarked for this.

I also got an ESP32 to try to extend bluetooth range, but I found it didnā€™t help at all. Instead I just got a decent bluetooth receiver with an antenna and turned the power up on the bluetooth sensors a bit. If I had found an ESP32 with an antenna it may have worked better.

Hello,

I have 5 of the LYWSD03MMCs in my apartment. HA Supervised running on RPI4.

Previously running Xiaomi FW and Passive BLE integration for more than one year with few issues.

I have decided to give the custom firmware a try and flashed them with PVVX flasher, set the default advertising, 2500 with 4, BTHome discovery method, and a custom name for each.

Out of 5 units, only 3 are constantly available and sending data. 2 of them are either with unavailable data after discovery or they are not discovered at all.

I pumped the signal to +3 but without big success.

Using pvvx site I can see them, the data advertised ā€¦but on in HA,

I have also tried BLE HACS integration and only the 3 are discovered.

Trying to go back to the original FW did not yield any improvement.

Batteries were changed to new ones as well.

Does anyone have an idea where to start troubleshooting?

TIA

I would start by moving them fairly close to the Bluetooth receiver to work out if itā€™s a signal strength issue. After that I would probably try flashing them again, just to be sure. After thatā€¦ not sure really.

Done that :frowning:
For the last week I am doing so :frowning:

This is how it looks in the dashboard:

image

This is one with the issue:
image

The top one (kitchen) is coming and going throughout the day (and it is the good one):

image