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.
- aioamazondevices/__init__.py +1 -1
- aioamazondevices/api.py +19 -4
- aioamazondevices/const.py +20 -0
- aioamazondevices/exceptions.py +1 -1
- {aioamazondevices-6.1.3.dist-info → aioamazondevices-6.2.1.dist-info}/METADATA +1 -1
- aioamazondevices-6.2.1.dist-info/RECORD +12 -0
- aioamazondevices-6.1.3.dist-info/RECORD +0 -12
- {aioamazondevices-6.1.3.dist-info → aioamazondevices-6.2.1.dist-info}/LICENSE +0 -0
- {aioamazondevices-6.1.3.dist-info → aioamazondevices-6.2.1.dist-info}/WHEEL +0 -0
aioamazondevices/__init__.py
CHANGED
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
|
|
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
|
|
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
|
|
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
|
|
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
|
+
]
|
aioamazondevices/exceptions.py
CHANGED
|
@@ -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,,
|
|
File without changes
|
|
File without changes
|