Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8015

Automation, sensing and robotics • Re: Getting Data From a Xiaomi Mijia LYWSD03MMC Temperature Humidity sensor

$
0
0
I tried based on your code:

Code:

pi@raspsky:~/webcam $ gatttool -bA4:C1:38:00:FF:AD --char-write-req --handle='0x001c' --value="0100" --char-write-req --handle='0x0023' --value="0100"  --char-write-req --handle='0x0026' --value="0100" --listenCharacteristic value was written successfully
But then it just gets stuck there and doesn't return any values. That MAC address is the new sensor which I think is firmware version 1.0.0_0130.
You can list all handles via

Code:

gatttool -b ... --char-desc
That will show what handles are available and hint at what firmware type it is and which handles can be used for subscribing. If you don't see handles 0x001c,0x0023,0x0026 in the list with uuid = 00002902-.... then it won't work.

Also this is not all super reliable so maybe try multiple times, these device are set to respond very slowly to save battery and sometimes maybe stuff get lost when sending or receiving. But it probably won't work, see below.
What firmware version did you use?
The original firware shows in log as

Code:

10:36:24 AM: Connecting to: LYWSD03MMC10:36:32 AM: Hardware Revision String: B1.410:36:32 AM: Software Revision String: 010610:36:32 AM: Firmware Revision String: 1.0.0_010610:36:32 AM: Detected Mi device10:36:32 AM: Connected10:38:27 AM: Disconnected.
this one has that long list of handles from my previous post and your script works with handle 0x038. Then I have

Code:

10:38:40 AM: Connecting to: ATC_C9521E10:38:51 AM: Hardware Revision String: B1.410:38:51 AM: Software Revision String: V5.110:38:51 AM: Firmware Revision String: github.com/pvvx10:38:51 AM: Detected custom Firmware10:38:52 AM: Hardware Version: LYWSD03MMC B1.4, Software Version: 5.1
This is custom firmware 5.1 from pvvx, with this one subscribing to those three handles works for me.
I also have one old but custom still from atc1441 before pvvx took over and this shows as

Code:

11:08:15 AM: Connecting to: ATC_4F716111:08:23 AM: Detected custom Firmware11:08:24 AM: Detected alternative Firmware? Use: https://pvvx.github.io/ATC_MiThermometer/TelinkOTA.html

12:52:30: Searching for devices
12:52:36: Connecting to: LYWSD03MMC
12:52:36: Detected Mi Thermometer
12:52:36: Fw_version: 2.1.1_0159
12:52:36: Connected
12:55:24: Disconnected.

I'm sure this is the new sensor. But, since the battery is out I don't know how it could possibly connect:

12:55:48: Searching for devices
12:56:02: Connecting to: ATC_C5333A
12:56:38: Detected Mi Thermometer
12:56:38: Fw_version: 1.0.0_0130
12:56:38: Connected

As you can see, after hours and hours, I'm still lost.
the first looks like new xiaomi firmware 2.1.1_0159. For that see warning at the beginning of https://github.com/pvvx/ATC_MiThermomet ... /README.md

The second one looks like previously custom (the device name still starts with ATC_) but with old original xiaomi restored. So none of those two is running custom firmware made by pvvx and none will work with my example.

For the first one with new xiaomi firmware (and probably also new and worse hardware) I would recommend to stay on xiaomi firmware and if you have trouble with it, post here a list of all handles produces by gatttool -b ... --char-desc, maybe there is other handle number that will work with your original script on this new xiaomi firmware.

Statistics: Posted by fanoush — Sun Nov 30, 2025 10:25 am



Viewing all articles
Browse latest Browse all 8015

Trending Articles