Xiaomi Mijia LYWSD03MMC ESP32 support

I think we have the answer :slight_smile:
V0.9.4 is not compatible with LYWSD03MMC, only the development branch is.
So there is no binaries available yet, I’m planning to release v0.9.5 in September for info. v0.9.5 will be compatible.

In the meantime you may build the binaries yourself from the development branch.

1 Like

Thanks for clarifying! I have no idea how to compile the binaries myself, so I’ll patiently wait until v0.9.5 will be released. It won’t take that long until september arrives. :wink:

1 Like

With this custom firmware, the LYWSD03MMC advertises its data without encryption, so no need to connect to the sensor when using this custom firmware. The data are read every BLEinterval like all the other devices that advertise data.

Note that the flashing process takes less than 5minutes and is done over the air (impressive :-)).

3 Likes

Thanks for the info. Just flashed 4 of them.

1 Like

But OpenMqttGateway does not recognise them anymore :frowning:

UPDATE: LYWSD03MMC is Integrated from v0.9.5-beta

Updated, working fine now !

1 Like

Hello! AliExpress is currently (Feb 2021) selling “[Newest Version] XIAOMI Mijia Bluetooth Thermometer 2 Wireless Smart Electric Digital Hygrometer Thermometer Work with Mijia APP”. Is this one compatible with OpenMQTTGateway 0.9.5 please ?
I will purchase these if they will work. p.s. I am currently using v0.9.4beta and it works great with my Mi Scale and a cc1101 RF antenna. Excellent project to make my Home Assistant work so much better :slight_smile:

Hello,

I don’t know. It depends if they kept the same ble characteristic/service for off the shelf connection. For retrieving data by advertisement if we can flash them with Atc firmware they will be compatible. I’m curious about what brings this new version (I hope this is not about locking the compatibility with other devices)

Thanks. I will buy one and give the result here. A+

Hi,

I had a Mijia LYWSD03MMC sensor delivered a few days ago and so far my results using OMG 0.9.5 have not been very good, it seems to work for a while and then just stop being able to get readings.

Home Assistant shows that it worked for most of the last day, but around 3 hours ago it stopped getting readings (but it is still reporting seeing the beacons) - even in MQTT Explorer I can only see the Beacon reports.

I can read the sensor using the script from https://github.com/JsBergbau/MiTemperature2.git on my Pi4 without a problem, but despite a couple of restarts of my ESP32 module it has still failed to get a reading.

(The ESP32 is currently connected to the Pi4 USB and both are around 2m from the sensor).

my MQTT has home/OpenMQTTGateway/commands/MQTTtoBT/config (with retained flag set) is

{
  "white-list": [
    "A4:C1:38:BD:FC:24"
  ],
  "interval": 50000,
  "scanbcnct": 3,
  "onlysensors": false
}

All I see on the serial is:

N: Scan begin
N: Device detected: 7B:35:F2:FB:D9:D0
N: Device detected: A4:C1:38:BD:FC:24
N: Subject: /BTtoMQTT/A4C138BDFC24
N: Received json : {"id":"A4:C1:38:BD:FC:24","name":"LYWSD03MMC","rssi":-59,"distance":1.01076,"servicedata":"30585b050124fcbd38c1a4280100"}
N: Found 2 devices, scan number 7 end deinit controller
N: Scan begin
N: Device detected: A4:C1:38:BD:FC:24
N: Subject: /BTtoMQTT/A4C138BDFC24
N: Received json : {"id":"A4:C1:38:BD:FC:24","name":"LYWSD03MMC","rssi":-59,"distance":1.01076,"servicedata":"30585b050124fcbd38c1a4280100"}
N: Device detected: 7B:35:F2:FB:D9:D0
N: Found 2 devices, scan number 8 end deinit controller
N: Subject: /SYStoMQTT
N: Received json : {"uptime":482,"version":"v0.9.5","freemem":178428,"rssi":-51,"SSID":"NetworkSSID","ip":"xxx.xxx.xxxx.xxx","mac":"24:62:AB:F3:1F:80","wifiprt":0,"lowpowermode":0,"interval":50000,"scanbcnct":3,"modules":"BTHADiscovery"}
N: Scan begin
N: Device detected: 7B:35:F2:FB:D9:D0
N: Device detected: A4:C1:38:BD:FC:24
N: Subject: /BTtoMQTT/A4C138BDFC24
N: Received json : {"id":"A4:C1:38:BD:FC:24","name":"LYWSD03MMC","rssi":-63,"distance":1.602966,"servicedata":"30585b050124fcbd38c1a4280100"}
N: Found 2 devices, scan number 9 end deinit controller
N: BLE Connect begin
N: BLE Connect end

There appears to be no delay between the BLE Connect begin / end messages - so perhaps it is not doing much.

Is there anything else I can do ?

So having had a delivery of an ‘iTag’ device a while after my earlier post I removed the white-list option from the MQTT config and it started measuring the Temperature and Humidity from the sensor again.

This seems like a strange thing to happen - anyone got an explanation or any idea why ?

I agree that’s strange. I will look into it

Apart from this I advise you to go with the ATC firmware version, it is easy to upload and you will get a better battery life.

Unfortunately, I don’t reproduce your issue, I have added the same command with my LYWSD03MMC with custom firmware and I get the values.
Were you using the same LYWS03MMC firmware between the different attempts?

At present I have only 1 device and it has the Firmware it arrived with.

If it might help I have a 700k+ Trace log (I built and uploaded a version with LOG_LEVEL_TRACE whilst it was not working and reflashed it) the log runs for sometime either side of when the problem.

It might help indeed, you can send it to me by private message

Hello @1technophile!!

I am very happy to have found this forum.
I looked at your work and it is excellent!
Congratulations!
I have some BLE Temperature and Humidity Devices, one of which we are discussing at:

But I’m here to ask for your help with LYWSD03MMC.
I have one of these.

I tried to adapt your code to something very simple but I couldn’t. = (

I just need to read the data from LYWSD03MMC and play in the serial every minute. (or my m5 stickc LCD)

Would you help me out of this?

I appreciate any help.

Sorry to hear about your trouble @g0lgs. I bought 4 in February and they work perfectly with OMG 0.9.6. I flashed one with ATC and indeed the battery is draining slower than the other three.

1 Like

Dear all,

I ve been using the atc1441 firmware for almost 5 months with OpenMQTT - It is super reliable and stable (behind there is a Mosquitto + HomeAssistant + Grafana).
Thanks to this very positive experience i would like to replicate this architecture for more battery powered sensors like BH1750 and CMJS-811. I am looking for a BLE -MCU that can run on CR2032 and that can “beacon” values to the OpenMQTT MCU (mine is running on ESP32). What are your recommendation ? Thank you all.

Thanks for the feedback regarding the stability.

About this could you open a separate thread please, with an explanation of what values you would like to broadcast from the beacon.