New type Bluetooth Temperature sensor Xiaomi Mijia

Xiaomi seems to have a newer type of BLE temperature sensor, that is very cheap. I purchased a bundle of 4 for less than €13 at a well-known Chinese webstore. It is quite a bit more compact than the original one and works from a coin cell battery.

Unfortunately it does not seem to work at this moment with the mitemp_bt integration. It makes itself known by “LYSWSD03MMC” which is different than “MJ-HT-V1” and for me already an indicator of trouble. I added its MAC address to the configuration yaml file, but I get a warning that no data could be retrieved.

Does anyone have experience with these sensors and know how to get it to work with HA? I don’t have any experience in reading out raw data from the device.



3 Likes

did you try this custom component, your device is supported:

LYWSD03MMC

(small square body, segment LCD, broadcasts temperature and humidity once in about 10 minutes and battery level once in an hour, advertisements are encrypted, therefore you need to set the key in your configuration, see for instructions the encryptors option)

it’s also available through HACS:

4 Likes

Thanks will give it a try.

It works. thanks for pointing to this.
I managed to get the sensor working by following the work instructions.

2 Likes

I have 2 small square “LYWSD03MMC” sensor but cant get the ID for the encryptors. When use the packet capture app, for example, to get the ID, at the MI HOME APP i have an error when trying to pair the device.

What the best way to get thr ID?
how did i get?

Sereno

Hi

I have just finished configuring for one of these devices.

You need to get the MAC address AND the Bind Key.

I got info on getting the Bind Key here:- (http://www.room-assistant.io/integrations/xiaomi-mi.html#encryption)

Click on the grey box to see the instructions. Do wait until the log at the bottom of the page confirms the connection before pressing Do Activation.

The only subsequent problem I had was getting the YAML formatting correct. Here is a copy of mine:-

    sensor:
  - platform: mitemp_bt
    sensor_names:
      '4C:65:A8:D2:2F:78': 'Main Bedroom'
      'A4:C1:38:81:88:67': 'Landing'
    encryptors:
      'A4:C1:38:81:88:67': '7f3e7afe5539a1a72333d53f9aa3b4bc'

Hope this helps.

EDIT : It looks as though posted YAML code has not retained the correct spacing.!

I think removing the spaces in front of > sensor < should fix it.

thank for you help. It’s work fine

@Sergio_Sereno @AcmeUK @Bart_Huitsing @elRadix.
Hey guys! I am arriving here after a forum search. What is your experience of the new square device, in terms of battery longevity and reporting frequency? I’m in the UK looking for cheap easy small temp sensors - not bothered about humidity but at a few £ each these look a great option.

1 Like

I have two of this xiaomi and i have nome now to SONOFF SNZB-02, because this works with mqtt or zigbee with im my case it’s important. My home have zones witch are far away from HomeAssistant NUC. But if distancy (5 mts) is not a problem they work’s fine.

@ Sergio_Sereno
If distance is a problem you could use ESPHome with a ESP32 collecting the measurements and forwarding them by wifi.

@Sergio_Sereno many thanks for the reply.
I have since purchased and installed these Xiaomis through the house. My home has three floors. The BLT controller in my home is BluetoothV4.1 in a Raspberry Pi 3B+. It is about 25metres away from the furthest Xiaomi sensor, and that is through 4 walls and 2 floors. It works perfectly. Not sure why you advise of 5 metre limit :roll_eyes: :grimacing:? I would get your controller / environment checked out pal.

Edit

I was guessing the distance. I’ve just unravelled a roll of string an measured the ‘step by step’ distance through the house. It is 13.8 metres. Not quite my 25 metres guess , but a darn much more than 5 metres :slight_smile:

2 Likes

With bluetooth 4, 10 meters is the maximum distance between the server and the sensor. The walls in my house are in concrete with isolation, and also have two floors. With mqtt (SONOFF SNZB-02) in can have the problem solve because it runs over the wifi network and are more efficient than the bluetooth

BLE4 is 30 metres theoretical.

BLE4.1 can connect through cloud. I have hacked APIs and Keys for my devices so they connect via my router :wink:

My 4.0 devices are between 5 and 15 metres - no problems
My 4.1 devices, well, all over :slight_smile:

check your system ! :smiley:

EDIT: There’s quite a lot at play with BT so I am being a little unfair probably. But you should get more than 10m

Hi
I have multiple xiaomi_lywsdcgq sensors over 3 levels with concrete floors. Tried ESP32s and although the wifi connection was good, the BLE to the Xiaomi sensors at best 4 meters if on opposite wall and less than 2 meters if on same wall as sensor. In the end I used 2 Raspberry Zero W(via LAN) with home assistant and remote_homeassistant on my main homeassistant and it works very well. RPIZeroW can connect >5 meters though 1 concrete wall. This has also allowed me to connect by BLE to multiple EQ3 TRV on each level and the RPIZeroW share the load so all the EQ3 respond much faster.

You are right theoretical ble can reach up to 30 mtrs, but in the xiami app you will get a message telling that the sensor needs to be in 10 mtrs range but i cant connect them in the secound floor to my HA. The solutions was nove to mqtt platform.

This is my experience with then, they are good but i prefer use the same protocol to all my devices.

I do not use the Xiaomi app, their cloud, or any other crap.
I flash custom firmware (easy peesy) GitHub - pvvx/ATC_MiThermometer: Custom firmware for the Xiaomi Thermometers and Telink Flasher
I have 9 of the little square sensors all over a three storey home through walls and ceilings. No issues whatsoever.

I too find the Xiaomi LYWSD03MMC-ATC sensors easy to use, solid and a great value using the hack cited. My use of 10 of them documented here:

https://github.com/deepcoder/bluetooth-temperature-sensors

TBH, I gave up with the custom f/w flash. I tried the original hack + others who forked the github repo.
Once the sensors were flashed, they could not be discovered on my PC, and Raspberry Pi3 and a Pi4. Reflash OEM and it was fine. The hack OTA flash tool could still connect to them though. Wiered. Not looked at the source code but the lowest BLT version Im using is 4.1 so they should be fine.
Anyway, using OEM for now and much further than 10m btw everyone.

Well that is bummer… well they are still a good value at 4 bucks. You could give a try to my little c program on your raspberry pi and see if it will see the custom firmware Xiaomi’s. Additionally, you have a number of options with other sensors as well, my code and a number of other folks code work with other Xiaomi devices and Govee devices.

One thing I learned, is that the manufacture life of some of these devices can be short. So if you find something that works, quickly buy a supply. Devices will go out of manufacture, or undocumented hardware change under the covers, or firmware change/lockdown…

Good hunting and Happy New Year!

Mmm. but I don’t need mqtt, BT protocol works fine in HA, so why use nqtt? Seems to me ostensibly just more resources and config , for what? I’m not seeing the point.