aioamazondevices 0.11.0__py3-none-any.whl → 0.12.0__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 +36 -15
- aioamazondevices/const.py +9 -5
- {aioamazondevices-0.11.0.dist-info → aioamazondevices-0.12.0.dist-info}/METADATA +1 -1
- aioamazondevices-0.12.0.dist-info/RECORD +10 -0
- aioamazondevices-0.11.0.dist-info/RECORD +0 -10
- {aioamazondevices-0.11.0.dist-info → aioamazondevices-0.12.0.dist-info}/LICENSE +0 -0
- {aioamazondevices-0.11.0.dist-info → aioamazondevices-0.12.0.dist-info}/WHEEL +0 -0
aioamazondevices/__init__.py
CHANGED
aioamazondevices/api.py
CHANGED
@@ -29,10 +29,13 @@ from .const import (
|
|
29
29
|
AMAZON_DEVICE_TYPE,
|
30
30
|
DEFAULT_ASSOC_HANDLE,
|
31
31
|
DEFAULT_HEADERS,
|
32
|
-
DEVICES,
|
33
32
|
DOMAIN_BY_COUNTRY,
|
34
33
|
HTML_EXTENSION,
|
35
34
|
JSON_EXTENSION,
|
35
|
+
NODE_BLUETOOTH,
|
36
|
+
NODE_DEVICES,
|
37
|
+
NODE_DO_NOT_DISTURB,
|
38
|
+
NODE_PREFERENCES,
|
36
39
|
SAVE_PATH,
|
37
40
|
URI_QUERIES,
|
38
41
|
)
|
@@ -43,13 +46,16 @@ from .exceptions import CannotAuthenticate, CannotRegisterDevice, WrongMethod
|
|
43
46
|
class AmazonDevice:
|
44
47
|
"""Amazon device class."""
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
account_name: str
|
50
|
+
capabilities: list[str]
|
51
|
+
device_family: str
|
52
|
+
device_type: str
|
53
|
+
online: bool
|
54
|
+
serial_number: str
|
55
|
+
software_version: str
|
56
|
+
do_not_disturb: bool
|
57
|
+
response_style: str | None
|
58
|
+
bluetooth_state: bool
|
53
59
|
|
54
60
|
|
55
61
|
class AmazonEchoApi:
|
@@ -486,7 +492,7 @@ class AmazonEchoApi:
|
|
486
492
|
|
487
493
|
async def get_devices_data(
|
488
494
|
self,
|
489
|
-
) -> dict[str,
|
495
|
+
) -> dict[str, AmazonDevice]:
|
490
496
|
"""Get Amazon devices data."""
|
491
497
|
devices: dict[str, Any] = {}
|
492
498
|
for key in URI_QUERIES:
|
@@ -511,13 +517,28 @@ class AmazonEchoApi:
|
|
511
517
|
else:
|
512
518
|
devices[dev_serial] = {key: data}
|
513
519
|
|
514
|
-
|
515
|
-
|
516
|
-
|
520
|
+
final_devices_list: dict[str, AmazonDevice] = {}
|
521
|
+
for device in devices.values():
|
522
|
+
# Remove stale, orphaned and virtual devices
|
517
523
|
if (
|
518
|
-
|
519
|
-
or device[
|
524
|
+
NODE_DEVICES not in device
|
525
|
+
or device[NODE_DEVICES].get("deviceType") == AMAZON_DEVICE_TYPE
|
520
526
|
):
|
521
|
-
|
527
|
+
continue
|
528
|
+
|
529
|
+
serial_number: str = device[NODE_DEVICES]["serialNumber"]
|
530
|
+
preferences = device.get(NODE_PREFERENCES)
|
531
|
+
final_devices_list[serial_number] = AmazonDevice(
|
532
|
+
account_name=device[NODE_DEVICES]["accountName"],
|
533
|
+
capabilities=device[NODE_DEVICES]["capabilities"],
|
534
|
+
device_family=device[NODE_DEVICES]["deviceFamily"],
|
535
|
+
device_type=device[NODE_DEVICES]["deviceType"],
|
536
|
+
online=device[NODE_DEVICES]["online"],
|
537
|
+
serial_number=serial_number,
|
538
|
+
software_version=device[NODE_DEVICES]["softwareVersion"],
|
539
|
+
do_not_disturb=device[NODE_DO_NOT_DISTURB]["enabled"],
|
540
|
+
response_style=preferences["responseStyle"] if preferences else None,
|
541
|
+
bluetooth_state=device[NODE_BLUETOOTH]["online"],
|
542
|
+
)
|
522
543
|
|
523
544
|
return final_devices_list
|
aioamazondevices/const.py
CHANGED
@@ -44,12 +44,16 @@ DEFAULT_HEADERS = {
|
|
44
44
|
"Accept-Encoding": "gzip",
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
NODE_DEVICES = "devices"
|
48
|
+
NODE_DO_NOT_DISTURB = "doNotDisturbDeviceStatusList"
|
49
|
+
NODE_PREFERENCES = "devicePreferences"
|
50
|
+
NODE_BLUETOOTH = "bluetoothStates"
|
51
|
+
|
48
52
|
URI_QUERIES = {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
+
NODE_DEVICES: "/api/devices-v2/device",
|
54
|
+
NODE_DO_NOT_DISTURB: "/api/dnd/device-status-list",
|
55
|
+
NODE_PREFERENCES: "/api/device-preferences",
|
56
|
+
NODE_BLUETOOTH: "/api/bluetooth",
|
53
57
|
}
|
54
58
|
|
55
59
|
# File extensions
|
@@ -0,0 +1,10 @@
|
|
1
|
+
aioamazondevices/__init__.py,sha256=oTQmfo7zpoQEBsdVdofolttfpX1O1x_nG2aDZlt_7wY,277
|
2
|
+
aioamazondevices/api.py,sha256=ZcCCvbljaDjteUFcnDOzixtYD6VTbELNubc4cMDWsBA,19831
|
3
|
+
aioamazondevices/auth.py,sha256=vLJh7iOEUYu-44WOvmrmZZueOcwz5dmHAGQmqs9fJME,10099
|
4
|
+
aioamazondevices/const.py,sha256=pY3CTWW8mOaWbaDV_oZunX9hGcDZIhImzTXZEf-mXDU,1973
|
5
|
+
aioamazondevices/exceptions.py,sha256=qK_Hak9pc-lC2FPW-0i4rYIwNpEOHMmA9Rii8F2lkQo,1260
|
6
|
+
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
aioamazondevices-0.12.0.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
8
|
+
aioamazondevices-0.12.0.dist-info/METADATA,sha256=s3SMoDBFlSYDHLkjs7bsUAU1F6JAXfogkHU55SwjQ7w,4743
|
9
|
+
aioamazondevices-0.12.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
10
|
+
aioamazondevices-0.12.0.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
aioamazondevices/__init__.py,sha256=eHj5kvzoE6UEcFSzlUNHQLMnf0dOnaLkg1fTo_HzBF8,277
|
2
|
-
aioamazondevices/api.py,sha256=e0hlC1sznOeu735ckO-ihHuDh6MofI_1PxL-r2sEaYc,18782
|
3
|
-
aioamazondevices/auth.py,sha256=vLJh7iOEUYu-44WOvmrmZZueOcwz5dmHAGQmqs9fJME,10099
|
4
|
-
aioamazondevices/const.py,sha256=T143A-tHoBTjIocWin9q4BQ_2kUozj-EwWGba3RoqSs,1852
|
5
|
-
aioamazondevices/exceptions.py,sha256=qK_Hak9pc-lC2FPW-0i4rYIwNpEOHMmA9Rii8F2lkQo,1260
|
6
|
-
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
aioamazondevices-0.11.0.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
8
|
-
aioamazondevices-0.11.0.dist-info/METADATA,sha256=OfxPWgkBJEubCOu4Zo5r9qMIOAbU4BURJmx7CK_wv98,4743
|
9
|
-
aioamazondevices-0.11.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
10
|
-
aioamazondevices-0.11.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|