aioamazondevices 3.2.6__tar.gz → 3.2.7__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.
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/PKG-INFO +1 -1
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/pyproject.toml +1 -1
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/src/aioamazondevices/__init__.py +1 -1
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/src/aioamazondevices/api.py +17 -16
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/LICENSE +0 -0
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/README.md +0 -0
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/src/aioamazondevices/const.py +0 -0
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/src/aioamazondevices/exceptions.py +0 -0
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/src/aioamazondevices/py.typed +0 -0
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/src/aioamazondevices/sounds.py +0 -0
- {aioamazondevices-3.2.6 → aioamazondevices-3.2.7}/src/aioamazondevices/utils.py +0 -0
@@ -84,6 +84,7 @@ class AmazonDevice:
|
|
84
84
|
device_type: str
|
85
85
|
device_owner_customer_id: str
|
86
86
|
device_cluster_members: list[str]
|
87
|
+
device_locale: str
|
87
88
|
online: bool
|
88
89
|
serial_number: str
|
89
90
|
software_version: str
|
@@ -413,10 +414,10 @@ class AmazonEchoApi:
|
|
413
414
|
HTTPStatus.PROXY_AUTHENTICATION_REQUIRED,
|
414
415
|
HTTPStatus.UNAUTHORIZED,
|
415
416
|
]:
|
416
|
-
raise CannotAuthenticate(self._http_phrase_error(resp.status))
|
417
|
+
raise CannotAuthenticate(await self._http_phrase_error(resp.status))
|
417
418
|
if not await self._ignore_ap_signin_error(resp):
|
418
419
|
raise CannotRetrieveData(
|
419
|
-
f"Request failed: {self._http_phrase_error(resp.status)}"
|
420
|
+
f"Request failed: {await self._http_phrase_error(resp.status)}"
|
420
421
|
)
|
421
422
|
|
422
423
|
await self._save_to_file(
|
@@ -527,7 +528,9 @@ class AmazonEchoApi:
|
|
527
528
|
obfuscate_email(self._login_email),
|
528
529
|
msg,
|
529
530
|
)
|
530
|
-
raise CannotRegisterDevice(
|
531
|
+
raise CannotRegisterDevice(
|
532
|
+
f"{await self._http_phrase_error(resp.status)}: {msg}"
|
533
|
+
)
|
531
534
|
|
532
535
|
success_response = resp_json["response"]["success"]
|
533
536
|
|
@@ -572,20 +575,19 @@ class AmazonEchoApi:
|
|
572
575
|
|
573
576
|
resp_me_json = await resp_me.json()
|
574
577
|
market = resp_me_json["marketPlaceDomainName"]
|
575
|
-
language = resp_me_json["marketPlaceLocale"]
|
576
578
|
|
577
579
|
_domain = f"https://www.amazon.{self._domain}"
|
578
580
|
|
579
|
-
if market != _domain
|
580
|
-
_LOGGER.
|
581
|
-
"Selected country <%s> doesn't matches Amazon
|
581
|
+
if market != _domain:
|
582
|
+
_LOGGER.warning(
|
583
|
+
"Selected country <%s> doesn't matches Amazon API reply:\n%s\n vs \n%s",
|
582
584
|
self._login_country_code.upper(),
|
583
|
-
{"site ": _domain
|
584
|
-
{"market": market
|
585
|
+
{"site ": _domain},
|
586
|
+
{"market": market},
|
585
587
|
)
|
586
588
|
raise WrongCountry
|
587
589
|
|
588
|
-
_LOGGER.debug("User selected country matches Amazon
|
590
|
+
_LOGGER.debug("User selected country matches Amazon API one")
|
589
591
|
|
590
592
|
async def _get_devices_ids(self) -> list[dict[str, str]]:
|
591
593
|
"""Retrieve devices entityId and applianceId."""
|
@@ -830,7 +832,7 @@ class AmazonEchoApi:
|
|
830
832
|
if not devices_node or (devices_node.get("deviceType") in DEVICE_TO_IGNORE):
|
831
833
|
continue
|
832
834
|
|
833
|
-
preferences_node = device.get(NODE_PREFERENCES)
|
835
|
+
preferences_node = device.get(NODE_PREFERENCES, {})
|
834
836
|
do_not_disturb_node = device[NODE_DO_NOT_DISTURB]
|
835
837
|
bluetooth_node = device[NODE_BLUETOOTH]
|
836
838
|
identifier_node = device.get(NODE_IDENTIFIER, {})
|
@@ -852,13 +854,12 @@ class AmazonEchoApi:
|
|
852
854
|
device_cluster_members=(
|
853
855
|
devices_node["clusterMembers"] or [serial_number]
|
854
856
|
),
|
857
|
+
device_locale=preferences_node.get("locale", self._language),
|
855
858
|
online=devices_node["online"],
|
856
859
|
serial_number=serial_number,
|
857
860
|
software_version=devices_node["softwareVersion"],
|
858
861
|
do_not_disturb=do_not_disturb_node["enabled"],
|
859
|
-
response_style=(
|
860
|
-
preferences_node["responseStyle"] if preferences_node else None
|
861
|
-
),
|
862
|
+
response_style=preferences_node.get("responseStyle"),
|
862
863
|
bluetooth_state=bluetooth_node["online"],
|
863
864
|
entity_id=identifier_node.get("entityId"),
|
864
865
|
appliance_id=identifier_node.get("applianceId"),
|
@@ -925,7 +926,7 @@ class AmazonEchoApi:
|
|
925
926
|
base_payload = {
|
926
927
|
"deviceType": device.device_type,
|
927
928
|
"deviceSerialNumber": device.serial_number,
|
928
|
-
"locale":
|
929
|
+
"locale": device.device_locale,
|
929
930
|
"customerId": device.device_owner_customer_id,
|
930
931
|
}
|
931
932
|
|
@@ -960,7 +961,7 @@ class AmazonEchoApi:
|
|
960
961
|
"expireAfter": "PT5S",
|
961
962
|
"content": [
|
962
963
|
{
|
963
|
-
"locale":
|
964
|
+
"locale": device.device_locale,
|
964
965
|
"display": {
|
965
966
|
"title": "Home Assistant",
|
966
967
|
"body": message_body,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|