mijiaAPI 2.0.1__tar.gz → 2.0.2__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,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: mijiaAPI
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: A Python API for Xiaomi Mijia
5
5
  License: GPLv3
6
+ License-File: LICENSE
6
7
  Author: Do1e
7
8
  Author-email: dpj.email@qq.com
8
9
  Requires-Python: >=3.9,<4.0
@@ -15,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
15
16
  Classifier: Programming Language :: Python :: 3.11
16
17
  Classifier: Programming Language :: Python :: 3.12
17
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
18
20
  Requires-Dist: pillow (>=11.0.0,<12.0.0)
19
21
  Requires-Dist: qrcode (>=8.0,<9.0)
20
22
  Requires-Dist: requests (>=2.32.3,<3.0.0)
@@ -264,23 +266,6 @@ mijiaAPI --run 明天天气如何
264
266
  mijiaAPI --run 打开台灯并将亮度调至最大 --quiet
265
267
  ```
266
268
 
267
- ## 常见问题
268
-
269
- ### 账号密码登录失败
270
-
271
- 现在登录似乎100%遇到验证码,建议使用扫码登录。
272
-
273
- ### XXX设备的XXX如何获取/设置
274
-
275
- 我拥有的设备有限,无法保证能解答这类问题,但也欢迎提交 [issue](https://github.com/Do1e/mijia-api/issues),可能需要你将设备共享给我进行抓包或者自行抓包给我提供请求和响应,提供har文件的话注意自行删除cookie等敏感信息。
276
-
277
- ### 如何抓包
278
-
279
- 小米官方给了一个[抓包教程](https://iot.mi.com/new/doc/accesses/direct-access/extension-development/troubleshooting/packet_capture),我没试过,不确定是否能行,如果抓包成功数据是加密的,可以使用 [demos/decrypt.py](demos/decrypt.py) 解密。
280
-
281
- 我自己的解决方案是使用一个获取了root的手机,安装 [reqable](https://reqable.com/zh-CN/) 进行抓包,导出 HAR 文件后使用 [demos/decrypt_har.py](demos/decrypt_har.py) 解密。
282
-
283
-
284
269
  ## 致谢
285
270
 
286
271
  * [janzlan/mijia-api](https://gitee.com/janzlan/mijia-api/tree/master)
@@ -240,23 +240,6 @@ mijiaAPI --run 明天天气如何
240
240
  mijiaAPI --run 打开台灯并将亮度调至最大 --quiet
241
241
  ```
242
242
 
243
- ## 常见问题
244
-
245
- ### 账号密码登录失败
246
-
247
- 现在登录似乎100%遇到验证码,建议使用扫码登录。
248
-
249
- ### XXX设备的XXX如何获取/设置
250
-
251
- 我拥有的设备有限,无法保证能解答这类问题,但也欢迎提交 [issue](https://github.com/Do1e/mijia-api/issues),可能需要你将设备共享给我进行抓包或者自行抓包给我提供请求和响应,提供har文件的话注意自行删除cookie等敏感信息。
252
-
253
- ### 如何抓包
254
-
255
- 小米官方给了一个[抓包教程](https://iot.mi.com/new/doc/accesses/direct-access/extension-development/troubleshooting/packet_capture),我没试过,不确定是否能行,如果抓包成功数据是加密的,可以使用 [demos/decrypt.py](demos/decrypt.py) 解密。
256
-
257
- 我自己的解决方案是使用一个获取了root的手机,安装 [reqable](https://reqable.com/zh-CN/) 进行抓包,导出 HAR 文件后使用 [demos/decrypt_har.py](demos/decrypt_har.py) 解密。
258
-
259
-
260
243
  ## 致谢
261
244
 
262
245
  * [janzlan/mijia-api](https://gitee.com/janzlan/mijia-api/tree/master)
@@ -177,9 +177,6 @@ class mijiaDevice(object):
177
177
  prop = self.prop_list[name]
178
178
  if 'w' not in prop.rw:
179
179
  raise ValueError(f'属性 {name} 不可写入')
180
- if prop.value_list:
181
- if value not in [item['value'] for item in prop.value_list]:
182
- raise ValueError(f'无效值: {value}, 请使用 {prop.value_list}')
183
180
  if prop.type == 'bool':
184
181
  if isinstance(value, str):
185
182
  if value.lower() == 'true':
@@ -222,6 +219,9 @@ class mijiaDevice(object):
222
219
  raise ValueError(f'无效字符串值: {value}')
223
220
  else:
224
221
  raise ValueError(f'不支持的类型: {prop.type}, 可用类型: bool, int, uint, float, string')
222
+ if prop.value_list:
223
+ if value not in [item['value'] for item in prop.value_list]:
224
+ raise ValueError(f'无效值: {value}, 请使用 {prop.value_list}')
225
225
  method = prop.method.copy()
226
226
  method['did'] = did
227
227
  method['value'] = value
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mijiaAPI"
3
- version = "2.0.1"
3
+ version = "2.0.2"
4
4
  description = "A Python API for Xiaomi Mijia"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9,<4.0"
@@ -15,7 +15,7 @@ mijiaAPI = "mijiaAPI.__main__:cli"
15
15
 
16
16
  [tool.poetry]
17
17
  name = "mijiaAPI"
18
- version = "2.0.1"
18
+ version = "2.0.2"
19
19
  description = "A Python API for Xiaomi Mijia"
20
20
  authors = ["Do1e <dpj.email@qq.com>"]
21
21
  license = "GPLv3"
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