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

Thanks to the developer of the custom firmware i’ve solve the problem
here is the solution

2 Likes

Interesting that low power mode causes the problem. Lucky it can be turned off :slightly_smiling_face:


As the developer says in the issue, disabling the low power mode solve the problem on all the 3 sensors. The problem is related to the hardware because there are different HW versions of the sensor

1 Like

I have two LYWSD03MMC sensors HW rev 1.4 both flashed with pvvx ATC_v47.bin BLE firmware. There seems to be a plethora of various websites all with very similar instructions how to do the flashing with pvvx Telink, first to BLE then Zigbee. Then there’s devbis FW and some other proprietary flashers

I played around with ATC_v48 and was a bit surprised the logs reported different sensors for v47 vs v48 but that’s another story. The table in pvvx documentation suggests SHTC3 is correct for v1.4HW.

Anyway, my query concerns adding one troublesome device to HA (BTHome Integration); it just does not get recognised. I have been up and down the various FW, first flashed via UART-TTL to Original_OTA_Xiaomi_LYWSD03MMC_v1.0.0_0130.bin (it was 2.1.1_0159 and that was the only way to downgrade), to ATC_ota_40000.bin to ATC_47.bin to ATC_v48.bin.

It just does not appear in HA. I have two Xiaomi Gateway 2s one with BLE, one with Zigbee Integration but I also tried a standalone BT Dongle with BLE.

I can interrogate it and change parameters via the pvvx Telink Flasher OK (albeit it can be tough to get a connection). I do have to click connect / reconnect a fair bit to get it to ‘take’ and offer the blue boxes. When I check using a BLE App it shows the device is actually available and contactable.

My other identical HW device (but I did not have to UART-TTL flash this one) added to HA just fine (and reports temps etc regularly) the other does not, not as a BLE Device Anyway.

However when I flash the troublesome one to Zigbee using Z03MM_v0123.bin it is recognised by HA (Xiaomi Gateway 2 with Zigbee Integration) and works OK, so the unit does work, just does not seem to like BTHome, even if it appears it has identical FW to the other. I did try pvvxCustom (vs BTHomev2) to no avail.

I’m at a loss, does anyone have any ideas on how to troubleshoot this or is it just doomed…

ta,

k.
[EDIT] Brief update: ok, so the only mode it connected to HA with (apart from Zigbee) was the Mijia mode. This is an interesting perspective, with some using older binaries and some using atc1441, pvvx or mijia but not BTHome.

I have 10 x LYWSD03MMC sensors flashed to zigbee thanks to the telink flasher.

Is there a way to apply temp/humidity offsets and slope like with the ATC firmware?
I use a slzb-06 gateway with HA but have no other zigbee interface on my laptop, and still new to this…

Would like to calibrate them, for example adjust the constant humidity offset of these two measuring saturated salt solution:

OK so I am replying to my own post and hopefully this will help someone:

As above, I have two devices, I deleted one and it was never to be seen again. I know it work as I can see it advertising itself when I check bluetoothctl devices in a HA terminal. I though tit was a bad flash, wroing advertising mode, integration wrong, settings wrong, a bad device. It was none of these.

So after four days, I have found a FIX … the issue os NOT that the device flashed with e.g. custom firmware LYWSD03MMC from pvvx (or whoever) using BTHome as the advertising type is not working in your Xiaomi H&T Sensor (all text for future searchers…), it is simply that at some stage you (like me) have “Dismissed” or ignored adding a device and BTHome simply remembers that.

Note that this applies to other integrations where things do not get added back in or found again…

So:

  1. Fire up WinSCP (assuming you have FTP Access to your HA IP Address). I attach some screenshots from the Terminal & SSH Addon but will leave you to figure that out.
  2. Navigate to /homeassistant/.storage and find the file core.config_entries.
  3. Open it in a text edtor and carefully (without deleting or changing any other text) search for either BTHome (or if you are having other items ignored, try “source”: “ignore” (this one with quotes “”) or just ignore.
  4. Amend ignore (provided it is a bluetooth device that is being ignoed !!) to bluetooth.
  5. SAVE the file. Exit WinSCP. Exit HA or restart it. Go back in and check the BTHome integration. it shoudl have added your device back in.
  6. IF in the interim you added the device using a DIFFERENT advertising type (or integration), it MAY show the device under BTHome as having TWO integrations AND ALSO under e.g. Xiaomi BLE, TWO integrations. Just delete the oine you do not want (in my case Xiaomi BLE) and oit will shows a single advertsining type device under BTHOME.

HTH as it has taken me four days to find this out; I thought my device was stuffed. It wasn’t. HA was just doing what you told it to do… and forgot :-).

[EDIT] It has been pointed out to me by pvvx there is an easier way to “Show ignored integrations”, see last pic below, from Settings, Devices and Services, Drop-Down Menu Top Right, which you should try FIRST. I am pretty sure this was not available on my HA system, so the above should still work.

k.






1 Like

Hello,

I managed to flash 4 of the Xiaomi lywsd03mmc temperature/humidity sensors. 3 of them work just fine, I was also able to get Z2M up and running and 3 of the sensors appear as expected. They got the firmware which shows them like this:

Wiht the sensor that I flashed first though, I obviously did a mistake in the flashing procedure. After it was flashed, the display went out and stayed completely out. Though the device reacts on the Reset action (short the two pins) and it appears in Z2M as well.
This one is shown as this:

I can’t really tell, what went wrong, but something went wrong with my actions on the first one.

Is there a chance to get another firmware flashed to the faulty one, how would I do that?

Thanks a lot guys.

Hi,

Tried a new battery first presumably?

Could you please clarify a couple of things so we can understand what you’ve done so far?

  1. What FW did the successful flash have originally, what Telink Flasher did you use (there are a number of versions floating around, pvvx, atc1441, popeen) and what sequence did you follow, Telink direct to Zigbee (following activation) or did you flash ATC_47 BLE first, then reconnect and go Custom to Zigbee?
  2. What was the original FW on the one that did not work , did you happen to update it to 2.1.1_159 (you should not do this). If yes there is a way to flash a downgrade to original Xiaomi v130 using UART-TTL, then to BLE/Zigbee.

https://github.com/devbis/z03mmc/issues/31

See UART connections I did in these GitHub posts under jksmurf.

Hi,
I hopefully can provide useful answers. Disclaimer: I did not spend any time at all, what FW the devices had before :see_no_evil:

  • new battery tested - no change, display is dead
  • First, I followed the instructions here: https://smarthomescene.com/guides/convert-xiaomi-lywsd03mmc-from-bluetooth-to-zigbee/ → Convert LYWSD03MMC to Zigbee (OTA, devbis) - there you do the interim step with the transition FW
  • Since that was not successful I took a shot with → Convert LYWSD03MMC to Zigbee (OTA, pvvx) - which succeeded, when you directly flash the target FW

Since the faulty device is available in Z2M - isn’t there a way to manipulate the FW?

Anyone could help to apply humidity value offsets at sensor level once flashed to zigbee?

I can do templates for each entity but would rather do it at sensor level if possible.

Certainly in that link you provided, the site notes the updated option is converting LYWSD03MMC directly to Zigbee (OTA, pvvx), so you do not need to go via devbis two-step flash any more.

I am guessing that as you went the devbis route first, and your device shows “Vindriktning z03mmc” it has flashed that IKEA Vindriktning firmware shown here, either the ATC_ota_40000.bin or the z03mmc.bin. I am not sure if yours made it to the 1141-0203-11003001-z03mmc.zigbee stage or not.

IF it is actually still a BLE unit (i.e NOT Zigbee), you could try (first) to reconnect to it using the pvvx TelinkFlasher and just reflash. I do not think it is a BLE unit any more though. It’s hard to tell what happened to your first unit TBH, it seems to be reporting as a Router in your image shown. Very odd.

So there’s a few options:

A. Check if the Display can be Enabled

It may be that it is already a working Zigbee (Z2M) Device, but perhaps there is (was) an option that turns off the display and you have accidentally enabled that (either in the FW OR in HA itself)? I am sorry I do not know enough about it to say for sure. I would suggest you ask on Github (Issues) in either of:

GitHub - pvvx/ATC_MiThermometer: Custom firmware for the Xiaomi Thermometers and Telink Flasher OR
GitHub - devbis/z03mmc: Xiaomi LYWSD03MMC Zigbee Firmware

or in this forum, if it is an HA issue. See also here for enabling the display..

B. Revert devbis Zigbee FW to pvvx BLE FW

As you (appear) to have flashed to Zigbee, there’s no way to reconnect using the Telink Flasher to do a reflash unless you revert to BLE. I only converted my units to Zigbee once for a short time, then I used this site to convert them back to BLE.

IF you are able to see the Unit in the Zigbee2MQTT dashboard, then you could try to convert the device BACK to BLE (pvvx’s xxxxx_ACT_47.bin), (optionally) flash the original Xiaomi FW, and then convert to Zigbee again (like your successful units) to see if that works.

I used WinSCP for SSH Access to add my_index.json to the /config/zigbee2mqtt/ dir and modify the configuration.yaml.

You then just put the bin (in my case 1141-020a-99993001-ATC_v47.zigbee worked) into the new OTA Dir (that you create and point to) and go the Zigbee2MQTT Dashbaord and check for new Firmware and “update” it back to BLE. You need to wait patiently for this process to complete.

C. Update devbis Zigbee FW to pvvx Zigbee FW

I have not tried this so it is very experimental, if the FW is visible, you may be able to repeat (B) above but just use pvvx zigbee FW 1141-020a-01233001-Z03MMC.zigbee here and “upgrade” (i.e. CHANGE ‘devbis Zigbee’ to ‘pvvx Zigbee’) using the same procedure. No idea if that will work.

D. UART Route

Lastly, go the UART Route and reset, then flash the Telink Chip. You will need to order the right UART-TTL converter, they are cheap and it is fiddly, but you will need to decide if you want to learn something cheaply or just forget it as the H&T is so cheap.

The links for this I have already provided in my post above but here is a summary of what I did on mine.

Let us know how you get on :-).