pyimouapi 1.2.0__tar.gz → 1.2.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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyimouapi
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: A package for imou open api
5
5
  Home-page: https://github.com/Imou-OpenPlatform/Py-Imou-Open-Api
6
6
  Author: Imou-OpenPlatform
@@ -394,7 +394,7 @@ SELECT_TYPE_REF = {
394
394
  {
395
395
  "ref": "15400",
396
396
  "default": "0",
397
- "options": ["-1", "0", "1", "2"],
397
+ "options": ["99", "0", "1", "2"],
398
398
  "value_type": "int",
399
399
  }
400
400
  ],
@@ -493,7 +493,7 @@ TEXT_TYPE_REF = {
493
493
  "default": "100",
494
494
  "ref_type": "properties",
495
495
  "value_type": "int",
496
- }
496
+ },
497
497
  ],
498
498
  }
499
499
 
@@ -503,3 +503,12 @@ BUTTON_TYPE_PARAM_VALUE = {
503
503
  "ptz_left": 2,
504
504
  "ptz_right": 3,
505
505
  }
506
+
507
+ NIGHT_VISION_MODE_MAP = {
508
+ "intelligent": "Intelligent",
509
+ "fullcolor": "FullColor",
510
+ "infrared": "Infrared",
511
+ "off": "Off",
512
+ "lowlight": "LowLight",
513
+ "smartlowlight": "SmartLowLight"
514
+ }
@@ -52,7 +52,10 @@ from .const import (
52
52
  API_ENDPOINT_GET_IOT_DEVICE_DETAIL_INFO,
53
53
  PARAM_ABILITY_REFS,
54
54
  PARAM_CHANNELS,
55
- PARAM_ACCESS_TYPE, API_ENDPOINT_WAKE_UP_DEVICE, PARAM_URL,
55
+ PARAM_ACCESS_TYPE,
56
+ API_ENDPOINT_WAKE_UP_DEVICE,
57
+ PARAM_URL,
58
+ NIGHT_VISION_MODE_MAP,
56
59
  )
57
60
  from .openapi import ImouOpenApiClient
58
61
 
@@ -357,6 +360,8 @@ class ImouDeviceManager:
357
360
  self, device_id: str, channel_id: str, night_vision_mode: str
358
361
  ) -> None:
359
362
  """set device night vision mode"""
363
+ if night_vision_mode in NIGHT_VISION_MODE_MAP:
364
+ night_vision_mode = NIGHT_VISION_MODE_MAP[night_vision_mode]
360
365
  params = {
361
366
  PARAM_DEVICE_ID: device_id,
362
367
  PARAM_CHANNEL_ID: channel_id,
@@ -526,6 +526,9 @@ class ImouHaDeviceManager(object):
526
526
  if device.selects[select_type].get(PARAM_REF):
527
527
  ref_id = device.selects[select_type].get(PARAM_REF)
528
528
  value_type = device.selects[select_type].get(PARAM_VALUE_TYPE)
529
+ # 兼容下音量15400值为-1的情况
530
+ if ref_id == "15400" and option == "99":
531
+ option = "-1"
529
532
  await self._async_select_option_by_ref(device, option, ref_id, value_type)
530
533
  elif PARAM_NIGHT_VISION_MODE == select_type:
531
534
  await self.delegate.async_set_device_night_vision_mode(
@@ -575,9 +578,9 @@ class ImouHaDeviceManager(object):
575
578
  if data[PARAM_MODE] is not None:
576
579
  device.selects[PARAM_NIGHT_VISION_MODE][PARAM_CURRENT_OPTION] = data[
577
580
  PARAM_MODE
578
- ]
581
+ ].lower()
579
582
  if data[PARAM_MODES] is not None:
580
- device.selects[PARAM_NIGHT_VISION_MODE][PARAM_OPTIONS] = data[PARAM_MODES]
583
+ device.selects[PARAM_NIGHT_VISION_MODE][PARAM_OPTIONS] = [item.lower() for item in data[PARAM_MODES]]
581
584
 
582
585
  @staticmethod
583
586
  def configure_device_by_ability(
@@ -964,7 +967,7 @@ class ImouHaDeviceManager(object):
964
967
  )
965
968
  if ref in data[PARAM_PROPERTIES]:
966
969
  device.switches[switch_type][PARAM_STATE] = (
967
- data[PARAM_PROPERTIES][ref] == 1
970
+ data[PARAM_PROPERTIES][ref] == 1
968
971
  )
969
972
  except Exception as e:
970
973
  _LOGGER.error(f"_async_update_device_switch_status_by_ref fail:{e}")
@@ -986,11 +989,16 @@ class ImouHaDeviceManager(object):
986
989
  device_id, device.channel_id, device.product_id, [ref]
987
990
  )
988
991
  if ref in data[PARAM_PROPERTIES]:
989
- device.selects[select_type][PARAM_CURRENT_OPTION] = (
992
+ value=(
990
993
  str(data[PARAM_PROPERTIES][ref])
991
994
  if isinstance(data[PARAM_PROPERTIES][ref], int)
992
995
  else data[PARAM_PROPERTIES][ref]
993
996
  )
997
+ device.selects[select_type][PARAM_CURRENT_OPTION] = value
998
+ # 兼容音量值为-1的情况
999
+ if ref == "15400" and value == "-1":
1000
+ device.selects[select_type][PARAM_CURRENT_OPTION] = "99"
1001
+
994
1002
  except Exception as e:
995
1003
  _LOGGER.error(f"Error while updating device select status: {e}")
996
1004
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyimouapi
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: A package for imou open api
5
5
  Home-page: https://github.com/Imou-OpenPlatform/Py-Imou-Open-Api
6
6
  Author: Imou-OpenPlatform
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyimouapi",
5
- version="1.2.0",
5
+ version="1.2.2",
6
6
  packages=find_packages(),
7
7
  description="A package for imou open api",
8
8
  long_description=open("README.md", encoding="utf-8").read(),
File without changes
File without changes
File without changes