『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 6491|回复: 2

[技术探讨] 【已解决】米家小白万能遥控串口捕获米家温湿度计2数据解

[复制链接]

1

主题

12

帖子

77

积分

注册会员

Rank: 2

积分
77
金钱
65
HASS币
0
发表于 2020-6-27 18:44:48 | 显示全部楼层 |阅读模式
本帖最后由 漫步时光 于 2020-6-27 19:28 编辑

之前618购入了米家小白万能遥控器作为蓝牙网关接入温湿度计,采集了一段事件的串口输出,发现温湿度的解析存在存疑,数据内容很奇怪
根据官方提供的信息eid 0x1004(4100) 0x1006(4102)分别代表温湿度,edata表示的值看不太明白,坛子里有大佬能解析下嘛?

一共有两个温湿度计2 可通过mac区分
原始日志还包含电量数据

官方文档:https://iot.mi.com/new/doc/embedded-development/ble/object-definition.html

以下为原始数据

13:09:40.850 [D] ots: {"id":1009782353,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"1201"}],"frmCnt":168,"gwts":1820}}
13:09:43.850 [D] ots: {"id":1898712664,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4106,"edata":"64"}],"frmCnt":169,"gwts":1823}}
13:09:47.350 [D] ots: {"id":957812319,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"4503"}],"frmCnt":170,"gwts":1827}}
13:10:50.850 [D] ots: {"id":258739941,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"fb02"}],"frmCnt":8,"gwts":1890}}
13:10:53.850 [D] ots: {"id":1317080814,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0a01"}],"frmCnt":9,"gwts":1893}}
13:20:19.350 [D] ots: {"id":293147484,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0701"}],"frmCnt":177,"gwts":2458}}
13:25:57.850 [D] ots: {"id":1625298444,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"0803"}],"frmCnt":17,"gwts":2797}}
13:26:58.350 [D] ots: {"id":748033672,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0301"}],"frmCnt":19,"gwts":2858}}
13:30:18.850 [D] ots: {"id":290396187,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"1603"}],"frmCnt":179,"gwts":3058}}
13:31:18.350 [D] ots: {"id":1800280211,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0901"}],"frmCnt":181,"gwts":3117}}
13:36:57.350 [D] ots: {"id":327818049,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"0903"}],"frmCnt":21,"gwts":3457}}
13:37:57.850 [D] ots: {"id":1810766783,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0801"}],"frmCnt":23,"gwts":3517}}
13:39:57.850 [D] ots: {"id":1173626038,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4106,"edata":"64"}],"frmCnt":25,"gwts":3637}}
13:41:17.350 [D] ots: {"id":338238806,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"2103"}],"frmCnt":183,"gwts":3717}}
13:42:17.850 [D] ots: {"id":1987059154,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0b01"}],"frmCnt":185,"gwts":3777}}
13:47:56.850 [D] ots: {"id":1711939707,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"0a03"}],"frmCnt":27,"gwts":4116}}
13:48:57.850 [D] ots: {"id":781263094,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0c01"}],"frmCnt":29,"gwts":4177}}
13:50:16.850 [D] ots: {"id":212738451,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4106,"edata":"64"}],"frmCnt":187,"gwts":4256}}
13:52:17.350 [D] ots: {"id":366027399,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"2203"}],"frmCnt":189,"gwts":4376}}
13:53:16.350 [D] ots: {"id":32056063,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0d01"}],"frmCnt":191,"gwts":4435}}
13:58:57.350 [D] ots: {"id":1055139245,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"9d02"}],"frmCnt":31,"gwts":4777}}
13:59:58.350 [D] ots: {"id":442639913,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0701"}],"frmCnt":33,"gwts":4837}}
14:03:15.350 [D] ots: {"id":1513957302,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"e702"}],"frmCnt":193,"gwts":5034}}
14:04:16.350 [D] ots: {"id":1269639218,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0901"}],"frmCnt":195,"gwts":5095}}
14:09:57.850 [D] ots: {"id":1605184233,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"ee02"}],"frmCnt":35,"gwts":5437}}
14:10:56.350 [D] ots: {"id":1344547678,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0801"}],"frmCnt":37,"gwts":5496}}
14:14:14.850 [D] ots: {"id":605760749,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"1003"}],"frmCnt":197,"gwts":5694}}
14:15:15.850 [D] ots: {"id":665857384,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0a01"}],"frmCnt":199,"gwts":5755}}
14:20:57.350 [D] ots: {"id":554577944,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"0303"}],"frmCnt":39,"gwts":6097}}
14:21:57.850 [D] ots: {"id":1000812692,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0c01"}],"frmCnt":41,"gwts":6157}}
14:25:14.350 [D] ots: {"id":2108240415,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"1103"}],"frmCnt":201,"gwts":6354}}
14:26:13.350 [D] ots: {"id":1438724758,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0e01"}],"frmCnt":203,"gwts":6413}}
14:31:57.350 [D] ots: {"id":49034570,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"c802"}],"frmCnt":43,"gwts":6757}}
14:32:56.350 [D] ots: {"id":232011201,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0601"}],"frmCnt":45,"gwts":6816}}
14:36:14.350 [D] ots: {"id":1962555220,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"f402"}],"frmCnt":205,"gwts":7013}}
14:37:13.850 [D] ots: {"id":1264859086,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0901"}],"frmCnt":207,"gwts":7073}}
14:39:56.850 [D] ots: {"id":353843482,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4106,"edata":"64"}],"frmCnt":47,"gwts":7236}}
14:42:57.350 [D] ots: {"id":1189100164,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"fb02"}],"frmCnt":49,"gwts":7417}}
14:43:55.850 [D] ots: {"id":1237662460,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0901"}],"frmCnt":51,"gwts":7475}}
14:47:12.350 [D] ots: {"id":2023111814,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"1303"}],"frmCnt":209,"gwts":7671}}
14:48:12.850 [D] ots: {"id":297614593,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0b01"}],"frmCnt":211,"gwts":7732}}
14:50:13.850 [D] ots: {"id":1068973555,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4106,"edata":"64"}],"frmCnt":213,"gwts":7853}}
14:53:55.850 [D] ots: {"id":477773745,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"d402"}],"frmCnt":53,"gwts":8075}}
14:54:56.350 [D] ots: {"id":2048046,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0c01"}],"frmCnt":55,"gwts":8135}}
14:58:11.350 [D] ots: {"id":1469006262,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"e202"}],"frmCnt":215,"gwts":8331}}
14:59:12.350 [D] ots: {"id":507986482,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0a01"}],"frmCnt":217,"gwts":8391}}
15:04:55.850 [D] ots: {"id":768754921,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"e902"}],"frmCnt":57,"gwts":8735}}
15:05:56.850 [D] ots: {"id":619464036,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0801"}],"frmCnt":59,"gwts":8796}}
15:09:11.350 [D] ots: {"id":1082017516,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"0b03"}],"frmCnt":219,"gwts":8991}}
15:15:55.850 [D] ots: {"id":293947931,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"fe02"}],"frmCnt":61,"gwts":9395}}
15:16:57.350 [D] ots: {"id":315706008,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0d01"}],"frmCnt":63,"gwts":9456}}
15:20:09.350 [D] ots: {"id":309414940,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"f802"}],"frmCnt":223,"gwts":9649}}
15:21:10.350 [D] ots: {"id":812797079,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0d01"}],"frmCnt":225,"gwts":9710}}
15:26:56.350 [D] ots: {"id":312037199,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"cd02"}],"frmCnt":65,"gwts":10056}}
15:27:56.850 [D] ots: {"id":1285836747,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0901"}],"frmCnt"�ˤ�׉:10116}}
15:31:10.350 [D] ots: {"id":2093830479,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"0303"}],"frmCnt":227,"gwts":103q�__�+j�15:31:10.830 [D] ots: recvd 40Bytes
15:32:09.350 [D] ots: {"id":1264472518,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100��~,�15:32:09.500 [D] ots: recvd 40Bytes
15:37:55.350 [D] ots: {"id":133715078,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"ec02"}],"frmCnt":69,"gwts":10715}}
15:38:55.850 [D] ots: {"id":498226433,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0e01"}],"frmCnt":71,"gwts":10775}}
15:39:56.350 [D] ots: {"id":1694127486,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4106,"edata":"64"}],"frmCnt":73,"gwts":10836}}
15:42:09.350 [D] ots: {"id":648894091,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"0e03"}],"frmCnt":231,"gwts":10968}}
15:43:08.350 [D] ots: {"id":2110215939,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0e01"}],"frmCnt":233,"gwts":11027}}
15:48:55.850 [D] ots: {"id":1574197694,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4102,"edata":"9302"}],"frmCnt":75,"gwts":11375}}
15:49:55.350 [D] ots: {"id":2116246069,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx2","mac":"AA:00:11:22:33:02","pdid":1371},"evt":[{"eid":4100,"edata":"0901"}],"frmCnt":77,"gwts":11435}}
15:50:08.350 [D] ots: {"id":1755470416,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4106,"edata":"64"}],"frmCnt":235,"gwts":11448}}
15:53:08.350 [D] ots: {"id":1214471099,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4102,"edata":"f102"}],"frmCnt":237,"gwts":11627}}
15:54:07.350 [D] ots: {"id":1132026935,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.xxxxxxxxxxxx1","mac":"AA:00:11:22:33:01","pdid":1371},"evt":[{"eid":4100,"edata":"0a01"}],"frmCnt":239,"gwts":11687}}



回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

发表于 2020-6-27 18:57:02 | 显示全部楼层
本帖最后由 XCray 于 2020-6-27 19:10 编辑

看我的帖子,非常清楚,有3套代码解析这个数据(python、arduino c、esphome c),除了这个还有花花草草、榉树门锁(这个才是主要目的)。
这里简单说一下:edata的格式是十六进制逆序,量纲是0.1度/0.1%。

比如2103,你需要调整顺序为0321(字节内顺序不动、字节间调整),然后转换成10进制(也就是801)、然后再除以10(这个应为湿度,80.1%。如果是80摄氏度就太恐怖了
回复

使用道具 举报

1

主题

12

帖子

77

积分

注册会员

Rank: 2

积分
77
金钱
65
HASS币
0
 楼主| 发表于 2020-6-27 19:28:08 | 显示全部楼层
XCray 发表于 2020-6-27 18:57
看我的帖子,非常清楚,有3套代码解析这个数据(python、arduino c、esphome c),除了这个还有花花草草、 ...

好的,非常感谢,我之前看到示例代码reverstr以为是整个倒转,所以一直解出来的数据都很奇怪对不上
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-26 05:49 , Processed in 1.256406 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表