aioamazondevices 6.1.3__py3-none-any.whl → 6.2.1__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__ = "6.1.3"
3
+ __version__ = "6.2.1"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
aioamazondevices/api.py CHANGED
@@ -30,6 +30,7 @@ from yarl import URL
30
30
  from . import __version__
31
31
  from .const import (
32
32
  _LOGGER,
33
+ ALEXA_INFO_SKILLS,
33
34
  AMAZON_APP_BUNDLE_ID,
34
35
  AMAZON_APP_ID,
35
36
  AMAZON_APP_NAME,
@@ -277,7 +278,7 @@ class AmazonEchoApi:
277
278
  form = soup.find("form", {"name": "signIn"}) or soup.find("form")
278
279
 
279
280
  if not isinstance(form, Tag):
280
- raise TypeError("Unable to find form in login response")
281
+ raise CannotAuthenticate("Unable to find form in login response")
281
282
 
282
283
  inputs = {}
283
284
  for field in form.find_all("input"):
@@ -295,7 +296,7 @@ class AmazonEchoApi:
295
296
  url = form.get("action")
296
297
  if isinstance(method, str) and isinstance(url, str):
297
298
  return method, url
298
- raise TypeError("Unable to extract form data from response")
299
+ raise CannotAuthenticate("Unable to extract form data from response")
299
300
 
300
301
  def _extract_code_from_url(self, url: URL) -> str:
301
302
  """Extract the access token from url query after login."""
@@ -306,7 +307,9 @@ class AmazonEchoApi:
306
307
  for key, value in url.query.items():
307
308
  parsed_url[key] = [value]
308
309
  else:
309
- raise TypeError(f"Unable to extract authorization code from url: {url}")
310
+ raise CannotAuthenticate(
311
+ f"Unable to extract authorization code from url: {url}"
312
+ )
310
313
  return parsed_url["openid.oa2.authorization_code"][0]
311
314
 
312
315
  async def _ignore_ap_signin_error(self, response: ClientResponse) -> bool:
@@ -642,7 +645,7 @@ class AmazonEchoApi:
642
645
  continue
643
646
 
644
647
  if not (name := sensor["name"]):
645
- raise TypeError("Unable to read sensor template")
648
+ raise CannotRetrieveData("Unable to read sensor template")
646
649
 
647
650
  value = first_property[sensor["key"]]
648
651
  scale = value["scale"] if sensor["scale"] else None
@@ -998,6 +1001,10 @@ class AmazonEchoApi:
998
1001
  "uri": "connection://AMAZON.Launch/" + message_body,
999
1002
  },
1000
1003
  }
1004
+ elif message_type in ALEXA_INFO_SKILLS:
1005
+ payload = {
1006
+ **base_payload,
1007
+ }
1001
1008
  else:
1002
1009
  raise ValueError(f"Message type <{message_type}> is not recognised")
1003
1010
 
@@ -1088,6 +1095,14 @@ class AmazonEchoApi:
1088
1095
  device, AmazonSequenceType.LaunchSkill, message_body
1089
1096
  )
1090
1097
 
1098
+ async def call_alexa_info_skill(
1099
+ self,
1100
+ device: AmazonDevice,
1101
+ message_type: str,
1102
+ ) -> None:
1103
+ """Call Info skill. See ALEXA_INFO_SKILLS . const."""
1104
+ return await self._send_message(device, message_type, "")
1105
+
1091
1106
  async def set_do_not_disturb(self, device: AmazonDevice, state: bool) -> None:
1092
1107
  """Set do_not_disturb flag."""
1093
1108
  payload = {
aioamazondevices/const.py CHANGED
@@ -432,3 +432,23 @@ DEVICE_TYPE_TO_MODEL: dict[str, dict[str, str | None]] = {
432
432
  "hw_version": "Gen2",
433
433
  },
434
434
  }
435
+
436
+ ALEXA_INFO_SKILLS = [
437
+ "Alexa.Calendar.PlayToday",
438
+ "Alexa.Calendar.PlayTomorrow",
439
+ "Alexa.Calendar.PlayNext",
440
+ "Alexa.Date.Play",
441
+ "Alexa.Time.Play",
442
+ "Alexa.News.NationalNews",
443
+ "Alexa.FlashBriefing.Play",
444
+ "Alexa.Traffic.Play",
445
+ "Alexa.Weather.Play",
446
+ "Alexa.CleanUp.Play",
447
+ "Alexa.GoodMorning.Play",
448
+ "Alexa.SingASong.Play",
449
+ "Alexa.FunFact.Play",
450
+ "Alexa.Joke.Play",
451
+ "Alexa.TellStory.Play",
452
+ "Alexa.ImHome.Play",
453
+ "Alexa.GoodNight.Play",
454
+ ]
@@ -12,7 +12,7 @@ class CannotConnect(AmazonError):
12
12
 
13
13
 
14
14
  class CannotAuthenticate(AmazonError):
15
- """Exception raised when credentials are incorrect."""
15
+ """Exception raised when authentication fails."""
16
16
 
17
17
 
18
18
  class CannotRetrieveData(AmazonError):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aioamazondevices
3
- Version: 6.1.3
3
+ Version: 6.2.1
4
4
  Summary: Python library to control Amazon devices
5
5
  License: Apache-2.0
6
6
  Author: Simone Chemelli
@@ -0,0 +1,12 @@
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,,
@@ -1,12 +0,0 @@
1
- aioamazondevices/__init__.py,sha256=xeVWui7vweRIpKp3JwYLPcG-tXnRhz-cFfImDeXVFWU,276
2
- aioamazondevices/api.py,sha256=C4XD9GvRmwL-sc-dRlaWzarlLzeqq8N4rTymCdyF0-Q,41579
3
- aioamazondevices/const.py,sha256=bqJmaStichdm0zB1RQYXa4OPz2gU2JnmUFQHeItlnZE,10808
4
- aioamazondevices/exceptions.py,sha256=JDnSFi_7oEhqK31sHXf0S_cyMoMjiRJuLp4ow7mYgLY,643
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.1.3.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
10
- aioamazondevices-6.1.3.dist-info/METADATA,sha256=WBhhAbei9OCzT63keD7HIoOVOnmu3Vy2EqitmtTEADQ,7623
11
- aioamazondevices-6.1.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
12
- aioamazondevices-6.1.3.dist-info/RECORD,,