aioamazondevices 0.11.1__tar.gz → 0.12.0__tar.gz
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-0.11.1 → aioamazondevices-0.12.0}/PKG-INFO +1 -1
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/pyproject.toml +1 -1
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/src/aioamazondevices/__init__.py +1 -1
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/src/aioamazondevices/api.py +28 -9
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/src/aioamazondevices/const.py +9 -5
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/LICENSE +0 -0
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/README.md +0 -0
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/src/aioamazondevices/auth.py +0 -0
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/src/aioamazondevices/exceptions.py +0 -0
- {aioamazondevices-0.11.1 → aioamazondevices-0.12.0}/src/aioamazondevices/py.typed +0 -0
@@ -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
|
)
|
@@ -47,10 +50,11 @@ class AmazonDevice:
|
|
47
50
|
capabilities: list[str]
|
48
51
|
device_family: str
|
49
52
|
device_type: str
|
53
|
+
online: bool
|
50
54
|
serial_number: str
|
51
55
|
software_version: str
|
52
56
|
do_not_disturb: bool
|
53
|
-
response_style: str
|
57
|
+
response_style: str | None
|
54
58
|
bluetooth_state: bool
|
55
59
|
|
56
60
|
|
@@ -488,7 +492,7 @@ class AmazonEchoApi:
|
|
488
492
|
|
489
493
|
async def get_devices_data(
|
490
494
|
self,
|
491
|
-
) -> dict[str,
|
495
|
+
) -> dict[str, AmazonDevice]:
|
492
496
|
"""Get Amazon devices data."""
|
493
497
|
devices: dict[str, Any] = {}
|
494
498
|
for key in URI_QUERIES:
|
@@ -513,13 +517,28 @@ class AmazonEchoApi:
|
|
513
517
|
else:
|
514
518
|
devices[dev_serial] = {key: data}
|
515
519
|
|
516
|
-
|
517
|
-
|
518
|
-
|
520
|
+
final_devices_list: dict[str, AmazonDevice] = {}
|
521
|
+
for device in devices.values():
|
522
|
+
# Remove stale, orphaned and virtual devices
|
519
523
|
if (
|
520
|
-
|
521
|
-
or device[
|
524
|
+
NODE_DEVICES not in device
|
525
|
+
or device[NODE_DEVICES].get("deviceType") == AMAZON_DEVICE_TYPE
|
522
526
|
):
|
523
|
-
|
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
|
+
)
|
524
543
|
|
525
544
|
return final_devices_list
|
@@ -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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|