chore: 提交高层 xiaomi 封装库及示例

- 新增 xiaomi/examples/ 下 8 个示例程序(用户/家庭查询、设备列表、开关/灯光/空调控制、属性订阅、高级过滤分类、SPEC 解析)
- miot_client_sub.go: 重构 SubProp/SubEvent,使用 buildPropTopic/buildEventTopic 支持通配符订阅(siid/piid=0 → +),并修复锁顺序问题(将 RequestRefreshProp 移到 Lock 外)
- spec_parser.go: 新增 downloadSpecFile 方法,本地 SPEC 文件缺失时自动从 miot-spec.org 下载
- ARCH_PLAN.md: 架构设计从 Proposed 更新为 Accepted(v1.0→v1.1),补充设备分类/工厂/SPEC 映射等模块设计
- xiaomi/: 新增 miot 上层强类型封装模块,包含 Client 主入口、用户/家庭/设备 API、属性读写、动作调用、订阅通知,以及 devices/ 设备控制抽象(Switch/Light/AirConditioner/Fan/Cover/Humidifier/Vacuum/WaterHeater/Thermostat)和 specs/ SPEC 查询辅助
- 更多 xiaomi 示例(风扇/窗帘/传感器控制)
This commit is contained in:
2026-06-29 08:51:21 +08:00
parent 35efed7d15
commit a3d94c4b9f
93 changed files with 7582 additions and 157 deletions
@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIBazCCAQ+gAwIBAgIEA/UKYDAMBggqhkjOPQQDAgUAMCIxEzARBgNVBAoTCk1p
amlhIFJvb3QxCzAJBgNVBAYTAkNOMCAXDTE2MTEyMzAxMzk0NVoYDzIwNjYxMTEx
MDEzOTQ1WjAiMRMwEQYDVQQKEwpNaWppYSBSb290MQswCQYDVQQGEwJDTjBZMBMG
ByqGSM49AgEGCCqGSM49AwEHA0IABL71iwLa4//4VBqgRI+6xE23xpovqPCxtv96
2VHbZij61/Ag6jmi7oZ/3Xg/3C+whglcwoUEE6KALGJ9vccV9PmjLzAtMAwGA1Ud
EwQFMAMBAf8wHQYDVR0OBBYEFJa3onw5sblmM6n40QmyAGDI5sURMAwGCCqGSM49
BAMCBQADSAAwRQIgchciK9h6tZmfrP8Ka6KziQ4Lv3hKfrHtAZXMHPda4IYCIQCG
az93ggFcbrG9u2wixjx1HKW4DUA5NXZG0wWQTpJTbQ==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIBjzCCATWgAwIBAgIBATAKBggqhkjOPQQDAjAiMRMwEQYDVQQKEwpNaWppYSBS
b290MQswCQYDVQQGEwJDTjAgFw0yMjA2MDkxNDE0MThaGA8yMDcyMDUyNzE0MTQx
OFowLDELMAkGA1UEBhMCQ04xHTAbBgNVBAoMFE1JT1QgQ0VOVFJBTCBHQVRFV0FZ
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEdYrzbnp/0x/cZLZnuEDXTFf8mhj4
CVpZPwgj9e9Ve5r3K7zvu8Jjj7JF1JjQYvEC6yhp1SzBgglnK4L8xQzdiqNQME4w
HQYDVR0OBBYEFCf9+YBU7pXDs6K6CAQPRhlGJ+cuMB8GA1UdIwQYMBaAFJa3onw5
sblmM6n40QmyAGDI5sURMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSAAwRQIh
AKUv+c8v98vypkGMTzMwckGjjVqTef8xodsy6PhcSCq+AiA/n9mDs62hAo5zXyJy
Bs1s7mqXPf1XgieoxIvs1MqyiA==
-----END CERTIFICATE-----
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"type":"urn:miot-spec-v2:device:fan:0000A005:jipin-f003:1:0000D062","description":"jipin fan f003","services":[{"iid":1,"type":"urn:miot-spec-v2:service:device-information:00007801:jipin-f003:1:0000D062","description":"Device Information","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:manufacturer:00000001:jipin-f003:1:0000D062","description":"Device Manufacturer","format":"string","access":["read"],"source":4},{"iid":2,"type":"urn:miot-spec-v2:property:model:00000002:jipin-f003:1:0000D062","description":"Device Model","format":"string","access":["read"],"source":4},{"iid":3,"type":"urn:miot-spec-v2:property:serial-number:00000003:jipin-f003:1:0000D062","description":"Device ID","format":"string","access":["read"],"source":4},{"iid":4,"type":"urn:miot-spec-v2:property:firmware-revision:00000005:jipin-f003:1:0000D062","description":"Current Firmware Version","format":"string","access":["read"],"source":4},{"iid":5,"type":"urn:miot-spec-v2:property:serial-no:000000FF:jipin-f003:1:0000D062","description":"Serial Number","format":"string","access":["read"],"source":4}]},{"iid":2,"type":"urn:miot-spec-v2:service:fan:00007808:jipin-f003:1:0000D062","description":"fan","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:on:00000006:jipin-f003:1:0000D062","description":"switch status","format":"bool","access":["read","write","notify"],"source":1},{"iid":3,"type":"urn:miot-spec-v2:property:mode:00000008:jipin-f003:1:0000D062","description":"mode","format":"uint8","access":["read","write","notify"],"value-list":[{"value":0,"description":"None"},{"value":1,"description":"Sleep"}],"source":1,"gatt-access":[]},{"iid":4,"type":"urn:miot-spec-v2:property:fan-level:00000016:jipin-f003:1:0000D062","description":"Gear Fan Level","format":"uint8","access":["read","write","notify"],"value-range":[1,8,1],"source":1,"gatt-access":[]},{"iid":2,"type":"urn:miot-spec-v2:property:fault:00000009:jipin-f003:1:0000D062","description":"Device Fault","format":"uint8","access":["read","notify"],"value-list":[{"value":0,"description":"No Faults"}],"source":1,"gatt-access":[]},{"iid":6,"type":"urn:miot-spec-v2:property:horizontal-swing:00000017:jipin-f003:1:0000D062","description":"Horizontal Swing","format":"bool","access":["read","write","notify"],"source":1},{"iid":8,"type":"urn:miot-spec-v2:property:vertical-swing:00000018:jipin-f003:1:0000D062","description":"Vertical Swing","format":"bool","access":["read","write","notify"],"source":1},{"iid":14,"type":"urn:miot-spec-v2:property:anion:00000025:jipin-f003:1","description":"Anion","format":"bool","access":["read","write","notify"]}],"actions":[{"iid":3,"type":"urn:miot-spec-v2:action:toggle:00002811:jipin-f003:1:0000D062","description":"toggle","in":[],"out":[]}]},{"iid":5,"type":"urn:miot-spec-v2:service:indicator-light:00007803:jipin-f003:1:0000D062","description":"Indicator-light","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:on:00000006:jipin-f003:1:0000D062","description":"Switch Status","format":"bool","access":["read","write","notify"],"source":1}]},{"iid":7,"type":"urn:miot-spec-v2:service:alarm:00007804:jipin-f003:1:0000D062","description":"Alarm","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:alarm:00007804:jipin-f003:1:0000D062","description":"Alarm","format":"bool","access":["read","write","notify"],"source":1}]},{"iid":11,"type":"urn:miot-spec-v2:service:countdown:0000782D:jipin-f003:1","description":"Countdown","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:countdown-time:00000055:jipin-f003:1","description":"Countdown Time","format":"uint16","access":["read","write","notify"],"unit":"minutes","value-range":[0,720,1],"gatt-access":[]}]},{"iid":12,"type":"urn:miot-spec-v2:service:night-light:00007883:jipin-f003:1","description":"Night Light","properties":[{"iid":1,"type":"urn:miot-spec-v2:property:on:00000006:jipin-f003:1","description":"Switch Status","format":"bool","access":["read","write","notify"]}]}]}