aioamazondevices 6.5.2__py3-none-any.whl → 6.5.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 +21 -13
- {aioamazondevices-6.5.2.dist-info → aioamazondevices-6.5.3.dist-info}/METADATA +1 -1
- {aioamazondevices-6.5.2.dist-info → aioamazondevices-6.5.3.dist-info}/RECORD +6 -6
- {aioamazondevices-6.5.2.dist-info → aioamazondevices-6.5.3.dist-info}/WHEEL +0 -0
- {aioamazondevices-6.5.2.dist-info → aioamazondevices-6.5.3.dist-info}/licenses/LICENSE +0 -0
aioamazondevices/__init__.py
CHANGED
aioamazondevices/api.py
CHANGED
|
@@ -630,8 +630,7 @@ class AmazonEchoApi:
|
|
|
630
630
|
json_data=True,
|
|
631
631
|
)
|
|
632
632
|
|
|
633
|
-
sensors_state = await self._response_to_json(raw_resp)
|
|
634
|
-
_LOGGER.debug("Sensor data - %s", sensors_state)
|
|
633
|
+
sensors_state = await self._response_to_json(raw_resp, "sensors")
|
|
635
634
|
|
|
636
635
|
if await self._format_human_error(sensors_state):
|
|
637
636
|
# Explicit error in returned data
|
|
@@ -740,7 +739,7 @@ class AmazonEchoApi:
|
|
|
740
739
|
json_data=True,
|
|
741
740
|
)
|
|
742
741
|
|
|
743
|
-
endpoint_data = await self._response_to_json(raw_resp)
|
|
742
|
+
endpoint_data = await self._response_to_json(raw_resp, "endpoint")
|
|
744
743
|
|
|
745
744
|
if not (data := endpoint_data.get("data")) or not data.get("listEndpoints"):
|
|
746
745
|
await self._format_human_error(endpoint_data)
|
|
@@ -760,7 +759,9 @@ class AmazonEchoApi:
|
|
|
760
759
|
|
|
761
760
|
return devices_endpoints
|
|
762
761
|
|
|
763
|
-
async def _response_to_json(
|
|
762
|
+
async def _response_to_json(
|
|
763
|
+
self, raw_resp: ClientResponse, description: str | None = None
|
|
764
|
+
) -> dict[str, Any]:
|
|
764
765
|
"""Convert response to JSON, if possible."""
|
|
765
766
|
try:
|
|
766
767
|
data = await raw_resp.json(loads=orjson.loads)
|
|
@@ -771,6 +772,8 @@ class AmazonEchoApi:
|
|
|
771
772
|
# if anonymous array is returned wrap it inside
|
|
772
773
|
# generated key to convert list to dict
|
|
773
774
|
data = {ARRAY_WRAPPER: data}
|
|
775
|
+
if description:
|
|
776
|
+
_LOGGER.debug("JSON '%s' data: %s", description, scrub_fields(data))
|
|
774
777
|
return cast("dict[str, Any]", data)
|
|
775
778
|
except ContentTypeError as exc:
|
|
776
779
|
raise ValueError("Response not in JSON format") from exc
|
|
@@ -784,7 +787,9 @@ class AmazonEchoApi:
|
|
|
784
787
|
HTTPMethod.GET,
|
|
785
788
|
url=f"https://alexa.amazon.{self._domain}{URI_NOTIFICATIONS}",
|
|
786
789
|
)
|
|
787
|
-
|
|
790
|
+
|
|
791
|
+
notifications = await self._response_to_json(raw_resp, "notifications")
|
|
792
|
+
|
|
788
793
|
for schedule in notifications["notifications"]:
|
|
789
794
|
schedule_type: str = schedule["type"]
|
|
790
795
|
schedule_device_serial = schedule["deviceSerialNumber"]
|
|
@@ -869,7 +874,11 @@ class AmazonEchoApi:
|
|
|
869
874
|
continue
|
|
870
875
|
|
|
871
876
|
if recurring_rule not in RECURRING_PATTERNS:
|
|
872
|
-
_LOGGER.warning(
|
|
877
|
+
_LOGGER.warning(
|
|
878
|
+
"Unknown recurring rule <%s> for schedule type <%s>",
|
|
879
|
+
recurring_rule,
|
|
880
|
+
schedule["type"],
|
|
881
|
+
)
|
|
873
882
|
return None
|
|
874
883
|
|
|
875
884
|
# Adjust recurring rules for country specific weekend exceptions
|
|
@@ -1147,6 +1156,9 @@ class AmazonEchoApi:
|
|
|
1147
1156
|
) and device.device_family != SPEAKER_GROUP_FAMILY:
|
|
1148
1157
|
device.sensors["dnd"] = device_dnd
|
|
1149
1158
|
|
|
1159
|
+
# Clear old notifications to handle cancelled ones
|
|
1160
|
+
device.notifications = {}
|
|
1161
|
+
|
|
1150
1162
|
# Update notifications
|
|
1151
1163
|
device_notifications = notifications.get(device.serial_number, {})
|
|
1152
1164
|
|
|
@@ -1188,9 +1200,7 @@ class AmazonEchoApi:
|
|
|
1188
1200
|
url=f"https://alexa.amazon.{self._domain}{URI_DEVICES}",
|
|
1189
1201
|
)
|
|
1190
1202
|
|
|
1191
|
-
json_data = await self._response_to_json(raw_resp)
|
|
1192
|
-
|
|
1193
|
-
_LOGGER.debug("JSON devices data: %s", scrub_fields(json_data))
|
|
1203
|
+
json_data = await self._response_to_json(raw_resp, "devices")
|
|
1194
1204
|
|
|
1195
1205
|
for data in json_data["devices"]:
|
|
1196
1206
|
dev_serial = data.get("serialNumber")
|
|
@@ -1538,8 +1548,7 @@ class AmazonEchoApi:
|
|
|
1538
1548
|
_LOGGER.debug("Failed to refresh data")
|
|
1539
1549
|
return False, {}
|
|
1540
1550
|
|
|
1541
|
-
json_response = await self._response_to_json(raw_resp)
|
|
1542
|
-
_LOGGER.debug("Refresh data json:\n%s ", json_response)
|
|
1551
|
+
json_response = await self._response_to_json(raw_resp, data_type)
|
|
1543
1552
|
|
|
1544
1553
|
if data_type == REFRESH_ACCESS_TOKEN and (
|
|
1545
1554
|
new_token := json_response.get(REFRESH_ACCESS_TOKEN)
|
|
@@ -1563,8 +1572,7 @@ class AmazonEchoApi:
|
|
|
1563
1572
|
url=f"https://alexa.amazon.{self._domain}{URI_DND}",
|
|
1564
1573
|
)
|
|
1565
1574
|
|
|
1566
|
-
dnd_data = await self._response_to_json(raw_resp)
|
|
1567
|
-
_LOGGER.debug("DND data: %s", dnd_data)
|
|
1575
|
+
dnd_data = await self._response_to_json(raw_resp, "dnd")
|
|
1568
1576
|
|
|
1569
1577
|
for dnd in dnd_data.get("doNotDisturbDeviceStatusList", {}):
|
|
1570
1578
|
dnd_status[dnd.get("deviceSerialNumber")] = AmazonDeviceSensor(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
aioamazondevices/__init__.py,sha256=
|
|
2
|
-
aioamazondevices/api.py,sha256=
|
|
1
|
+
aioamazondevices/__init__.py,sha256=cMUz1u0sAxf-PC4DbUYkcVDs1oMHY1cxiiBn9bYGZck,276
|
|
2
|
+
aioamazondevices/api.py,sha256=O-ICuOIUcD-Gw12DDW-kF2PTqAIK882otyQGZtJ4CmE,59197
|
|
3
3
|
aioamazondevices/const.py,sha256=EUoGr9gqqwoSz01gk56Nhw_-1Tdmv0Yjyh9cJb3ofbs,13556
|
|
4
4
|
aioamazondevices/exceptions.py,sha256=gRYrxNAJnrV6uRuMx5e76VMvtNKyceXd09q84pDBBrI,638
|
|
5
5
|
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
aioamazondevices/query.py,sha256=xVgXF1PIiH7uu33Q_iVfCtdH9hqLOAGdCNnAxTZ76UE,1883
|
|
7
7
|
aioamazondevices/sounds.py,sha256=CXMDk-KoKVFxBdVAw3MeOClqgpzcVDxvQhFOJp7qX-Y,1896
|
|
8
8
|
aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
|
|
9
|
-
aioamazondevices-6.5.
|
|
10
|
-
aioamazondevices-6.5.
|
|
11
|
-
aioamazondevices-6.5.
|
|
12
|
-
aioamazondevices-6.5.
|
|
9
|
+
aioamazondevices-6.5.3.dist-info/METADATA,sha256=7xIx9PG22o3LDQhnQEc9Gmg1yejw_3ixHACpr60aesM,7679
|
|
10
|
+
aioamazondevices-6.5.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
11
|
+
aioamazondevices-6.5.3.dist-info/licenses/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
|
12
|
+
aioamazondevices-6.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|