python-amazon-echo 0.3.1__py3-none-any.whl → 0.3.2__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.
amazon_echo/__init__.py CHANGED
@@ -30,7 +30,7 @@ from .models import (
30
30
  )
31
31
  from .push import PushClient, PushEvent
32
32
 
33
- __version__ = "0.3.1"
33
+ __version__ = "0.3.2"
34
34
 
35
35
  __all__ = [
36
36
  "Account",
amazon_echo/client.py CHANGED
@@ -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 = _from_ms(item.get("triggerTime")) or _from_ms(item.get("alarmTime"))
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,
amazon_echo/const.py CHANGED
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any, Final
6
6
 
7
- VERSION: Final = "0.3.1"
7
+ VERSION: Final = "0.3.2"
8
8
 
9
9
  # Identity of the Alexa iOS app, which is what a registration impersonates.
10
10
  APP_NAME: Final = "Amazon Echo for Home Assistant"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-amazon-echo
3
- Version: 0.3.1
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` | ported |
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 |
@@ -1,8 +1,8 @@
1
- amazon_echo/__init__.py,sha256=A2TR67ga1Q9cB1wzlf8PWPzoIHxSfiu5F4nsgJ9RAMU,1437
1
+ amazon_echo/__init__.py,sha256=jDc5ixY_0MCZ0fIDZ-fir3K5XzULlUip7TLPDtK0FTc,1437
2
2
  amazon_echo/__main__.py,sha256=1Hhd7w2cW5Z9jmwO1OThhcj6gbTLVqAQu5fAMqijJ_0,4325
3
3
  amazon_echo/auth.py,sha256=O5SAtY5Wf76-LtFOkHJvrzlNoZdprgJsx5-3crEPUGQ,14417
4
- amazon_echo/client.py,sha256=CwzLzZn8zNO2pHp7FpYpUCrXw73e37vCcM6Sq9uRBE4,81267
5
- amazon_echo/const.py,sha256=VdwrTHytFm4Yh-qlcClfTFL-KnnfyClWGA-7W_sU2X4,11880
4
+ amazon_echo/client.py,sha256=cDgGYQV36XiopxVZI-Nfg_x-Qf9s85LB6pCKRBdXOAo,82176
5
+ amazon_echo/const.py,sha256=NTm8ck2pPGYinNETKFsyCMBEAvO3jMIJmxO6WLvDxWU,11880
6
6
  amazon_echo/endpoints.py,sha256=_6vXYWtwGIR_2IjVFJAXWP1vR6jwzIpZ4upkRctwBp8,7925
7
7
  amazon_echo/exceptions.py,sha256=7ETH4C2sKbKEJWnJ30ygAO0a_GiD5PWmDHJCSVTedAU,1120
8
8
  amazon_echo/local.py,sha256=KHwwgC2-MzFZ0wBaxXRuotyr7-zrrenzfM0P3BEMRvE,3080
@@ -10,8 +10,8 @@ amazon_echo/models.py,sha256=ZKEHuiyG7hqRt5M8nufyf1nyaRZ2-l1WXlOCzG4UH7A,5258
10
10
  amazon_echo/phrases.py,sha256=iqhqIK07XRTWmAwJ5jhzGPtqatvUz4nywCvJvCgwTK0,3579
11
11
  amazon_echo/push.py,sha256=KMcHeDLgRxEjCQpTybiJUAUNTFTxlDMpTVPDv0ZYAzE,11206
12
12
  amazon_echo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- python_amazon_echo-0.3.1.dist-info/METADATA,sha256=m2ILh-YpRt36B1OV0Gx-a7RDkzdOtFLBLXbZMXZgheE,17932
14
- python_amazon_echo-0.3.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
15
- python_amazon_echo-0.3.1.dist-info/entry_points.txt,sha256=rbZJ8BI8kkiDTV9cKk6acbHuyAm2xNYfpDBXQNw8Yb8,58
16
- python_amazon_echo-0.3.1.dist-info/licenses/LICENSE,sha256=4Zgd3fbLJqWSkwKA-hh1rNN6DC9tNQ3rWLX93fingOw,1071
17
- python_amazon_echo-0.3.1.dist-info/RECORD,,
13
+ python_amazon_echo-0.3.2.dist-info/METADATA,sha256=U6Vz3el21WGFpFXXgJnu84_hLiVIR-qLA7EMno4tnbc,18087
14
+ python_amazon_echo-0.3.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
15
+ python_amazon_echo-0.3.2.dist-info/entry_points.txt,sha256=rbZJ8BI8kkiDTV9cKk6acbHuyAm2xNYfpDBXQNw8Yb8,58
16
+ python_amazon_echo-0.3.2.dist-info/licenses/LICENSE,sha256=4Zgd3fbLJqWSkwKA-hh1rNN6DC9tNQ3rWLX93fingOw,1071
17
+ python_amazon_echo-0.3.2.dist-info/RECORD,,