pyalexaalerts 0.1.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.
- pyalexaalerts-0.1.0/LICENSE +21 -0
- pyalexaalerts-0.1.0/PKG-INFO +204 -0
- pyalexaalerts-0.1.0/README.md +174 -0
- pyalexaalerts-0.1.0/pyproject.toml +53 -0
- pyalexaalerts-0.1.0/setup.cfg +4 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/__init__.py +31 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/__main__.py +5 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/api.py +306 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/auth.py +238 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/cli.py +457 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/exception.py +36 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/get_alexa_cookies.py +45 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/manager.py +525 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/resource.py +620 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts/setup_alexa_cli.py +126 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts.egg-info/PKG-INFO +204 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts.egg-info/SOURCES.txt +21 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts.egg-info/dependency_links.txt +1 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts.egg-info/entry_points.txt +4 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts.egg-info/requires.txt +4 -0
- pyalexaalerts-0.1.0/src/pyalexaalerts.egg-info/top_level.txt +1 -0
- pyalexaalerts-0.1.0/tests/test_api.py +134 -0
- pyalexaalerts-0.1.0/tests/test_manager.py +825 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kyron Longwood
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyalexaalerts
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An unofficial Python library for programmatically managing Amazon Alexa alarms, timers, and reminders.
|
|
5
|
+
Author: Kyron Longwood
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kyrlon/pyalexaalerts
|
|
8
|
+
Project-URL: Repository, https://github.com/kyrlon/pyalexaalerts
|
|
9
|
+
Project-URL: Issues, https://github.com/kyrlon/pyalexaalerts/issues
|
|
10
|
+
Keywords: alexa,amazon,echo,alarm,reminder,timer,cli
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Home Automation
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: requests
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest; extra == "test"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# pyalexaalerts
|
|
32
|
+
|
|
33
|
+
An unofficial Python library and command-line app for managing Amazon Alexa **alarms, timers and reminders** on your Echo devices:
|
|
34
|
+
|
|
35
|
+
- **Alarms:** create, edit, delete, and switch off and on.
|
|
36
|
+
- **Reminders:** create, edit and delete one-off, daily, weekly and monthly reminders, with notes, an important flag and keep reminding.
|
|
37
|
+
- **Timers:** create, pause, resume, add time to, take time off and delete.
|
|
38
|
+
- **Ringing:** stop or snooze whatever is going off.
|
|
39
|
+
|
|
40
|
+
It's a sister project of [pyalexalist](https://github.com/kyrlon/pyalexalist) and uses the same credential setup.
|
|
41
|
+
|
|
42
|
+
*pyalexaalerts is neither supported nor endorsed by Amazon.*
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
Python 3.10 or newer. From PyPI:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pip install pyalexaalerts
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
or, to install into a specific Python (e.g. when `pip` points at a different one):
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
python -m pip install pyalexaalerts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
From a clone of the repository:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
git clone https://github.com/kyrlon/pyalexaalerts.git
|
|
62
|
+
cd pyalexaalerts
|
|
63
|
+
pip install .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For development, install it editable with the test dependencies instead: `pip install -e .[test]`.
|
|
67
|
+
|
|
68
|
+
## Obtaining Alexa credentials
|
|
69
|
+
|
|
70
|
+
This is the same flow as pyalexalist. If you already have a `config/service_auth.json` from pyalexalist, copy it here or point `--config` at it. The app looks for `config/service_auth.json` in the folder you run it from.
|
|
71
|
+
|
|
72
|
+
1. Create `config/service_auth.json`:
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"alexa": {
|
|
76
|
+
"refresh_token": ""
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
2. Download the cookie CLI: `pyalexaalerts-setup-cli` (supports `--list`, `--version X`, `--force`).
|
|
81
|
+
3. Sign in and copy the refresh token into `alexa.refresh_token`:
|
|
82
|
+
```
|
|
83
|
+
.\alexa-cookie-cli\alexa-cookie-cli-win.exe -p amazon.com -b amazon.com -a en_US -L en-US # Windows
|
|
84
|
+
./alexa-cookie-cli/alexa-cookie-cli-linux -p amazon.com -b amazon.com -a en_US -L en-US # Linux
|
|
85
|
+
./alexa-cookie-cli/alexa-cookie-cli-macos -p amazon.com -b amazon.com -a en_US -L en-US # macOS
|
|
86
|
+
```
|
|
87
|
+
4. Run any command. The app swaps the refresh token for session cookies and an access token and caches both in `config/runtime_credentials.json`. Both are renewed automatically when they expire or the server rejects them.
|
|
88
|
+
|
|
89
|
+
## Command-line app
|
|
90
|
+
|
|
91
|
+
`ID` below is the 8-character ID shown by `list`; any unique start of it works. Run `pyalexaalerts COMMAND --help` for every option.
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
pyalexaalerts devices # Echo devices
|
|
95
|
+
pyalexaalerts list # alarms (on), reminders, timers
|
|
96
|
+
pyalexaalerts list --all --type alarm # include switched-off alarms
|
|
97
|
+
pyalexaalerts list --type task # Alexa to-do items (add --all for done ones)
|
|
98
|
+
pyalexaalerts sounds -d bedroom # alarm sounds for a device
|
|
99
|
+
pyalexaalerts sounds -d bedroom --for timer # timer sounds (the current default is marked)
|
|
100
|
+
|
|
101
|
+
# alarms
|
|
102
|
+
pyalexaalerts alarm -d "Bedroom Echo" -t 6:45 -r weekdays
|
|
103
|
+
pyalexaalerts alarm -d bedroom -t 7:00 -r mon,wed,sun -s "Sonar"
|
|
104
|
+
pyalexaalerts alarm -d bedroom -t 9am -D 2026-12-25
|
|
105
|
+
pyalexaalerts alarm -d bedroom --in 8h --off # created switched off
|
|
106
|
+
pyalexaalerts off 1a2b3c4d # switch an alarm off, keep it (alias: disable)
|
|
107
|
+
pyalexaalerts on 1a2b3c4d # switch it back on (aliases: enable, start)
|
|
108
|
+
pyalexaalerts edit 1a2b3c4d -t 7:15 -r weekends -s "Simple Alarm"
|
|
109
|
+
|
|
110
|
+
# reminders
|
|
111
|
+
pyalexaalerts reminder -d kitchen --in 20m -m "Take the pizza out"
|
|
112
|
+
pyalexaalerts reminder -d kitchen -t 9pm -r tue,thu -m "Take out trash"
|
|
113
|
+
pyalexaalerts reminder -d kitchen -t 7pm -r monthly:2 -m "Give Bella her medicine"
|
|
114
|
+
pyalexaalerts reminder -d kitchen -t 8am -r daily -m "Take medicine" --keep-reminding --important
|
|
115
|
+
pyalexaalerts reminder -d kitchen -D 2026-12-10 -t 9am -m "Renew tags" -n "bring insurance card"
|
|
116
|
+
pyalexaalerts edit 5e6f7a8b -m "Bins out" -t 8pm
|
|
117
|
+
pyalexaalerts edit 5e6f7a8b -n "recycling too" --no-important --keep-reminding
|
|
118
|
+
pyalexaalerts edit 5e6f7a8b --next-only -t 9pm -m "Bins out late" # only the next occurrence
|
|
119
|
+
|
|
120
|
+
# timers
|
|
121
|
+
pyalexaalerts timer -d kitchen 10m
|
|
122
|
+
pyalexaalerts timer -d kitchen 1h30m -l pizza
|
|
123
|
+
pyalexaalerts pause 9f8e7d6c
|
|
124
|
+
pyalexaalerts resume 9f8e7d6c
|
|
125
|
+
pyalexaalerts add-time 9f8e7d6c 5m
|
|
126
|
+
pyalexaalerts subtract-time 9f8e7d6c 2m
|
|
127
|
+
|
|
128
|
+
# whatever is ringing right now
|
|
129
|
+
pyalexaalerts stop-alert -d bedroom # like "Alexa, stop"
|
|
130
|
+
pyalexaalerts snooze -d bedroom --for 5m # alarm or reminder, like "Alexa, snooze for 5 minutes"
|
|
131
|
+
|
|
132
|
+
# delete anything
|
|
133
|
+
pyalexaalerts delete 1a2b3c4d 5e6f7a8b # asks to confirm; -y to skip (aliases: rm, cancel)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`python -m pyalexaalerts ...` works too. Global options go **before** the command: `--config PATH`, `--domain amazon.co.uk`, `--host HOST`, `--person-id ID`, `-v`/`-vv` (logging).
|
|
137
|
+
|
|
138
|
+
- **Devices** match by serial number, then by exact name, then by a unique part of the name. Case is ignored.
|
|
139
|
+
- **When:** `-t` a time (`7:30`, `7:30pm`), optionally with `-D` a date (`2026-12-25`, `today`, `tomorrow`), or `--in` a duration (`20m`, `1h30m`). Times are the device's local time (see *Timezones* below).
|
|
140
|
+
- **Repeats** (`-r`): `daily`, `weekdays`, `weekends`, or any days like `mon,wed,sun` (full names work too). One alarm or reminder covers all the days. With a repeat and only a time, the first matching day is used. `-r none` clears a repeat when editing.
|
|
141
|
+
- **Monthly** (reminders only): `monthly:15`, or plain `monthly` for the day of the first occurrence, so `-D 2026-12-15 -r monthly` means the 15th of every month. `-D` works with monthly repeats but not with weekly ones.
|
|
142
|
+
- **Sounds:** a name or id from `sounds`. Built-in sounds work, including the celebrity ones.
|
|
143
|
+
|
|
144
|
+
## Programmatic usage
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
import datetime
|
|
148
|
+
from pyalexaalerts import AlexaAlerts
|
|
149
|
+
|
|
150
|
+
alexa = AlexaAlerts() # or service_auth_path=..., person_id=...
|
|
151
|
+
alexa.resync()
|
|
152
|
+
|
|
153
|
+
for item in alexa.find("alarm"): # or "reminder", "timer"; "task" for to-do items
|
|
154
|
+
print(item)
|
|
155
|
+
|
|
156
|
+
alarm = alexa.createAlarm("Bedroom Echo", datetime.time(6, 45), recurrence="weekdays", sound="Sonar")
|
|
157
|
+
alexa.disable(alarm)
|
|
158
|
+
alexa.enable(alarm)
|
|
159
|
+
alexa.updateAlarm(alarm, when=datetime.time(7, 0))
|
|
160
|
+
|
|
161
|
+
rem = alexa.createReminder("Kitchen", datetime.timedelta(minutes=20), "Take the pizza out",
|
|
162
|
+
note="middle rack", important=True, keep_reminding=True)
|
|
163
|
+
alexa.updateReminder(rem, note=None, important=False)
|
|
164
|
+
|
|
165
|
+
timer = alexa.createTimer("Kitchen", datetime.timedelta(minutes=2), label="pizza") # None if it didn't appear
|
|
166
|
+
alexa.pause(timer)
|
|
167
|
+
alexa.resume(timer)
|
|
168
|
+
timer = alexa.adjustTimer(timer, datetime.timedelta(minutes=5)) # negative subtracts
|
|
169
|
+
|
|
170
|
+
alexa.stopAlert("Kitchen") # whatever is ringing; alexa.snooze("Bedroom") for alarms or reminders
|
|
171
|
+
alexa.delete(rem)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`when` takes a `datetime` (device-local), a `time` (next matching occurrence) or a `timedelta` (from now). `AlexaAPI` is the low-level client and returns raw dicts.
|
|
175
|
+
|
|
176
|
+
## Notes and limitations
|
|
177
|
+
|
|
178
|
+
### Alarms
|
|
179
|
+
- **`off` doesn't silence a ringing alarm.** It switches the alarm off for the future and keeps it; `on` switches it back on. Use `stop-alert` to silence one that's ringing.
|
|
180
|
+
- **`cancel` deletes**, as in "Alexa, cancel my alarm".
|
|
181
|
+
- **Two alarms can't share a time on one device**, and a repeating alarm counts on every matching day.
|
|
182
|
+
|
|
183
|
+
### Reminders
|
|
184
|
+
- **No on/off switch.** Delete them instead. Deleting a repeating reminder removes the whole series.
|
|
185
|
+
- **`edit --next-only`** changes just the next occurrence of a repeating reminder: `-t` keeps the day, `-D` keeps the time, and `-m` changes the text.
|
|
186
|
+
- **Monthly reminders repeat on one day of the month.**
|
|
187
|
+
- **Finished one-off reminders** show as DONE in `list --all` and are hidden from plain `list`.
|
|
188
|
+
- **To-do items** from your Alexa to-do list are hidden unless you ask for them: `list --type task` shows open ones, and `--all` adds done ones. They can only be listed, not created, edited or deleted.
|
|
189
|
+
- **Not supported:** choosing a reminder's sound, location-based reminders, reminders for other people, and announcements to all devices.
|
|
190
|
+
|
|
191
|
+
### Timers
|
|
192
|
+
- **`add-time` / `subtract-time` are silent.** They pause the timer with the new time left and resume it straight away. A paused timer stays paused. Each change adds about a second, because the timer stops counting for an instant. You can't subtract more than is left.
|
|
193
|
+
- **Not supported:** renaming a timer, or giving one its own sound (new timers use the device's default timer sound).
|
|
194
|
+
|
|
195
|
+
### Ringing alerts
|
|
196
|
+
- **`stop-alert` silences whatever is ringing**, and **`snooze`** snoozes a ringing alarm or reminder. A snoozed reminder shows as SNOOZED in `list` until it goes off again.
|
|
197
|
+
|
|
198
|
+
### Repeats and sounds
|
|
199
|
+
- **Repeats** can be daily, weekdays, weekends, specific days, or (reminders only) monthly on one day. Not supported: monthly alarms, every N weeks or months, "first Monday"-style rules, yearly, or end dates. Daily reminders are saved as weekly on all 7 days, which works the same.
|
|
200
|
+
- **Skill sounds** (e.g. Loud Buzzer) are refused, because choosing one was never seen in the app and some cost money. Timer-only sounds can't be used for alarms.
|
|
201
|
+
- **Device default sounds** for alarms and timers can be shown (`sounds`) but not changed.
|
|
202
|
+
|
|
203
|
+
### General
|
|
204
|
+
- **Timezones:** alarms send a local time and use the Echo's timezone. One-off reminders are converted using this computer's timezone, so it should match the Echo's.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# pyalexaalerts
|
|
2
|
+
|
|
3
|
+
An unofficial Python library and command-line app for managing Amazon Alexa **alarms, timers and reminders** on your Echo devices:
|
|
4
|
+
|
|
5
|
+
- **Alarms:** create, edit, delete, and switch off and on.
|
|
6
|
+
- **Reminders:** create, edit and delete one-off, daily, weekly and monthly reminders, with notes, an important flag and keep reminding.
|
|
7
|
+
- **Timers:** create, pause, resume, add time to, take time off and delete.
|
|
8
|
+
- **Ringing:** stop or snooze whatever is going off.
|
|
9
|
+
|
|
10
|
+
It's a sister project of [pyalexalist](https://github.com/kyrlon/pyalexalist) and uses the same credential setup.
|
|
11
|
+
|
|
12
|
+
*pyalexaalerts is neither supported nor endorsed by Amazon.*
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
Python 3.10 or newer. From PyPI:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
pip install pyalexaalerts
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
or, to install into a specific Python (e.g. when `pip` points at a different one):
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
python -m pip install pyalexaalerts
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
From a clone of the repository:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
git clone https://github.com/kyrlon/pyalexaalerts.git
|
|
32
|
+
cd pyalexaalerts
|
|
33
|
+
pip install .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For development, install it editable with the test dependencies instead: `pip install -e .[test]`.
|
|
37
|
+
|
|
38
|
+
## Obtaining Alexa credentials
|
|
39
|
+
|
|
40
|
+
This is the same flow as pyalexalist. If you already have a `config/service_auth.json` from pyalexalist, copy it here or point `--config` at it. The app looks for `config/service_auth.json` in the folder you run it from.
|
|
41
|
+
|
|
42
|
+
1. Create `config/service_auth.json`:
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"alexa": {
|
|
46
|
+
"refresh_token": ""
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
2. Download the cookie CLI: `pyalexaalerts-setup-cli` (supports `--list`, `--version X`, `--force`).
|
|
51
|
+
3. Sign in and copy the refresh token into `alexa.refresh_token`:
|
|
52
|
+
```
|
|
53
|
+
.\alexa-cookie-cli\alexa-cookie-cli-win.exe -p amazon.com -b amazon.com -a en_US -L en-US # Windows
|
|
54
|
+
./alexa-cookie-cli/alexa-cookie-cli-linux -p amazon.com -b amazon.com -a en_US -L en-US # Linux
|
|
55
|
+
./alexa-cookie-cli/alexa-cookie-cli-macos -p amazon.com -b amazon.com -a en_US -L en-US # macOS
|
|
56
|
+
```
|
|
57
|
+
4. Run any command. The app swaps the refresh token for session cookies and an access token and caches both in `config/runtime_credentials.json`. Both are renewed automatically when they expire or the server rejects them.
|
|
58
|
+
|
|
59
|
+
## Command-line app
|
|
60
|
+
|
|
61
|
+
`ID` below is the 8-character ID shown by `list`; any unique start of it works. Run `pyalexaalerts COMMAND --help` for every option.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
pyalexaalerts devices # Echo devices
|
|
65
|
+
pyalexaalerts list # alarms (on), reminders, timers
|
|
66
|
+
pyalexaalerts list --all --type alarm # include switched-off alarms
|
|
67
|
+
pyalexaalerts list --type task # Alexa to-do items (add --all for done ones)
|
|
68
|
+
pyalexaalerts sounds -d bedroom # alarm sounds for a device
|
|
69
|
+
pyalexaalerts sounds -d bedroom --for timer # timer sounds (the current default is marked)
|
|
70
|
+
|
|
71
|
+
# alarms
|
|
72
|
+
pyalexaalerts alarm -d "Bedroom Echo" -t 6:45 -r weekdays
|
|
73
|
+
pyalexaalerts alarm -d bedroom -t 7:00 -r mon,wed,sun -s "Sonar"
|
|
74
|
+
pyalexaalerts alarm -d bedroom -t 9am -D 2026-12-25
|
|
75
|
+
pyalexaalerts alarm -d bedroom --in 8h --off # created switched off
|
|
76
|
+
pyalexaalerts off 1a2b3c4d # switch an alarm off, keep it (alias: disable)
|
|
77
|
+
pyalexaalerts on 1a2b3c4d # switch it back on (aliases: enable, start)
|
|
78
|
+
pyalexaalerts edit 1a2b3c4d -t 7:15 -r weekends -s "Simple Alarm"
|
|
79
|
+
|
|
80
|
+
# reminders
|
|
81
|
+
pyalexaalerts reminder -d kitchen --in 20m -m "Take the pizza out"
|
|
82
|
+
pyalexaalerts reminder -d kitchen -t 9pm -r tue,thu -m "Take out trash"
|
|
83
|
+
pyalexaalerts reminder -d kitchen -t 7pm -r monthly:2 -m "Give Bella her medicine"
|
|
84
|
+
pyalexaalerts reminder -d kitchen -t 8am -r daily -m "Take medicine" --keep-reminding --important
|
|
85
|
+
pyalexaalerts reminder -d kitchen -D 2026-12-10 -t 9am -m "Renew tags" -n "bring insurance card"
|
|
86
|
+
pyalexaalerts edit 5e6f7a8b -m "Bins out" -t 8pm
|
|
87
|
+
pyalexaalerts edit 5e6f7a8b -n "recycling too" --no-important --keep-reminding
|
|
88
|
+
pyalexaalerts edit 5e6f7a8b --next-only -t 9pm -m "Bins out late" # only the next occurrence
|
|
89
|
+
|
|
90
|
+
# timers
|
|
91
|
+
pyalexaalerts timer -d kitchen 10m
|
|
92
|
+
pyalexaalerts timer -d kitchen 1h30m -l pizza
|
|
93
|
+
pyalexaalerts pause 9f8e7d6c
|
|
94
|
+
pyalexaalerts resume 9f8e7d6c
|
|
95
|
+
pyalexaalerts add-time 9f8e7d6c 5m
|
|
96
|
+
pyalexaalerts subtract-time 9f8e7d6c 2m
|
|
97
|
+
|
|
98
|
+
# whatever is ringing right now
|
|
99
|
+
pyalexaalerts stop-alert -d bedroom # like "Alexa, stop"
|
|
100
|
+
pyalexaalerts snooze -d bedroom --for 5m # alarm or reminder, like "Alexa, snooze for 5 minutes"
|
|
101
|
+
|
|
102
|
+
# delete anything
|
|
103
|
+
pyalexaalerts delete 1a2b3c4d 5e6f7a8b # asks to confirm; -y to skip (aliases: rm, cancel)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`python -m pyalexaalerts ...` works too. Global options go **before** the command: `--config PATH`, `--domain amazon.co.uk`, `--host HOST`, `--person-id ID`, `-v`/`-vv` (logging).
|
|
107
|
+
|
|
108
|
+
- **Devices** match by serial number, then by exact name, then by a unique part of the name. Case is ignored.
|
|
109
|
+
- **When:** `-t` a time (`7:30`, `7:30pm`), optionally with `-D` a date (`2026-12-25`, `today`, `tomorrow`), or `--in` a duration (`20m`, `1h30m`). Times are the device's local time (see *Timezones* below).
|
|
110
|
+
- **Repeats** (`-r`): `daily`, `weekdays`, `weekends`, or any days like `mon,wed,sun` (full names work too). One alarm or reminder covers all the days. With a repeat and only a time, the first matching day is used. `-r none` clears a repeat when editing.
|
|
111
|
+
- **Monthly** (reminders only): `monthly:15`, or plain `monthly` for the day of the first occurrence, so `-D 2026-12-15 -r monthly` means the 15th of every month. `-D` works with monthly repeats but not with weekly ones.
|
|
112
|
+
- **Sounds:** a name or id from `sounds`. Built-in sounds work, including the celebrity ones.
|
|
113
|
+
|
|
114
|
+
## Programmatic usage
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import datetime
|
|
118
|
+
from pyalexaalerts import AlexaAlerts
|
|
119
|
+
|
|
120
|
+
alexa = AlexaAlerts() # or service_auth_path=..., person_id=...
|
|
121
|
+
alexa.resync()
|
|
122
|
+
|
|
123
|
+
for item in alexa.find("alarm"): # or "reminder", "timer"; "task" for to-do items
|
|
124
|
+
print(item)
|
|
125
|
+
|
|
126
|
+
alarm = alexa.createAlarm("Bedroom Echo", datetime.time(6, 45), recurrence="weekdays", sound="Sonar")
|
|
127
|
+
alexa.disable(alarm)
|
|
128
|
+
alexa.enable(alarm)
|
|
129
|
+
alexa.updateAlarm(alarm, when=datetime.time(7, 0))
|
|
130
|
+
|
|
131
|
+
rem = alexa.createReminder("Kitchen", datetime.timedelta(minutes=20), "Take the pizza out",
|
|
132
|
+
note="middle rack", important=True, keep_reminding=True)
|
|
133
|
+
alexa.updateReminder(rem, note=None, important=False)
|
|
134
|
+
|
|
135
|
+
timer = alexa.createTimer("Kitchen", datetime.timedelta(minutes=2), label="pizza") # None if it didn't appear
|
|
136
|
+
alexa.pause(timer)
|
|
137
|
+
alexa.resume(timer)
|
|
138
|
+
timer = alexa.adjustTimer(timer, datetime.timedelta(minutes=5)) # negative subtracts
|
|
139
|
+
|
|
140
|
+
alexa.stopAlert("Kitchen") # whatever is ringing; alexa.snooze("Bedroom") for alarms or reminders
|
|
141
|
+
alexa.delete(rem)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`when` takes a `datetime` (device-local), a `time` (next matching occurrence) or a `timedelta` (from now). `AlexaAPI` is the low-level client and returns raw dicts.
|
|
145
|
+
|
|
146
|
+
## Notes and limitations
|
|
147
|
+
|
|
148
|
+
### Alarms
|
|
149
|
+
- **`off` doesn't silence a ringing alarm.** It switches the alarm off for the future and keeps it; `on` switches it back on. Use `stop-alert` to silence one that's ringing.
|
|
150
|
+
- **`cancel` deletes**, as in "Alexa, cancel my alarm".
|
|
151
|
+
- **Two alarms can't share a time on one device**, and a repeating alarm counts on every matching day.
|
|
152
|
+
|
|
153
|
+
### Reminders
|
|
154
|
+
- **No on/off switch.** Delete them instead. Deleting a repeating reminder removes the whole series.
|
|
155
|
+
- **`edit --next-only`** changes just the next occurrence of a repeating reminder: `-t` keeps the day, `-D` keeps the time, and `-m` changes the text.
|
|
156
|
+
- **Monthly reminders repeat on one day of the month.**
|
|
157
|
+
- **Finished one-off reminders** show as DONE in `list --all` and are hidden from plain `list`.
|
|
158
|
+
- **To-do items** from your Alexa to-do list are hidden unless you ask for them: `list --type task` shows open ones, and `--all` adds done ones. They can only be listed, not created, edited or deleted.
|
|
159
|
+
- **Not supported:** choosing a reminder's sound, location-based reminders, reminders for other people, and announcements to all devices.
|
|
160
|
+
|
|
161
|
+
### Timers
|
|
162
|
+
- **`add-time` / `subtract-time` are silent.** They pause the timer with the new time left and resume it straight away. A paused timer stays paused. Each change adds about a second, because the timer stops counting for an instant. You can't subtract more than is left.
|
|
163
|
+
- **Not supported:** renaming a timer, or giving one its own sound (new timers use the device's default timer sound).
|
|
164
|
+
|
|
165
|
+
### Ringing alerts
|
|
166
|
+
- **`stop-alert` silences whatever is ringing**, and **`snooze`** snoozes a ringing alarm or reminder. A snoozed reminder shows as SNOOZED in `list` until it goes off again.
|
|
167
|
+
|
|
168
|
+
### Repeats and sounds
|
|
169
|
+
- **Repeats** can be daily, weekdays, weekends, specific days, or (reminders only) monthly on one day. Not supported: monthly alarms, every N weeks or months, "first Monday"-style rules, yearly, or end dates. Daily reminders are saved as weekly on all 7 days, which works the same.
|
|
170
|
+
- **Skill sounds** (e.g. Loud Buzzer) are refused, because choosing one was never seen in the app and some cost money. Timer-only sounds can't be used for alarms.
|
|
171
|
+
- **Device default sounds** for alarms and timers can be shown (`sounds`) but not changed.
|
|
172
|
+
|
|
173
|
+
### General
|
|
174
|
+
- **Timezones:** alarms send a local time and use the Echo's timezone. One-off reminders are converted using this computer's timezone, so it should match the Echo's.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"] # license = "MIT" + license-files (PEP 639)
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyalexaalerts"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "An unofficial Python library for programmatically managing Amazon Alexa alarms, timers, and reminders."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Kyron Longwood" }]
|
|
11
|
+
keywords = ["alexa", "amazon", "echo", "alarm", "reminder", "timer", "cli"]
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
dependencies = [
|
|
16
|
+
"requests",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"Environment :: Console",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Intended Audience :: End Users/Desktop",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Topic :: Home Automation",
|
|
30
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/kyrlon/pyalexaalerts"
|
|
35
|
+
Repository = "https://github.com/kyrlon/pyalexaalerts"
|
|
36
|
+
Issues = "https://github.com/kyrlon/pyalexaalerts/issues"
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
test = ["pytest"]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
pyalexaalerts = "pyalexaalerts.cli:main"
|
|
43
|
+
pyalexaalerts-get-cookies = "pyalexaalerts.get_alexa_cookies:cli"
|
|
44
|
+
pyalexaalerts-setup-cli = "pyalexaalerts.setup_alexa_cli:main"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["src"]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.dynamic]
|
|
50
|
+
version = { attr = "pyalexaalerts.__version__" }
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""An unofficial client for Amazon Alexa alarms, reminders and timers."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
from .api import AlexaAPI
|
|
6
|
+
from .exception import (
|
|
7
|
+
AlexaAPIError,
|
|
8
|
+
AlexaSessionExpiredException,
|
|
9
|
+
DeviceNotFoundException,
|
|
10
|
+
NotificationNotFoundException,
|
|
11
|
+
)
|
|
12
|
+
from .manager import AlexaAlerts
|
|
13
|
+
from .resource import Alarm, Device, Item, Kind, Recurrence, Reminder, Sound, Task, Timer
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"Alarm",
|
|
17
|
+
"AlexaAPI",
|
|
18
|
+
"AlexaAPIError",
|
|
19
|
+
"AlexaAlerts",
|
|
20
|
+
"AlexaSessionExpiredException",
|
|
21
|
+
"Device",
|
|
22
|
+
"DeviceNotFoundException",
|
|
23
|
+
"Item",
|
|
24
|
+
"Kind",
|
|
25
|
+
"NotificationNotFoundException",
|
|
26
|
+
"Recurrence",
|
|
27
|
+
"Reminder",
|
|
28
|
+
"Sound",
|
|
29
|
+
"Task",
|
|
30
|
+
"Timer",
|
|
31
|
+
]
|