aioamazondevices 6.2.3__py3-none-any.whl → 6.2.5__py3-none-any.whl

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.

Potentially problematic release.


This version of aioamazondevices might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  """aioamazondevices library."""
2
2
 
3
- __version__ = "6.2.3"
3
+ __version__ = "6.2.5"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
aioamazondevices/api.py CHANGED
@@ -142,7 +142,6 @@ class AmazonEchoApi:
142
142
 
143
143
  self._session = client_session
144
144
  self._devices: dict[str, Any] = {}
145
- self._sensors_available: bool = True
146
145
 
147
146
  _LOGGER.debug("Initialize library v%s", __version__)
148
147
 
@@ -622,13 +621,15 @@ class AmazonEchoApi:
622
621
  else None
623
622
  )
624
623
  if serial_number in self._devices:
625
- devices_sensors[serial_number] = self._get_device_sensor_state(endpoint)
624
+ devices_sensors[serial_number] = self._get_device_sensor_state(
625
+ endpoint, serial_number
626
+ )
626
627
  devices_endpoints[serial_number] = endpoint
627
628
 
628
629
  return devices_endpoints, devices_sensors
629
630
 
630
631
  def _get_device_sensor_state(
631
- self, endpoint: dict[str, Any]
632
+ self, endpoint: dict[str, Any], serial_number: str
632
633
  ) -> dict[str, AmazonDeviceSensor]:
633
634
  device_sensors: dict[str, AmazonDeviceSensor] = {}
634
635
  if endpoint_dnd := endpoint.get("settings", {}).get("doNotDisturb"):
@@ -639,23 +640,49 @@ class AmazonEchoApi:
639
640
  scale=None,
640
641
  )
641
642
  for feature in endpoint.get("features", {}):
642
- feature_property = (feature.get("properties") or [{}])[0]
643
- if (sensor := SENSORS.get(feature["name"])) is None:
643
+ if (sensor_template := SENSORS.get(feature["name"])) is None:
644
644
  # Skip sensors that are not in the predefined list
645
645
  continue
646
646
 
647
- if not (name := sensor["name"]):
647
+ if not (name := sensor_template["name"]):
648
648
  raise CannotRetrieveData("Unable to read sensor template")
649
649
 
650
650
  for feature_property in feature.get("properties"):
651
- if sensor["name"] != feature_property.get("name"):
651
+ if sensor_template["name"] != feature_property.get("name"):
652
652
  continue
653
653
 
654
- value = feature_property[sensor["key"]]
655
- scale = value["scale"] if sensor["scale"] else None
656
- error = bool(sensor.get("error"))
657
- if subkey := sensor["subkey"]:
658
- value = value[subkey]
654
+ value: str | int | float = "n/a"
655
+ scale: str | None = None
656
+ error = bool(sensor_template.get("error"))
657
+ if not error:
658
+ try:
659
+ value_raw = feature_property[sensor_template["key"]]
660
+ if not value_raw:
661
+ _LOGGER.warning(
662
+ "Sensor %s [device %s] ignored due to empty value",
663
+ name,
664
+ serial_number,
665
+ )
666
+ continue
667
+ scale = (
668
+ value_raw[scale_template]
669
+ if (scale_template := sensor_template["scale"])
670
+ else None
671
+ )
672
+ value = (
673
+ value_raw[subkey_template]
674
+ if (subkey_template := sensor_template["subkey"])
675
+ else value_raw
676
+ )
677
+
678
+ except (KeyError, ValueError) as exc:
679
+ _LOGGER.warning(
680
+ "Sensor %s [device %s] ignored due to errors in feature %s: %s", # noqa: E501
681
+ name,
682
+ serial_number,
683
+ feature_property,
684
+ repr(exc),
685
+ )
659
686
  device_sensors[name] = AmazonDeviceSensor(
660
687
  name,
661
688
  value,
aioamazondevices/const.py CHANGED
@@ -112,6 +112,11 @@ DEVICE_TO_IGNORE: list[str] = [
112
112
  "A3KOTUS4DKHU1W", # Samsung Fridge - issue #429
113
113
  "AN630UQPG2CA4", # Insignia TV - issue #430
114
114
  "A3SSG6GR8UU7SN", # Amazon Echo Sub - issue #437
115
+ "A2Y04QPFCANLPQ", # Bose QuietComfort 35 II - issue #476
116
+ "AYHO3NTIQQ04G", # Nextbase 622GW Dash Cam - issue #477
117
+ "AHL4H6CKH3AUP", # BMW Car System - issue #478
118
+ "A3BW5ZVFHRCQPO", # BMW Mini Car System - issue #479
119
+ "A1M0A9L9HDBID3", # Sony Soundbar Sony HT-A5000 - issue #486
115
120
  ]
116
121
 
117
122
  DEVICE_TYPE_TO_MODEL: dict[str, dict[str, str | None]] = {
@@ -431,6 +436,11 @@ DEVICE_TYPE_TO_MODEL: dict[str, dict[str, str | None]] = {
431
436
  "model": "Echo Plus",
432
437
  "hw_version": "Gen2",
433
438
  },
439
+ "A1M0A9L9HDBID3": {
440
+ "manufacturer": "First Alert",
441
+ "model": "Onelink Smoke + Carbon Monoxide Alarm",
442
+ "hw_version": None,
443
+ },
434
444
  }
435
445
 
436
446
  ALEXA_INFO_SKILLS = [
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: aioamazondevices
3
- Version: 6.2.3
3
+ Version: 6.2.5
4
4
  Summary: Python library to control Amazon devices
5
- License: Apache-2.0
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
6
7
  Author: Simone Chemelli
7
8
  Author-email: simone.chemelli@gmail.com
8
9
  Requires-Python: >=3.12
@@ -0,0 +1,12 @@
1
+ aioamazondevices/__init__.py,sha256=BjC2P6bfkOZOf5BeNfaDDWt5y19EmbbqizU4ioUrR0Q,276
2
+ aioamazondevices/api.py,sha256=xuzQuiOpU6D-Hn_tyNXZga-Il3p2Hcs7tjW6zVWzAUY,43532
3
+ aioamazondevices/const.py,sha256=laRFapeQRpg3aGi10iCOH5OzBi1cnaPJX0s1phSl21w,11769
4
+ aioamazondevices/exceptions.py,sha256=gRYrxNAJnrV6uRuMx5e76VMvtNKyceXd09q84pDBBrI,638
5
+ aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ aioamazondevices/query.py,sha256=AGHHzefzfYzB7RLWPtlFxYc_rpUZdoeApsU2jYz3urQ,2053
7
+ aioamazondevices/sounds.py,sha256=CXMDk-KoKVFxBdVAw3MeOClqgpzcVDxvQhFOJp7qX-Y,1896
8
+ aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
9
+ aioamazondevices-6.2.5.dist-info/METADATA,sha256=CLL5EieLkEcN4Q4bP-dKW9Ooa4_2xxfKlZk2pyht8yo,7656
10
+ aioamazondevices-6.2.5.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
11
+ aioamazondevices-6.2.5.dist-info/licenses/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
12
+ aioamazondevices-6.2.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.3
2
+ Generator: poetry-core 2.2.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,12 +0,0 @@
1
- aioamazondevices/__init__.py,sha256=ceEDIjO_0-izP3c2qIBoA5HFyOQUZy2qAvBkrGhPZzU,276
2
- aioamazondevices/api.py,sha256=-cwcBemxqHrek0TF5N_AFKizdx9KdhETIA8G-XP625I,42347
3
- aioamazondevices/const.py,sha256=OMGxpG6kRMN6WJgq-nQ8skhRtSgkm_hXtz9my8hBwbE,11314
4
- aioamazondevices/exceptions.py,sha256=gRYrxNAJnrV6uRuMx5e76VMvtNKyceXd09q84pDBBrI,638
5
- aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- aioamazondevices/query.py,sha256=AGHHzefzfYzB7RLWPtlFxYc_rpUZdoeApsU2jYz3urQ,2053
7
- aioamazondevices/sounds.py,sha256=CXMDk-KoKVFxBdVAw3MeOClqgpzcVDxvQhFOJp7qX-Y,1896
8
- aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
9
- aioamazondevices-6.2.3.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
10
- aioamazondevices-6.2.3.dist-info/METADATA,sha256=lASZmiHEn_QhxelH0j3SvmN1x3J9unoUD4Rmbo_aucs,7623
11
- aioamazondevices-6.2.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
12
- aioamazondevices-6.2.3.dist-info/RECORD,,