aioamazondevices 3.2.7__py3-none-any.whl → 3.2.9__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.7"
3
+ __version__ = "3.2.9"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
aioamazondevices/api.py CHANGED
@@ -339,6 +339,14 @@ class AmazonEchoApi:
339
339
  )
340
340
  return False
341
341
 
342
+ async def _ignore_phoenix_error(self, response: ClientResponse) -> bool:
343
+ """Return true if error is due to phoenix endpoint."""
344
+ # Endpoint URI_IDS replies with error 199 or 299
345
+ # during maintenance
346
+ return response.status in [HTTP_ERROR_199, HTTP_ERROR_299] and (
347
+ URI_IDS in response.url.path
348
+ )
349
+
342
350
  async def _http_phrase_error(self, error: int) -> str:
343
351
  """Convert numeric error in human phrase."""
344
352
  if error == HTTP_ERROR_199:
@@ -415,7 +423,9 @@ class AmazonEchoApi:
415
423
  HTTPStatus.UNAUTHORIZED,
416
424
  ]:
417
425
  raise CannotAuthenticate(await self._http_phrase_error(resp.status))
418
- if not await self._ignore_ap_signin_error(resp):
426
+ if not await self._ignore_ap_signin_error(
427
+ resp
428
+ ) and not await self._ignore_phoenix_error(resp):
419
429
  raise CannotRetrieveData(
420
430
  f"Request failed: {await self._http_phrase_error(resp.status)}"
421
431
  )
@@ -596,6 +606,16 @@ class AmazonEchoApi:
596
606
  url=f"https://alexa.amazon.{self._domain}{URI_IDS}",
597
607
  amazon_user_agent=False,
598
608
  )
609
+
610
+ # Sensors data not available
611
+ if raw_resp.status != HTTPStatus.OK:
612
+ _LOGGER.warning(
613
+ "Sensors data not available [%s error '%s'], skipping",
614
+ URI_IDS,
615
+ await self._http_phrase_error(raw_resp.status),
616
+ )
617
+ return []
618
+
599
619
  json_data = await raw_resp.json()
600
620
 
601
621
  network_detail = orjson.loads(json_data["networkDetail"])
@@ -997,6 +1017,8 @@ class AmazonEchoApi:
997
1017
  "skillId": "amzn1.ask.1p.tellalexa",
998
1018
  "text": message_body,
999
1019
  }
1020
+ else:
1021
+ raise ValueError(f"Message type <{message_type}> is not recognised")
1000
1022
 
1001
1023
  sequence = {
1002
1024
  "@type": "com.amazon.alexa.behaviors.model.Sequence",
aioamazondevices/const.py CHANGED
@@ -317,7 +317,7 @@ DEVICE_TYPE_TO_MODEL: dict[str, dict[str, str | None]] = {
317
317
  "hw_version": None,
318
318
  },
319
319
  "A4ZP7ZC4PI6TO": {
320
- "model": "Echo Show 3",
320
+ "model": "Echo Show 5",
321
321
  "hw_version": "Gen1",
322
322
  },
323
323
  "A4ZXE0RM7LQ7A": {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aioamazondevices
3
- Version: 3.2.7
3
+ Version: 3.2.9
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=2XfQP4qV_VhLGE3oFBvhG1UROnKPbaYAyh_z648hGok,276
2
+ aioamazondevices/api.py,sha256=jMf3GSTLPRZMYF3-xz19AOZRGcun7ozS32xeLWtWEns,40494
3
+ aioamazondevices/const.py,sha256=1TTqejdLJVB-8fBODXx4Ha9dxiQnuLVjbWusJ7WILdo,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.9.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
9
+ aioamazondevices-3.2.9.dist-info/METADATA,sha256=1RPgBzXRxzYDW1hOPO0D13g686IOWeQIZKHWfFTTO-8,5234
10
+ aioamazondevices-3.2.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
+ aioamazondevices-3.2.9.dist-info/RECORD,,
@@ -1,11 +0,0 @@
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,,