49 lines
1.9 KiB
Markdown
49 lines
1.9 KiB
Markdown
# Homey Alert — sending ntfy notifications when tasks finish
|
|
|
|
Use `homey-alert` to push notifications to Aner's homelab ntfy server when long tasks complete.
|
|
|
|
## When to use proactively
|
|
|
|
When running (or suggesting) a command that will take more than ~30 seconds — training runs,
|
|
builds, deploys, downloads, test suites — append a notification automatically. Don't wait to
|
|
be asked.
|
|
|
|
## Local commands
|
|
|
|
Append after the command so it fires on success only (`&&`) or always (`;`):
|
|
|
|
```bash
|
|
# Notify on success only
|
|
long_cmd && homey-alert "Task done"
|
|
|
|
# Always notify (even on failure) — prefer this for deploys/training
|
|
long_cmd; homey-alert -t "Training" -p high -T "$([ $? -eq 0 ] && echo white_check_mark || echo x)" "Exited $?"
|
|
```
|
|
|
|
## Remote commands (SSH / training machines)
|
|
|
|
Remote machines don't have `homey-alert`. Use `-r`/`--print-remote` to get a self-contained
|
|
`curl` command with the token already embedded. The `$(...)` expands **locally**; the resulting
|
|
command string is what the remote machine executes.
|
|
|
|
```bash
|
|
ssh user@host "python train.py && $(homey-alert -r -t 'Training' -p high -T white_check_mark 'Model finished')"
|
|
```
|
|
|
|
The remote machine only needs `curl` (universally available).
|
|
|
|
## Flags
|
|
|
|
| Flag | Short | Values / notes |
|
|
|------|-------|----------------|
|
|
| `--title TITLE` | `-t` | Notification title |
|
|
| `--priority PRIO` | `-p` | `min` / `low` / `default` / `high` / `urgent` |
|
|
| `--tags TAGS` | `-T` | Comma-separated emoji shortcodes: `white_check_mark`, `x`, `warning`, `rotating_light`, `tada` |
|
|
| `--print-remote` | `-r` | Print curl command instead of running (embed token locally, run remotely) |
|
|
|
|
## Choosing priority and tags
|
|
|
|
- Routine completion (backup, build): `default` priority, `white_check_mark`
|
|
- Training / long job: `high` priority, `white_check_mark` on success / `x` on failure
|
|
- Something broke: `urgent` priority, `rotating_light`
|