mijiaAPI 4.2.0__tar.gz → 4.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,108 +1,108 @@
1
- Metadata-Version: 2.4
2
- Name: mijiaAPI
3
- Version: 4.2.0
4
- Summary: A Python API for Xiaomi Mijia
5
- Author-email: Do1e <i@do1e.cn>
6
- License-Expression: GPL-3.0-or-later
7
- Project-URL: Homepage, https://mijia-api.do1e.com/
8
- Project-URL: Repository, https://github.com/Do1e/mijia-api
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: <4.0,>=3.10
12
- Description-Content-Type: text/markdown
13
- License-File: LICENSE
14
- Requires-Dist: fastmcp>=3.4.2
15
- Requires-Dist: pillow>=11.3.0
16
- Requires-Dist: pycryptodome>=3.23.0
17
- Requires-Dist: qrcode>=8.2
18
- Requires-Dist: requests>=2.32.5
19
- Requires-Dist: tzlocal>=5.3.1
20
- Dynamic: license-file
21
-
22
- # mijiaAPI
23
-
24
- 米家 API,可以使用代码、CLI、MCP 直接控制米家设备。
25
-
26
- > 🎉 **v4.0.0 版本已支持 MCP**,详见 [MCP 使用文档](https://mijia-api.do1e.com/usage/mcp)
27
- > 🎉 **v4.1.0 版本已支持 Agent Skill**,详见 [Agent Skill 使用文档](https://mijia-api.do1e.com/usage/skill)
28
-
29
- [![GitHub](https://img.shields.io/badge/GitHub-Do1e%2Fmijia--api-blue)](https://github.com/Do1e/mijia-api)
30
- [![PyPI](https://img.shields.io/badge/PyPI-mijiaAPI-blue)](https://pypi.org/project/mijiaAPI/)
31
- [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-green.svg)](https://opensource.org/licenses/GPL-3.0)
32
-
33
- 📖 **完整文档请见 [mijia-api.do1e.com](https://mijia-api.do1e.com)**
34
-
35
- [常见问题](https://mijia-api.do1e.com/faq) | [更新日志](https://mijia-api.do1e.com/changelog)
36
-
37
- ## 安装
38
-
39
- > 要求 Python >= 3.10
40
-
41
- ```bash
42
- pip install mijiaAPI
43
- # Or `uv add mijiaAPI` for uv users
44
- ```
45
-
46
- 其他安装方式(源码安装、AUR)请参考[文档](https://mijia-api.do1e.com/guide/installation)。
47
-
48
- ## 快速开始
49
-
50
- ```python
51
- from mijiaAPI import mijiaAPI, mijiaDevice
52
-
53
- # 初始化并扫码登录(认证文件默认保存在 ~/.config/mijia-api/auth.json)
54
- api = mijiaAPI()
55
- api.login()
56
-
57
- # 通过设备名称控制设备(推荐)
58
- device = mijiaDevice(api, dev_name="我的台灯")
59
- device.on = True # 打开设备
60
- device.brightness = 60 # 设置亮度为 60%
61
-
62
- # 查看设备支持的所有属性和动作
63
- print(device)
64
- ```
65
-
66
- CLI 用法:
67
-
68
- ```bash
69
- mijiaAPI login # 扫码登录
70
- mijiaAPI -l # 列出所有设备
71
- mijiaAPI set --dev_name "台灯" --prop_name "brightness" --value 60
72
- ```
73
-
74
- MCP 用法:
75
-
76
- 执行 `uvx mijiaAPI login -p /path/to/auth.json` 登录后,在 MCP 客户端配置中添加以下内容即可接入米家:
77
-
78
- ```json
79
- {
80
- "mcpServers": {
81
- "mijia-api": {
82
- "command": "uvx",
83
- "args": ["mijiaAPI", "mcp", "-p", "/path/to/auth.json"]
84
- }
85
- }
86
- }
87
- ```
88
-
89
- 更多用法(API 基础调用、MCP Server、CLI 完整参数、最佳实践等)请查阅[完整文档](https://mijia-api.do1e.com)。
90
-
91
- ## 致谢
92
-
93
- * [janzlan/mijia-api](https://gitee.com/janzlan/mijia-api/tree/master)
94
- * [米家 APP 网络请求的抓包、加解密与构造的代码笔记](https://imkero.net/posts/mihome-app-api/)
95
- * [al-one/hass-xiaomi-miot](https://github.com/al-one/hass-xiaomi-miot)
96
-
97
- ## 开源许可
98
-
99
- 本项目采用 [GPL-3.0](LICENSE) 开源许可证。
100
-
101
- **请注意:GPL-3.0 是具有“强传染性”的开源许可证。**
102
- 如果您在您的项目中使用、修改或分发本项目的代码(包括作为库依赖),您的整个项目也**必须**以 GPL-3.0 或兼容许可证开源发布。
103
-
104
- ## 免责声明
105
-
106
- * 本项目仅供学习交流使用,不得用于商业用途,如有侵权请联系删除
107
- * 用户使用本项目所产生的任何后果,需自行承担风险
108
- * 开发者不对使用本项目产生的任何直接或间接损失负责
1
+ Metadata-Version: 2.4
2
+ Name: mijiaAPI
3
+ Version: 4.2.1
4
+ Summary: A Python API for Xiaomi Mijia
5
+ Author-email: Do1e <i@do1e.cn>
6
+ License-Expression: GPL-3.0-or-later
7
+ Project-URL: Homepage, https://mijia-api.do1e.com/
8
+ Project-URL: Repository, https://github.com/Do1e/mijia-api
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: <4.0,>=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: fastmcp>=3.4.2
15
+ Requires-Dist: pillow>=11.3.0
16
+ Requires-Dist: pycryptodome>=3.23.0
17
+ Requires-Dist: qrcode>=8.2
18
+ Requires-Dist: requests>=2.32.5
19
+ Requires-Dist: tzlocal>=5.3.1
20
+ Dynamic: license-file
21
+
22
+ # mijiaAPI
23
+
24
+ 米家 API,可以使用代码、CLI、MCP 直接控制米家设备。
25
+
26
+ > 🎉 **v4.0.0 版本已支持 MCP**,详见 [MCP 使用文档](https://mijia-api.do1e.com/usage/mcp)
27
+ > 🎉 **v4.1.0 版本已支持 Agent Skill**,详见 [Agent Skill 使用文档](https://mijia-api.do1e.com/usage/skill)
28
+
29
+ [![GitHub](https://img.shields.io/badge/GitHub-Do1e%2Fmijia--api-blue)](https://github.com/Do1e/mijia-api)
30
+ [![PyPI](https://img.shields.io/badge/PyPI-mijiaAPI-blue)](https://pypi.org/project/mijiaAPI/)
31
+ [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-green.svg)](https://opensource.org/licenses/GPL-3.0)
32
+
33
+ 📖 **完整文档请见 [mijia-api.do1e.com](https://mijia-api.do1e.com)**
34
+
35
+ [常见问题](https://mijia-api.do1e.com/faq) | [更新日志](https://mijia-api.do1e.com/changelog)
36
+
37
+ ## 安装
38
+
39
+ > 要求 Python >= 3.10
40
+
41
+ ```bash
42
+ pip install mijiaAPI
43
+ # Or `uv add mijiaAPI` for uv users
44
+ ```
45
+
46
+ 其他安装方式(源码安装、AUR)请参考[文档](https://mijia-api.do1e.com/guide/installation)。
47
+
48
+ ## 快速开始
49
+
50
+ ```python
51
+ from mijiaAPI import mijiaAPI, mijiaDevice
52
+
53
+ # 初始化并扫码登录(认证文件默认保存在 ~/.config/mijia-api/auth.json)
54
+ api = mijiaAPI()
55
+ api.login()
56
+
57
+ # 通过设备名称控制设备(推荐)
58
+ device = mijiaDevice(api, dev_name="我的台灯")
59
+ device.on = True # 打开设备
60
+ device.brightness = 60 # 设置亮度为 60%
61
+
62
+ # 查看设备支持的所有属性和动作
63
+ print(device)
64
+ ```
65
+
66
+ CLI 用法:
67
+
68
+ ```bash
69
+ mijiaAPI login # 扫码登录
70
+ mijiaAPI -l # 列出所有设备
71
+ mijiaAPI set --dev_name "台灯" --prop_name "brightness" --value 60
72
+ ```
73
+
74
+ MCP 用法:
75
+
76
+ 执行 `uvx mijiaAPI login -p /path/to/auth.json` 登录后,在 MCP 客户端配置中添加以下内容即可接入米家:
77
+
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "mijia-api": {
82
+ "command": "uvx",
83
+ "args": ["mijiaAPI", "mcp", "-p", "/path/to/auth.json"]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ 更多用法(API 基础调用、MCP Server、CLI 完整参数、最佳实践等)请查阅[完整文档](https://mijia-api.do1e.com)。
90
+
91
+ ## 致谢
92
+
93
+ * [janzlan/mijia-api](https://gitee.com/janzlan/mijia-api/tree/master)
94
+ * [米家 APP 网络请求的抓包、加解密与构造的代码笔记](https://imkero.net/posts/mihome-app-api/)
95
+ * [al-one/hass-xiaomi-miot](https://github.com/al-one/hass-xiaomi-miot)
96
+
97
+ ## 开源许可
98
+
99
+ 本项目采用 [GPL-3.0](LICENSE) 开源许可证。
100
+
101
+ **请注意:GPL-3.0 是具有“强传染性”的开源许可证。**
102
+ 如果您在您的项目中使用、修改或分发本项目的代码(包括作为库依赖),您的整个项目也**必须**以 GPL-3.0 或兼容许可证开源发布。
103
+
104
+ ## 免责声明
105
+
106
+ * 本项目仅供学习交流使用,不得用于商业用途,如有侵权请联系删除
107
+ * 用户使用本项目所产生的任何后果,需自行承担风险
108
+ * 开发者不对使用本项目产生的任何直接或间接损失负责
@@ -314,7 +314,7 @@ def get_device_info(device_model: str, cache_path: Optional[Union[str, Path]] =
314
314
  product = content["props"]["product"]
315
315
  name = product["name"]
316
316
  model = product["model"]
317
- i18n_zh = content["props"]["i18n"]["zh_cn"]
317
+ i18n_zh = content["props"].get("i18n", {}).get("zh_cn", {})
318
318
  result = {
319
319
  "version": device_info_version,
320
320
  "name": name,
@@ -0,0 +1 @@
1
+ version = "4.2.1"
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1 +0,0 @@
1
- version = "4.2.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes