LYWSD03MMC + OpenMQTTGateway + decode with bindkey in Hassio


I have an OpenMQTTGateway to collect date from BLE devices.
The new Xiaomi sensors like LYWSD03MMC are encrypting the traffic.
My OpenMQTT gateway does see the servicedata and the servicedateuuid so would hope I can decod this somehow with the bindkey a got via tool on

I would like to use the curren OpenMQTTGateway and not add again another ESP just to do the decoding.

Is this possible in Hassio ?


You don’t need to use the bind key, just update the firmware of your LYWSD03MMC with this

Using this tutorial:

And choose the custom advertising type

Hey thanks for the reply. Did try it but still don’t get it as seperate fields. I expect it is part of the servicedata mqtt message but how do you get it out/decoded

Are you sure you selected the custom advertising type, with this the data should be decoded directly and the sensor value added to the json message.

Yes I did select custom.
I don’t get a json message but the servicedata message is different now.
it starts with the mac address 00 and I think values in hex
frist two look the temp in hex so expect to find the rest after that but I’m not that experienced in stripping strings and converting hex to decimal and certainy not in hassio.

My openmqttgateway is configured to send separate mqtt messages for every value and not json because that is easier. Maybe that is teh problem

If I sum up,

Your devices are flashed with the custom firmware and the setting “Custom” advertising type.
You see the smiley blinking (to verify you have custom firmware).
But you don’t get temperature data into the json.

What is your version of OpenMQTTGateway?

my smiley is not blinking but when I change battery visible it does work
also i don’t get temp/hum any more in the flashing tool and also when I connnect it states custom firmware.
It also has an ATC name now
Can’t find the mqtt gateway version. Looks not in the files and is not send as mqtt topic.
Started playing with it jan 2020

it is indeed a hex string : mac 00 temp hum bat rest I didn’t find what it is

Hmm the openmqttgateway is your nice project.

This is your issue,
LYWSD03MMC was integrated in v0.9.5 (september 2020)

1 Like

Thanks, Was just reading your documentation and saw LYWSD03MMC was added in v0.9.5
Will download it tomorrow and test it. I have to check what I changed in the config to get it working.
thanks for helping and building this nice gateway.
Strange is that my smily doesn’t blink while it is on al the youtube tutorials

Hi, I flashed the new version and try to force it to manual setup but it doesn’t do it.
It looksit forces the esp into a sleep since it never leaves the setup part and tries the setup from time to time.
It looks to work with the wifimanager mode but strange thing is it just starts with the stored sid and password and doesn’t setup an access point.
Could you tell me what stupid mistake I’m making here.

This config does find the LYWSD03MMC_ATC and I do see the values in the json in the esp console.

Some issues I have

  • if I change the value for Base_Topic it stays home/…
  • the cleargrass no longer publishes the battery value but I do see a value tem what is the same as tempc

I suggest that you erase the flash and upload v0.9.5 again. There may be some flash key storage issues due to the migration from v0.9.4 to v0.9.5.

Are you sure it ever published battery ? Depending on the sensor model, the battery may not be published everytime or may not ever.

Yes I’m sure the cleargrass did publish the battery. Will see if it comes back.
I will also try to erase the flash and hope it will solve the wifi stuff
Any idea about the basic_topic that stays at home ?
It wasn’t home before I uploaded v0.9.5 so that looks a different issue ?

I changed the software a few times on the ESP but it still keeps home/…
Alse the cleargrass still doesn’t sent the batt info. I have the feeling the “tem” value it does send now is not necessary and replaced the “batt” value.
The new ATC_ do send the batt info inevery message.

and I suppose that you erased the flash also?

Could you indicate your cleargrass model?

The cleargrass model is : CGG1
For the ESP I don’t know more than uploading the config via arduino ide.
Could you point me to a link if possible.
Sorry if this looks a stupid question.

No stupid questions :wink:

You can download the Espressif tool

It enables to flash and erase (select developper mode->ESP 32 tool->select port and click erase)

Just in case someone else comes across the need for the flash download tool, it is now located at: