python-amazon-echo 0.3.1__tar.gz → 0.3.2__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.
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/CHANGELOG.md +7 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/PKG-INFO +2 -2
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/README.md +1 -1
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/pyproject.toml +1 -1
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/__init__.py +1 -1
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/client.py +25 -1
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/const.py +1 -1
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/test_client.py +26 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/test_models.py +1 -1
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/.gitignore +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/LICENSE +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/__main__.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/auth.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/endpoints.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/exceptions.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/local.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/models.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/phrases.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/push.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/src/amazon_echo/py.typed +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/__init__.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/conftest.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/automations.json +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/devices.json +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/graphql_endpoints.json +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/graphql_smart_home.json +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/history.json +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/notifications.json +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/np_player.json +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/test_auth.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/test_local.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/test_push.py +0 -0
- {python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/test_smart_home.py +0 -0
|
@@ -4,6 +4,13 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.3.2] - 2026-11-16
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Music alarms had no time (`when` was `None`): Amazon sends `alarmTime: 0` for
|
|
12
|
+
them, so the time now comes from `originalDate` + `originalTime`. Found live.
|
|
13
|
+
|
|
7
14
|
## [0.3.1] - 2026-11-16
|
|
8
15
|
|
|
9
16
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: python-amazon-echo
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Async Python client for Amazon Echo / Alexa devices: state, settings, media, notifications, lists, HTTP/2 push and LAN discovery
|
|
5
5
|
Project-URL: Homepage, https://github.com/hudsonbrendon/python-amazon-echo
|
|
6
6
|
Project-URL: Repository, https://github.com/hudsonbrendon/python-amazon-echo
|
|
@@ -243,7 +243,7 @@ with mocked HTTP.
|
|
|
243
243
|
| `set_aux_direction` | no-op write accepted; the body field name is unconfirmed |
|
|
244
244
|
| `set_volume` (sequence pipeline) | no-op write |
|
|
245
245
|
| `create_reminder`, `delete_notification` | live (a reminder 320 days ahead was created and deleted) |
|
|
246
|
-
| `create_alarm` |
|
|
246
|
+
| `create_alarm` | verified live: a plain alarm earlier, and on 2026-11-16 a music alarm (`music=`, reusing a Spotify music alarm made by voice) created on an Echo Plus and deleted |
|
|
247
247
|
| `create_alarm(music=…)` (music alarm that reuses the station of an existing one) | ported from Alexa Media Player's request, never sent |
|
|
248
248
|
| `play_music(timer=…)` (stop after that many seconds) | ported from Alexa Media Player's payload, never sent |
|
|
249
249
|
| `create_timer` | verified live on an Echo Plus (pt-BR): a 12-minute timer, with and without a name, created and deleted. It is a typed request with the duration in words; English phrases are unit-tested only |
|
|
@@ -219,7 +219,7 @@ with mocked HTTP.
|
|
|
219
219
|
| `set_aux_direction` | no-op write accepted; the body field name is unconfirmed |
|
|
220
220
|
| `set_volume` (sequence pipeline) | no-op write |
|
|
221
221
|
| `create_reminder`, `delete_notification` | live (a reminder 320 days ahead was created and deleted) |
|
|
222
|
-
| `create_alarm` |
|
|
222
|
+
| `create_alarm` | verified live: a plain alarm earlier, and on 2026-11-16 a music alarm (`music=`, reusing a Spotify music alarm made by voice) created on an Echo Plus and deleted |
|
|
223
223
|
| `create_alarm(music=…)` (music alarm that reuses the station of an existing one) | ported from Alexa Media Player's request, never sent |
|
|
224
224
|
| `play_music(timer=…)` (stop after that many seconds) | ported from Alexa Media Player's payload, never sent |
|
|
225
225
|
| `create_timer` | verified live on an Echo Plus (pt-BR): a 12-minute timer, with and without a name, created and deleted. It is a typed request with the duration in words; English phrases are unit-tested only |
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-amazon-echo"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.2"
|
|
8
8
|
description = "Async Python client for Amazon Echo / Alexa devices: state, settings, media, notifications, lists, HTTP/2 push and LAN discovery"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -127,6 +127,26 @@ def _local(when: datetime) -> datetime:
|
|
|
127
127
|
return when.astimezone().replace(tzinfo=None) if when.tzinfo else when
|
|
128
128
|
|
|
129
129
|
|
|
130
|
+
def _from_original(item: dict[str, Any]) -> datetime | None:
|
|
131
|
+
"""Local ``originalDate`` + ``originalTime`` (music alarms carry only these).
|
|
132
|
+
|
|
133
|
+
Same time zone assumption as :func:`_local`; a repeating alarm whose first
|
|
134
|
+
date is past moves to its next ring.
|
|
135
|
+
"""
|
|
136
|
+
date, clock = item.get("originalDate"), item.get("originalTime")
|
|
137
|
+
if not date or not clock:
|
|
138
|
+
return None
|
|
139
|
+
try:
|
|
140
|
+
when = datetime.fromisoformat(f"{date}T{str(clock)[:8]}").astimezone()
|
|
141
|
+
if item.get("recurringPattern") and when < datetime.now().astimezone():
|
|
142
|
+
# _next_ring works on local wall-clock time
|
|
143
|
+
ring = _next_ring(item, datetime.now()) # noqa: DTZ005
|
|
144
|
+
when = datetime.fromisoformat(ring).astimezone()
|
|
145
|
+
except ValueError:
|
|
146
|
+
return None
|
|
147
|
+
return when
|
|
148
|
+
|
|
149
|
+
|
|
130
150
|
def parse_notification(item: dict[str, Any]) -> Notification:
|
|
131
151
|
"""Build a :class:`Notification` from an ``/api/notifications`` item."""
|
|
132
152
|
kind = NOTIFICATION_KINDS.get(item.get("type") or "", "")
|
|
@@ -134,7 +154,11 @@ def parse_notification(item: dict[str, Any]) -> Notification:
|
|
|
134
154
|
if item.get("musicAlarmId") and kind == "alarm":
|
|
135
155
|
kind = "music_alarm"
|
|
136
156
|
remaining = item.get("remainingTime") or 0
|
|
137
|
-
when =
|
|
157
|
+
when = (
|
|
158
|
+
_from_ms(item.get("triggerTime"))
|
|
159
|
+
or _from_ms(item.get("alarmTime"))
|
|
160
|
+
or (_from_original(item) if kind in ("alarm", "music_alarm") else None)
|
|
161
|
+
)
|
|
138
162
|
return Notification(
|
|
139
163
|
id=item["id"],
|
|
140
164
|
kind=kind,
|
|
@@ -1641,3 +1641,29 @@ async def test_cookie_refresh_works_right_after_boot(client, session, monkeypatc
|
|
|
1641
1641
|
session.add("POST", "/auth/token", COOKIE_ANSWER)
|
|
1642
1642
|
assert await client.request("GET", "/api/x") == {"ok": 1}
|
|
1643
1643
|
assert len(session.sent("/auth/token")) == 1
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
def test_music_alarm_time_comes_from_the_original_fields():
|
|
1647
|
+
item = {
|
|
1648
|
+
"id": "A18O6U1UQFJ0XK-G000TEST00000001-music",
|
|
1649
|
+
"type": "MusicAlarm",
|
|
1650
|
+
"status": "ON",
|
|
1651
|
+
"deviceSerialNumber": "G000TEST00000001",
|
|
1652
|
+
"deviceType": "A18O6U1UQFJ0XK",
|
|
1653
|
+
"alarmTime": 0,
|
|
1654
|
+
"triggerTime": 0,
|
|
1655
|
+
"originalDate": "2030-12-06",
|
|
1656
|
+
"originalTime": "06:10:00.000",
|
|
1657
|
+
"musicAlarmId": "fake-music-alarm",
|
|
1658
|
+
"provider": "Spotify",
|
|
1659
|
+
"musicEntity": "fake station",
|
|
1660
|
+
}
|
|
1661
|
+
alarm = parse_notification(item)
|
|
1662
|
+
assert alarm.kind == "music_alarm"
|
|
1663
|
+
assert alarm.when == datetime(2030, 12, 6, 6, 10).astimezone()
|
|
1664
|
+
assert parse_notification({**item, "originalDate": None}).when is None
|
|
1665
|
+
repeating = parse_notification(
|
|
1666
|
+
{**item, "originalDate": "2020-01-01", "recurringPattern": "P1D"}
|
|
1667
|
+
)
|
|
1668
|
+
assert repeating.when is not None
|
|
1669
|
+
assert repeating.when > datetime.now().astimezone()
|
|
@@ -7,7 +7,7 @@ from amazon_echo import Device, Notification, PushEvent
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def test_public_api():
|
|
10
|
-
assert amazon_echo.__version__ == "0.3.
|
|
10
|
+
assert amazon_echo.__version__ == "0.3.2"
|
|
11
11
|
for name in amazon_echo.__all__:
|
|
12
12
|
assert hasattr(amazon_echo, name)
|
|
13
13
|
assert issubclass(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_amazon_echo-0.3.1 → python_amazon_echo-0.3.2}/tests/fixtures/graphql_smart_home.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|