aioamazondevices 6.2.4__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.
- aioamazondevices/__init__.py +1 -1
- aioamazondevices/api.py +39 -11
- {aioamazondevices-6.2.4.dist-info → aioamazondevices-6.2.5.dist-info}/METADATA +1 -1
- {aioamazondevices-6.2.4.dist-info → aioamazondevices-6.2.5.dist-info}/RECORD +6 -6
- {aioamazondevices-6.2.4.dist-info → aioamazondevices-6.2.5.dist-info}/WHEEL +0 -0
- {aioamazondevices-6.2.4.dist-info → aioamazondevices-6.2.5.dist-info}/licenses/LICENSE +0 -0
aioamazondevices/__init__.py
CHANGED
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(
|
|
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,22 +640,49 @@ class AmazonEchoApi:
|
|
|
639
640
|
scale=None,
|
|
640
641
|
)
|
|
641
642
|
for feature in endpoint.get("features", {}):
|
|
642
|
-
if (
|
|
643
|
+
if (sensor_template := SENSORS.get(feature["name"])) is None:
|
|
643
644
|
# Skip sensors that are not in the predefined list
|
|
644
645
|
continue
|
|
645
646
|
|
|
646
|
-
if not (name :=
|
|
647
|
+
if not (name := sensor_template["name"]):
|
|
647
648
|
raise CannotRetrieveData("Unable to read sensor template")
|
|
648
649
|
|
|
649
650
|
for feature_property in feature.get("properties"):
|
|
650
|
-
if
|
|
651
|
+
if sensor_template["name"] != feature_property.get("name"):
|
|
651
652
|
continue
|
|
652
653
|
|
|
653
|
-
value =
|
|
654
|
-
scale
|
|
655
|
-
error = bool(
|
|
656
|
-
if
|
|
657
|
-
|
|
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
|
+
)
|
|
658
686
|
device_sensors[name] = AmazonDeviceSensor(
|
|
659
687
|
name,
|
|
660
688
|
value,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
aioamazondevices/__init__.py,sha256=
|
|
2
|
-
aioamazondevices/api.py,sha256=
|
|
1
|
+
aioamazondevices/__init__.py,sha256=BjC2P6bfkOZOf5BeNfaDDWt5y19EmbbqizU4ioUrR0Q,276
|
|
2
|
+
aioamazondevices/api.py,sha256=xuzQuiOpU6D-Hn_tyNXZga-Il3p2Hcs7tjW6zVWzAUY,43532
|
|
3
3
|
aioamazondevices/const.py,sha256=laRFapeQRpg3aGi10iCOH5OzBi1cnaPJX0s1phSl21w,11769
|
|
4
4
|
aioamazondevices/exceptions.py,sha256=gRYrxNAJnrV6uRuMx5e76VMvtNKyceXd09q84pDBBrI,638
|
|
5
5
|
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
aioamazondevices/query.py,sha256=AGHHzefzfYzB7RLWPtlFxYc_rpUZdoeApsU2jYz3urQ,2053
|
|
7
7
|
aioamazondevices/sounds.py,sha256=CXMDk-KoKVFxBdVAw3MeOClqgpzcVDxvQhFOJp7qX-Y,1896
|
|
8
8
|
aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
|
|
9
|
-
aioamazondevices-6.2.
|
|
10
|
-
aioamazondevices-6.2.
|
|
11
|
-
aioamazondevices-6.2.
|
|
12
|
-
aioamazondevices-6.2.
|
|
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,,
|
|
File without changes
|
|
File without changes
|