mijiaAPI 1.4.2__tar.gz → 1.4.3__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,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mijiaAPI
3
- Version: 1.4.2
3
+ Version: 1.4.3
4
4
  Summary: A Python API for Xiaomi Mijia
5
5
  License: GPLv3
6
6
  Author: Do1e
@@ -170,7 +170,7 @@ class mijiaDevices(object):
170
170
  raise ValueError(f'Unsupported property: {name}, available properties: {list(self.prop_list.keys())}')
171
171
  prop = self.prop_list[name]
172
172
  if 'w' not in prop.rw:
173
- raise ValueError(f'Property {name} is read-only')
173
+ raise ValueError(f'Property {name} can not be written')
174
174
  if prop.value_list:
175
175
  if value not in [item['value'] for item in prop.value_list]:
176
176
  raise ValueError(f'Invalid value: {value}, should be in {prop.value_list}')
@@ -274,7 +274,7 @@ class mijiaDevices(object):
274
274
  raise ValueError(f'Unsupported property: {name}, available properties: {list(self.prop_list.keys())}')
275
275
  prop = self.prop_list[name]
276
276
  if 'r' not in prop.rw:
277
- raise ValueError(f'Property {name} is write-only')
277
+ raise ValueError(f'Property {name} can not be read')
278
278
  method = prop.method.copy()
279
279
  method['did'] = did
280
280
  result = self.api.get_devices_prop([method])[0]
@@ -399,9 +399,15 @@ def get_device_info(device_model: str, cache_path: Optional[str] = os.path.join(
399
399
  content = content.group(1)
400
400
  content = json.loads(content.replace('"', '"'))
401
401
 
402
+ if content['props']['product']:
403
+ name = content['props']['product']['name']
404
+ model = content['props']['product']['model']
405
+ else:
406
+ name = content['props']['spec']['name']
407
+ model = device_model
402
408
  result = {
403
- 'name': content['props']['product']['name'],
404
- 'model': content['props']['product']['model'],
409
+ 'name': name,
410
+ 'model': model,
405
411
  'properties': [],
406
412
  'actions': []
407
413
  }
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mijiaAPI"
3
- version = "1.4.2"
3
+ version = "1.4.3"
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 = "1.4.2"
18
+ version = "1.4.3"
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
File without changes