aioamazondevices 6.2.1__py3-none-any.whl → 6.2.3__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 +24 -18
- aioamazondevices/const.py +1 -1
- {aioamazondevices-6.2.1.dist-info → aioamazondevices-6.2.3.dist-info}/METADATA +1 -1
- aioamazondevices-6.2.3.dist-info/RECORD +12 -0
- aioamazondevices-6.2.1.dist-info/RECORD +0 -12
- {aioamazondevices-6.2.1.dist-info → aioamazondevices-6.2.3.dist-info}/LICENSE +0 -0
- {aioamazondevices-6.2.1.dist-info → aioamazondevices-6.2.3.dist-info}/WHEEL +0 -0
aioamazondevices/__init__.py
CHANGED
aioamazondevices/api.py
CHANGED
|
@@ -75,6 +75,7 @@ class AmazonDeviceSensor:
|
|
|
75
75
|
|
|
76
76
|
name: str
|
|
77
77
|
value: str | int | float
|
|
78
|
+
error: bool
|
|
78
79
|
scale: str | None
|
|
79
80
|
|
|
80
81
|
|
|
@@ -630,32 +631,37 @@ class AmazonEchoApi:
|
|
|
630
631
|
self, endpoint: dict[str, Any]
|
|
631
632
|
) -> dict[str, AmazonDeviceSensor]:
|
|
632
633
|
device_sensors: dict[str, AmazonDeviceSensor] = {}
|
|
633
|
-
if (
|
|
634
|
-
endpoint_dnd := endpoint.get("settings", {}).get("doNotDisturb")
|
|
635
|
-
) and not endpoint_dnd["error"]:
|
|
634
|
+
if endpoint_dnd := endpoint.get("settings", {}).get("doNotDisturb"):
|
|
636
635
|
device_sensors["dnd"] = AmazonDeviceSensor(
|
|
637
|
-
"dnd",
|
|
636
|
+
name="dnd",
|
|
637
|
+
value=endpoint_dnd.get("toggleValue"),
|
|
638
|
+
error=bool(endpoint_dnd.get("error")),
|
|
639
|
+
scale=None,
|
|
638
640
|
)
|
|
639
641
|
for feature in endpoint.get("features", {}):
|
|
640
|
-
|
|
641
|
-
if (
|
|
642
|
-
|
|
643
|
-
or (sensor := SENSORS.get(feature["name"])) is None
|
|
644
|
-
):
|
|
642
|
+
feature_property = (feature.get("properties") or [{}])[0]
|
|
643
|
+
if (sensor := SENSORS.get(feature["name"])) is None:
|
|
644
|
+
# Skip sensors that are not in the predefined list
|
|
645
645
|
continue
|
|
646
646
|
|
|
647
647
|
if not (name := sensor["name"]):
|
|
648
648
|
raise CannotRetrieveData("Unable to read sensor template")
|
|
649
649
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
650
|
+
for feature_property in feature.get("properties"):
|
|
651
|
+
if sensor["name"] != feature_property.get("name"):
|
|
652
|
+
continue
|
|
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]
|
|
659
|
+
device_sensors[name] = AmazonDeviceSensor(
|
|
660
|
+
name,
|
|
661
|
+
value,
|
|
662
|
+
error,
|
|
663
|
+
scale,
|
|
664
|
+
)
|
|
659
665
|
|
|
660
666
|
return device_sensors
|
|
661
667
|
|
aioamazondevices/const.py
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
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,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
aioamazondevices/__init__.py,sha256=hyj8SeDdWcZIzCXEj67RXp4kviqHhwmsvg-yNVpzAas,276
|
|
2
|
-
aioamazondevices/api.py,sha256=7LY15R-f1NURGPYoSJw7gJ6PIZH9Eg8iNdZIk8hjcc4,42039
|
|
3
|
-
aioamazondevices/const.py,sha256=38dhNRpwEJf0FgFQGjt3ONhLdQxjiNrnlcrmQ1AY8oU,11306
|
|
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.1.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
|
10
|
-
aioamazondevices-6.2.1.dist-info/METADATA,sha256=Kxx8XQfmFkRMsY3ZnCIofSvQus6p4xHZ6BMEZdmU5nc,7623
|
|
11
|
-
aioamazondevices-6.2.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
12
|
-
aioamazondevices-6.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|