aioamazondevices 3.2.5__py3-none-any.whl → 3.2.7__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.
@@ -1,6 +1,6 @@
1
1
  """aioamazondevices library."""
2
2
 
3
- __version__ = "3.2.5"
3
+ __version__ = "3.2.7"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
aioamazondevices/api.py CHANGED
@@ -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(f"{self._http_phrase_error(resp.status)}: {msg}")
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 or language != self._language:
580
- _LOGGER.debug(
581
- "Selected country <%s> doesn't matches Amazon account:\n%s\n vs \n%s",
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, "locale": self._language},
584
- {"market": market, "locale": language},
585
+ {"site ": _domain},
586
+ {"market": market},
585
587
  )
586
588
  raise WrongCountry
587
589
 
588
- _LOGGER.debug("User selected country matches Amazon account one")
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": self._language,
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": self._language,
964
+ "locale": device.device_locale,
964
965
  "display": {
965
966
  "title": "Home Assistant",
966
967
  "body": message_body,
aioamazondevices/const.py CHANGED
@@ -166,6 +166,10 @@ DEVICE_TYPE_TO_MODEL: dict[str, dict[str, str | None]] = {
166
166
  "model": "Echo Show 8",
167
167
  "hw_version": "Gen2",
168
168
  },
169
+ "A18O6U1UQFJ0XK": {
170
+ "model": "Echo Plus",
171
+ "hw_version": "Gen2",
172
+ },
169
173
  "A1EIANJ7PNB0Q7": {
170
174
  "model": "Echo Show 15",
171
175
  "hw_version": "Gen1",
@@ -333,6 +337,10 @@ DEVICE_TYPE_TO_MODEL: dict[str, dict[str, str | None]] = {
333
337
  "model": "Echo",
334
338
  "hw_version": "Gen2",
335
339
  },
340
+ "ADOUDFQX2QVX0": {
341
+ "model": "Fire TV Omni QLED",
342
+ "hw_version": None,
343
+ },
336
344
  "ADVBD696BHNV5": {
337
345
  "model": "Fire TV Stick",
338
346
  "hw_version": "Gen1",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aioamazondevices
3
- Version: 3.2.5
3
+ Version: 3.2.7
4
4
  Summary: Python library to control Amazon devices
5
5
  License: Apache-2.0
6
6
  Author: Simone Chemelli
@@ -0,0 +1,11 @@
1
+ aioamazondevices/__init__.py,sha256=F1DjsZL960DefRTYfvnfdRxZ9okHwsf7NzGZ_HSeCy4,276
2
+ aioamazondevices/api.py,sha256=n0Agu4WyKwlD0qGhpy0ShnXCxMwhua3fZrMXhIUXu9I,39661
3
+ aioamazondevices/const.py,sha256=mgPTTRLLets0vU8MTvVA3pGWGHCgVLMBRZWsIVtCG8s,9043
4
+ aioamazondevices/exceptions.py,sha256=CfOFKDvE_yl5BFoFcpTOuDfgRi_2oAtKk-nNJgfWBAs,726
5
+ aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ aioamazondevices/sounds.py,sha256=01pVCDFIuhrLypXInw4JNuHsC6zjMLsuKocet1R6we8,13409
7
+ aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
8
+ aioamazondevices-3.2.7.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
9
+ aioamazondevices-3.2.7.dist-info/METADATA,sha256=Zlf_Qq8VoFb-4u-FZJ9kiuqVRGnN6L1JP4wjR31SDcQ,5234
10
+ aioamazondevices-3.2.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
+ aioamazondevices-3.2.7.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- aioamazondevices/__init__.py,sha256=xvTE-ZcQrkqARImcWdRIL8nRluZ5RMms8VzK8Lg8AEw,276
2
- aioamazondevices/api.py,sha256=VCOcIufsCHYKRBAC-q5Yfwj5Cek8Wt-ZT7o2Lg0kzyU,39691
3
- aioamazondevices/const.py,sha256=ntDid8sxWg7nvEwGmaA-Po2l47zj3vuxRM2tofVT71o,8856
4
- aioamazondevices/exceptions.py,sha256=CfOFKDvE_yl5BFoFcpTOuDfgRi_2oAtKk-nNJgfWBAs,726
5
- aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- aioamazondevices/sounds.py,sha256=01pVCDFIuhrLypXInw4JNuHsC6zjMLsuKocet1R6we8,13409
7
- aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
8
- aioamazondevices-3.2.5.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
9
- aioamazondevices-3.2.5.dist-info/METADATA,sha256=hJ7Ei2gyg87IjV0b7u80aI2pZjkUSjDt83To-A4TZdU,5234
10
- aioamazondevices-3.2.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
- aioamazondevices-3.2.5.dist-info/RECORD,,