pushraker 0.3.7__tar.gz → 0.4__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.
- pushraker-0.4/PKG-INFO +252 -0
- pushraker-0.4/README.md +231 -0
- {pushraker-0.3.7 → pushraker-0.4}/pyproject.toml +6 -3
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/__init__.py +1 -1
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/__main__.py +68 -18
- pushraker-0.4/src/pushraker/compat.py +179 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/component.py +760 -90
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/discord.py +4 -2
- pushraker-0.4/src/pushraker/discover.py +247 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/engine.py +89 -21
- pushraker-0.4/src/pushraker/gmeta.py +142 -0
- pushraker-0.4/src/pushraker/ntfy.py +128 -0
- pushraker-0.4/src/pushraker/preprint.py +141 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/printers/__init__.py +140 -2
- pushraker-0.4/src/pushraker/printers/creality.py +588 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/printers/snapmaker_u1.py +5 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/settings.py +427 -43
- pushraker-0.4/src/pushraker/thumbs.py +70 -0
- pushraker-0.4/src/pushraker/values.py +146 -0
- pushraker-0.4/src/pushraker/values_map.py +241 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/web/index.html +472 -56
- pushraker-0.4/src/pushraker.egg-info/PKG-INFO +252 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker.egg-info/SOURCES.txt +16 -1
- pushraker-0.4/src/pushraker.egg-info/requires.txt +4 -0
- pushraker-0.4/tests/test_creality_camera.py +653 -0
- pushraker-0.4/tests/test_discover.py +232 -0
- pushraker-0.4/tests/test_install.py +413 -0
- pushraker-0.4/tests/test_ntfy.py +153 -0
- pushraker-0.4/tests/test_preprint.py +110 -0
- {pushraker-0.3.7 → pushraker-0.4}/tests/test_pushraker.py +1650 -36
- {pushraker-0.3.7 → pushraker-0.4}/tests/test_settings.py +194 -7
- pushraker-0.4/tests/test_values.py +90 -0
- pushraker-0.3.7/PKG-INFO +0 -119
- pushraker-0.3.7/README.md +0 -98
- pushraker-0.3.7/src/pushraker.egg-info/PKG-INFO +0 -119
- pushraker-0.3.7/src/pushraker.egg-info/requires.txt +0 -4
- {pushraker-0.3.7 → pushraker-0.4}/LICENSE +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/setup.cfg +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/defaults.py +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/email_html.py +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/images.py +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/klipper/pushraker.cfg +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/bed_cooled.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/bed_cooled.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/calibration.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/calibration.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/cancelled.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/cancelled.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/chamber_fault.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/chamber_fault.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/chamber_reached.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/chamber_reached.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/chamber_waiting.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/chamber_waiting.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/complete.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/complete.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/driver_hot.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/driver_hot.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/error.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/error.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/filament_change.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/filament_change.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/filament_low.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/filament_low.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/filament_short.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/filament_short.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/first_layer.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/first_layer.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/layer_started.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/layer_started.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/macro.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/macro.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/paused.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/paused.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/power_loss.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/power_loss.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/preprint_done.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/preprint_done.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/progress.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/progress.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/resumed.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/resumed.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/shutdown.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/shutdown.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/slot_empty.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/slot_empty.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/spool_switch.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/spool_switch.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/started.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/started.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/status_report.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/status_report.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/warning.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templates/warning.title.j2 +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/templating.py +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker/web/sample-render.jpg +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker.egg-info/dependency_links.txt +0 -0
- {pushraker-0.3.7 → pushraker-0.4}/src/pushraker.egg-info/top_level.txt +0 -0
pushraker-0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pushraker
|
|
3
|
+
Version: 0.4
|
|
4
|
+
Summary: Push notifications for Klipper printers: a Moonraker component with pictures, sent through Apprise (ntfy, Pushover, Telegram, Discord, webhooks, email)
|
|
5
|
+
Author: noon92
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/noon92/pushraker
|
|
8
|
+
Project-URL: Issues, https://github.com/noon92/pushraker/issues
|
|
9
|
+
Keywords: klipper,moonraker,notifications,ntfy,apprise,3d-printing
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Topic :: System :: Monitoring
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: apprise>=1.2
|
|
17
|
+
Requires-Dist: requests
|
|
18
|
+
Requires-Dist: Pillow>=8.2
|
|
19
|
+
Requires-Dist: jinja2>=3.0
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# pushraker
|
|
23
|
+
|
|
24
|
+
Push notifications for Klipper printers, as a Moonraker component: print
|
|
25
|
+
started, paused, resumed, complete, cancelled, progress, first layer, faults
|
|
26
|
+
and shutdowns, power-loss recovery, chamber temperature, filament (Spoolman,
|
|
27
|
+
backup spools, MMUs), with pictures (camera snapshot, model preview, spool
|
|
28
|
+
drawings). Every notification's title, contents and image can be edited
|
|
29
|
+
on the page, as Jinja templates over Klipper's values and pushraker's own
|
|
30
|
+
(print job, toolheads, filament, queue). Sent through [Apprise](https://github.com/caronc/apprise): ntfy,
|
|
31
|
+
Pushover, Gotify, Telegram, Discord, a webhook, email. Configured from its
|
|
32
|
+
own web page, live, with no Moonraker or Klipper restart.
|
|
33
|
+
|
|
34
|
+
It grew out of the Push Notifications feature of the
|
|
35
|
+
[Snapmaker U1 Extended Firmware](https://github.com/paxx12-snapmaker-u1/SnapmakerU1-Extended-Firmware),
|
|
36
|
+
where it is built in. User documentation: the
|
|
37
|
+
[Push Notifications guide](docs/guide.md). Every template value:
|
|
38
|
+
[values](docs/values.md) ([by printer](docs/values-by-printer.md)). One
|
|
39
|
+
notification in a file, to share or to have an AI assistant write (with a
|
|
40
|
+
[prompt to paste](docs/notification-files.md#writing-one-with-an-ai-assistant)):
|
|
41
|
+
[notification files](docs/notification-files.md). Bringing it to another
|
|
42
|
+
printer: the [porting guide](docs/porting-guide.md).
|
|
43
|
+
|
|
44
|
+
## One package, many printers
|
|
45
|
+
|
|
46
|
+
- **Detection over configuration.** The same package runs on every
|
|
47
|
+
printer and works out what it can at start-up: Klipper's objects,
|
|
48
|
+
Moonraker's version and features, cameras (Moonraker's webcams and
|
|
49
|
+
camera servers it doesn't list), the printer's web pages, and what the
|
|
50
|
+
G-code files themselves say (render, estimate, layers, filament).
|
|
51
|
+
- **Printer profiles only where needed** (`src/pushraker/printers/`): for
|
|
52
|
+
what can't be detected, such as a vendor camera with no snapshot address,
|
|
53
|
+
the vendor's own fault codes and calibrations, the model name and the
|
|
54
|
+
web UI's address. Printers without a profile get the generic one.
|
|
55
|
+
- **Two install routes:** built into the Snapmaker U1 Extended Firmware;
|
|
56
|
+
or, on any Klipper printer with Moonraker, one command over SSH that
|
|
57
|
+
leaves the vendor's packages alone (below). pip works too.
|
|
58
|
+
|
|
59
|
+
### Compatibility
|
|
60
|
+
|
|
61
|
+
| | |
|
|
62
|
+
|---|---|
|
|
63
|
+
| **Tested** | Snapmaker U1 (Extended Firmware, built in); Creality Hi (stock firmware, SSH install) |
|
|
64
|
+
| **Expected to work, untested** | any Klipper + Moonraker printer whose Moonraker has the `job_state` component (Nov 2021 on), with Python 3.7+, apprise 1.2+, Jinja2 3.0+ and requests: what the generic profile gives (chart below) |
|
|
65
|
+
| **Not supported** | Moonraker without `job_state`; firmware without Moonraker |
|
|
66
|
+
|
|
67
|
+
Untested, reports welcome (what is known, not a promise):
|
|
68
|
+
- Creality K1 / K1 Max / older K1C: camera at `:8080/?action=snapshot`, found by discovery. K1C (2025 firmware) and K2: WebRTC only, like the Hi.
|
|
69
|
+
- Sovol SV08, QIDI Q1 Pro, Flashforge AD5M with Klipper Mod: a camera server on 8080 that Moonraker doesn't list, found by discovery.
|
|
70
|
+
- Elegoo Neptune 4: mjpg-streamer once set up (`/webcam/?action=snapshot`).
|
|
71
|
+
|
|
72
|
+
### Features by printer
|
|
73
|
+
|
|
74
|
+
| Feature | Snapmaker U1 | Creality Hi | Other Klipper printers |
|
|
75
|
+
|---|---|---|---|
|
|
76
|
+
| Print started/paused/resumed/complete/cancelled, progress, status reports, errors, Klipper shutdown, macros | ✅ | ✅ | ✅ |
|
|
77
|
+
| Camera picture | ✅ | ✅ live stream | ➖ ¹ |
|
|
78
|
+
| Live Camera link | ✅ | ✅ | ➖ ¹ |
|
|
79
|
+
| Render, time left and ETA | ✅ | ✅ | ✅ |
|
|
80
|
+
| Layers (first layer, layer complete) | ✅ | ✅ | ➖ ² |
|
|
81
|
+
| Pre-print calibrations | ✅ listed in Started, reported when done | ✅ reported when done | ➖ reported when done ³ |
|
|
82
|
+
| Bed cooled | ✅ | ✅ | ✅ (heated bed) |
|
|
83
|
+
| Chamber temperature, driver temperature | ✅ | ❌ no such hardware | ➖ ⁴ |
|
|
84
|
+
| Filament: toolhead map, backup spools, MMU slots | ✅ | ❌ | ❌ |
|
|
85
|
+
| Filament: Spoolman (not enough, running low) | ✅ | ➖ with Spoolman | ➖ with Spoolman |
|
|
86
|
+
| Coded warnings, touchscreen calibrations, power-loss recovery | ✅ | ❌ | ❌ |
|
|
87
|
+
| Print-end and cancel snapshots (print hooks) | ✅ | ❌ ⁵ | ➖ ⁵ |
|
|
88
|
+
| Excluded objects | ✅ | ✅ | ✅ |
|
|
89
|
+
| Printer URL default (web UI) | ✅ | ✅ Fluidd :4408 | ➖ ⁶ |
|
|
90
|
+
| Settings page | `/notifications/` | `:7125/server/pushraker/page` | `:7125/server/pushraker/page`, or an nginx alias |
|
|
91
|
+
|
|
92
|
+
¹ A Moonraker webcam with a snapshot, or a camera server discovery finds (8080/8081, `/webcam/`); none for WebRTC-only cameras without a profile.
|
|
93
|
+
² When the slicer writes `SET_PRINT_STATS_INFO`, or the Klipper fork counts layers (Creality's `virtual_sdcard.layer`).
|
|
94
|
+
³ Bed mesh, Z tilt, quad gantry level from stock Klipper's messages, when the printer has them.
|
|
95
|
+
⁴ Chamber: any `heater_generic`, a DragonBreath. Driver: TMC2240/TMC5160 on X/Y.
|
|
96
|
+
⁵ *Print complete* and *Cancelled* are sent from the print's end event; the hooks need `_PRINT_END_NTFY`/`_CANCEL_PRINT_NTFY` called from your macros.
|
|
97
|
+
⁶ Fill in offers the web pages found on the printer.
|
|
98
|
+
|
|
99
|
+
Full chart: [guide](docs/guide.md#features-by-printer).
|
|
100
|
+
|
|
101
|
+
**Status: 0.4.** The component has been in use on the Snapmaker U1 for a
|
|
102
|
+
while; the page, the settings file, the installer and the multi-printer
|
|
103
|
+
support are new. Notifications a printer can't produce start off and are
|
|
104
|
+
left off the page; turn one on in `pushraker.conf` and it shows on the
|
|
105
|
+
page and is sent like any other.
|
|
106
|
+
|
|
107
|
+
## Requirements
|
|
108
|
+
|
|
109
|
+
- Moonraker with its `job_state` component (upstream since November 2021;
|
|
110
|
+
the older flat `moonraker.py` layout is fine, as on the Creality Hi).
|
|
111
|
+
- The Python Moonraker runs with: 3.7 or newer with install.py (3.9 or
|
|
112
|
+
newer for `pip install`), with apprise 1.2 or newer, Jinja2 3.0 or newer
|
|
113
|
+
and requests. Pillow (8.2 or newer) is optional with install.py (pip
|
|
114
|
+
installs it): without it notifications go without spool pictures and
|
|
115
|
+
preview images.
|
|
116
|
+
|
|
117
|
+
## Install on a printer whose Moonraker came with its firmware (over SSH)
|
|
118
|
+
|
|
119
|
+
For printers like the Creality Hi, where Moonraker, its Python and nginx
|
|
120
|
+
belong to the firmware: log in over SSH and run
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
python3 -c "import urllib.request as u; exec(u.urlopen('https://raw.githubusercontent.com/noon92/pushraker/main/install.py').read())"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
It finds the running Moonraker, checks the requirements above (it never
|
|
127
|
+
adds, upgrades or removes a package of Moonraker's Python), downloads
|
|
128
|
+
pushraker from PyPI (sha256-checked), unpacks it next to Moonraker's data
|
|
129
|
+
folder (on the Hi: `/mnt/UDISK/pushraker-install`, marked as install.py's
|
|
130
|
+
own: it never deletes a folder it didn't make), adds one component file to
|
|
131
|
+
Moonraker's components folder and `[pushraker]` to `moonraker.conf`
|
|
132
|
+
(backed up first as `moonraker.conf.bak-pushraker`), restarts Moonraker
|
|
133
|
+
(never while printing), checks it loaded, and prints the settings page's
|
|
134
|
+
address: `http://<printer>:7125/server/pushraker/page`, served by Moonraker
|
|
135
|
+
itself, so no web server change is needed (through the printer's own web
|
|
136
|
+
interface's port only where its web server is set up for it, as below). Klipper's config is left alone
|
|
137
|
+
(`--klipper` adds the print-end snapshot macros).
|
|
138
|
+
|
|
139
|
+
Run the same command again to update, or after a firmware update removed
|
|
140
|
+
it: the settings are kept. Options go after the command
|
|
141
|
+
(`python3 -c "..." --uninstall`): `--uninstall` (also when Moonraker no
|
|
142
|
+
longer starts; `--purge` also removes the settings), `--version X`, `--wheel FILE`, `--name`, `--no-restart`;
|
|
143
|
+
`python3 install.py --help` lists them all.
|
|
144
|
+
|
|
145
|
+
### On the Creality Hi
|
|
146
|
+
|
|
147
|
+
The command above, over SSH as root. It puts one file in
|
|
148
|
+
`/usr/share/moonraker/components/` and `[pushraker]` in
|
|
149
|
+
`/usr/share/moonraker/moonraker.conf` (backed up first); pushraker itself
|
|
150
|
+
goes in `/mnt/UDISK/pushraker-install`, the settings in
|
|
151
|
+
`/mnt/UDISK/printer_data/config/pushraker.conf`. Settings page:
|
|
152
|
+
`http://<printer>:7125/server/pushraker/page`.
|
|
153
|
+
|
|
154
|
+
A firmware update removes the first two: run the command again; the
|
|
155
|
+
settings stay. On the Hi, pushraker works with Creality's older Moonraker
|
|
156
|
+
and Apprise, reads the render, estimate and filament from the G-code
|
|
157
|
+
files themselves, takes layers from Creality's own count, and takes
|
|
158
|
+
camera pictures from the Hi's camera through the firmware's ffmpeg. See
|
|
159
|
+
the [guide](docs/guide.md#creality-hi).
|
|
160
|
+
|
|
161
|
+
## Install (any Moonraker printer)
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
pip install pushraker # into the Python Moonraker runs with
|
|
165
|
+
python -m pushraker install # ~/moonraker and ~/printer_data by default
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`install` puts a one-file shim into Moonraker's `components/` folder, adds
|
|
169
|
+
`[pushraker]` to `moonraker.conf`, and includes the Klipper macro file
|
|
170
|
+
from `printer.cfg` (`--no-klipper` skips it). Restart Moonraker and
|
|
171
|
+
Klipper; pushraker writes `printer_data/config/pushraker.conf` at its
|
|
172
|
+
first start. Open `http://<printer>:7125/server/pushraker/page`.
|
|
173
|
+
Optionally, serve the page from the nginx that serves Fluidd or Mainsail
|
|
174
|
+
too (`src/pushraker/web/index.html`, or `python -c "import pushraker, os;
|
|
175
|
+
print(os.path.dirname(pushraker.__file__) + '/web')"`), e.g.
|
|
176
|
+
|
|
177
|
+
```nginx
|
|
178
|
+
location /notifications/ {
|
|
179
|
+
alias /path/to/site-packages/pushraker/web/;
|
|
180
|
+
index index.html;
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
and open `http://<printer>/notifications/`. The page talks to Moonraker
|
|
185
|
+
through the `/server/` proxy of that nginx; without one it falls back to
|
|
186
|
+
Moonraker's own port, which needs the page's origin in `cors_domains`
|
|
187
|
+
under `[authorization]` in `moonraker.conf`. With Moonraker's
|
|
188
|
+
authorization on, the page asks for an API key the first time.
|
|
189
|
+
|
|
190
|
+
Call `_PRINT_END_NTFY` at the start of your `PRINT_END` macro and
|
|
191
|
+
`_CANCEL_PRINT_NTFY` at the start of `CANCEL_PRINT` for the print-end and
|
|
192
|
+
cancel snapshots to be taken before the printer parks (the Snapmaker U1
|
|
193
|
+
extended firmware does that through its hook system).
|
|
194
|
+
|
|
195
|
+
`python -m pushraker install --help` lists the paths and options (include
|
|
196
|
+
directories, the printer's default name, the error-code index link, moving
|
|
197
|
+
settings over from an INI section). `python -m pushraker uninstall` takes
|
|
198
|
+
it out again; `--purge` also removes the settings and secrets.
|
|
199
|
+
|
|
200
|
+
## Where things live on the printer
|
|
201
|
+
|
|
202
|
+
- `printer_data/config/pushraker.conf`: the settings, a plain INI file
|
|
203
|
+
(also editable by hand; the component re-reads it when it changes).
|
|
204
|
+
- `printer_data/pushraker.secrets`: tokens and passwords, mode 0600,
|
|
205
|
+
outside the config folder so Moonraker never serves it.
|
|
206
|
+
- Moonraker endpoints: `GET /server/pushraker/page` (the settings page),
|
|
207
|
+
`GET/POST /server/pushraker/config`, `POST /server/pushraker/test`,
|
|
208
|
+
`GET /server/pushraker/status`, `POST /server/pushraker/backup`, and the
|
|
209
|
+
page's helpers (`objects`, `preview`, `preview_image`, `codemirror`,
|
|
210
|
+
`codemirror_js`); all but the page also under
|
|
211
|
+
`/server/push_notifications/`, the 0.1 names.
|
|
212
|
+
|
|
213
|
+
## Layout
|
|
214
|
+
|
|
215
|
+
- `src/pushraker/component.py` — the Moonraker component
|
|
216
|
+
- `src/pushraker/settings.py` — the settings: validation, storage, the
|
|
217
|
+
Apprise URLs built from them
|
|
218
|
+
- `src/pushraker/printers/` — what differs between printers, one module
|
|
219
|
+
per printer: `snapmaker_u1.py`, `creality.py` (the Creality Hi); the
|
|
220
|
+
generic `Printer` in `__init__.py`
|
|
221
|
+
- `src/pushraker/compat.py` — older Moonraker versions
|
|
222
|
+
- `src/pushraker/discover.py` — camera servers and web pages on the printer
|
|
223
|
+
- `src/pushraker/preprint.py` — pre-print calibrations from stock Klipper
|
|
224
|
+
- `src/pushraker/gmeta.py`, `src/pushraker/thumbs.py` — estimate, layers,
|
|
225
|
+
filament and the render from the G-code file itself
|
|
226
|
+
- `src/pushraker/ntfy.py` — ntfy with an access token on Apprise versions
|
|
227
|
+
that can't send one
|
|
228
|
+
- `src/pushraker/values.py`, `values_map.py` — the values a template uses,
|
|
229
|
+
and which printers have them (`values_map.py` and `docs/values*.md` are
|
|
230
|
+
generated by `tests/gen_values.py`)
|
|
231
|
+
- `src/pushraker/images.py` — spool pictures (Pillow)
|
|
232
|
+
- `src/pushraker/email_html.py`, `src/pushraker/discord.py` — email card,
|
|
233
|
+
Discord senders
|
|
234
|
+
- `src/pushraker/web/index.html` — the settings page
|
|
235
|
+
- `src/pushraker/klipper/pushraker.cfg` — the Klipper macro file
|
|
236
|
+
- `src/pushraker/__main__.py` — `python -m pushraker install|uninstall|status`
|
|
237
|
+
- `install.py` — the one-line install over SSH (standard library only; not
|
|
238
|
+
part of the package)
|
|
239
|
+
- `docs/guide.md` — the user guide
|
|
240
|
+
- `docs/porting-guide.md` — bringing pushraker to another printer
|
|
241
|
+
- `tests/` — `python tests/test_pushraker.py` (the component against a
|
|
242
|
+
stand-in Moonraker; also runs `test_settings.py`)
|
|
243
|
+
- `tests/test_install.py` — install.py against a fake `/proc` (also run by
|
|
244
|
+
`test_pushraker.py`)
|
|
245
|
+
- `tests/check_deps.py` — whether pushraker works with the Apprise, Pillow and
|
|
246
|
+
Jinja2 of a printer's Python, without sending anything: copy it and the
|
|
247
|
+
package to the printer and run `<Moonraker's python> check_deps.py <dir
|
|
248
|
+
holding pushraker/>`
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
GPL-3.0-or-later.
|
pushraker-0.4/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# pushraker
|
|
2
|
+
|
|
3
|
+
Push notifications for Klipper printers, as a Moonraker component: print
|
|
4
|
+
started, paused, resumed, complete, cancelled, progress, first layer, faults
|
|
5
|
+
and shutdowns, power-loss recovery, chamber temperature, filament (Spoolman,
|
|
6
|
+
backup spools, MMUs), with pictures (camera snapshot, model preview, spool
|
|
7
|
+
drawings). Every notification's title, contents and image can be edited
|
|
8
|
+
on the page, as Jinja templates over Klipper's values and pushraker's own
|
|
9
|
+
(print job, toolheads, filament, queue). Sent through [Apprise](https://github.com/caronc/apprise): ntfy,
|
|
10
|
+
Pushover, Gotify, Telegram, Discord, a webhook, email. Configured from its
|
|
11
|
+
own web page, live, with no Moonraker or Klipper restart.
|
|
12
|
+
|
|
13
|
+
It grew out of the Push Notifications feature of the
|
|
14
|
+
[Snapmaker U1 Extended Firmware](https://github.com/paxx12-snapmaker-u1/SnapmakerU1-Extended-Firmware),
|
|
15
|
+
where it is built in. User documentation: the
|
|
16
|
+
[Push Notifications guide](docs/guide.md). Every template value:
|
|
17
|
+
[values](docs/values.md) ([by printer](docs/values-by-printer.md)). One
|
|
18
|
+
notification in a file, to share or to have an AI assistant write (with a
|
|
19
|
+
[prompt to paste](docs/notification-files.md#writing-one-with-an-ai-assistant)):
|
|
20
|
+
[notification files](docs/notification-files.md). Bringing it to another
|
|
21
|
+
printer: the [porting guide](docs/porting-guide.md).
|
|
22
|
+
|
|
23
|
+
## One package, many printers
|
|
24
|
+
|
|
25
|
+
- **Detection over configuration.** The same package runs on every
|
|
26
|
+
printer and works out what it can at start-up: Klipper's objects,
|
|
27
|
+
Moonraker's version and features, cameras (Moonraker's webcams and
|
|
28
|
+
camera servers it doesn't list), the printer's web pages, and what the
|
|
29
|
+
G-code files themselves say (render, estimate, layers, filament).
|
|
30
|
+
- **Printer profiles only where needed** (`src/pushraker/printers/`): for
|
|
31
|
+
what can't be detected, such as a vendor camera with no snapshot address,
|
|
32
|
+
the vendor's own fault codes and calibrations, the model name and the
|
|
33
|
+
web UI's address. Printers without a profile get the generic one.
|
|
34
|
+
- **Two install routes:** built into the Snapmaker U1 Extended Firmware;
|
|
35
|
+
or, on any Klipper printer with Moonraker, one command over SSH that
|
|
36
|
+
leaves the vendor's packages alone (below). pip works too.
|
|
37
|
+
|
|
38
|
+
### Compatibility
|
|
39
|
+
|
|
40
|
+
| | |
|
|
41
|
+
|---|---|
|
|
42
|
+
| **Tested** | Snapmaker U1 (Extended Firmware, built in); Creality Hi (stock firmware, SSH install) |
|
|
43
|
+
| **Expected to work, untested** | any Klipper + Moonraker printer whose Moonraker has the `job_state` component (Nov 2021 on), with Python 3.7+, apprise 1.2+, Jinja2 3.0+ and requests: what the generic profile gives (chart below) |
|
|
44
|
+
| **Not supported** | Moonraker without `job_state`; firmware without Moonraker |
|
|
45
|
+
|
|
46
|
+
Untested, reports welcome (what is known, not a promise):
|
|
47
|
+
- Creality K1 / K1 Max / older K1C: camera at `:8080/?action=snapshot`, found by discovery. K1C (2025 firmware) and K2: WebRTC only, like the Hi.
|
|
48
|
+
- Sovol SV08, QIDI Q1 Pro, Flashforge AD5M with Klipper Mod: a camera server on 8080 that Moonraker doesn't list, found by discovery.
|
|
49
|
+
- Elegoo Neptune 4: mjpg-streamer once set up (`/webcam/?action=snapshot`).
|
|
50
|
+
|
|
51
|
+
### Features by printer
|
|
52
|
+
|
|
53
|
+
| Feature | Snapmaker U1 | Creality Hi | Other Klipper printers |
|
|
54
|
+
|---|---|---|---|
|
|
55
|
+
| Print started/paused/resumed/complete/cancelled, progress, status reports, errors, Klipper shutdown, macros | ✅ | ✅ | ✅ |
|
|
56
|
+
| Camera picture | ✅ | ✅ live stream | ➖ ¹ |
|
|
57
|
+
| Live Camera link | ✅ | ✅ | ➖ ¹ |
|
|
58
|
+
| Render, time left and ETA | ✅ | ✅ | ✅ |
|
|
59
|
+
| Layers (first layer, layer complete) | ✅ | ✅ | ➖ ² |
|
|
60
|
+
| Pre-print calibrations | ✅ listed in Started, reported when done | ✅ reported when done | ➖ reported when done ³ |
|
|
61
|
+
| Bed cooled | ✅ | ✅ | ✅ (heated bed) |
|
|
62
|
+
| Chamber temperature, driver temperature | ✅ | ❌ no such hardware | ➖ ⁴ |
|
|
63
|
+
| Filament: toolhead map, backup spools, MMU slots | ✅ | ❌ | ❌ |
|
|
64
|
+
| Filament: Spoolman (not enough, running low) | ✅ | ➖ with Spoolman | ➖ with Spoolman |
|
|
65
|
+
| Coded warnings, touchscreen calibrations, power-loss recovery | ✅ | ❌ | ❌ |
|
|
66
|
+
| Print-end and cancel snapshots (print hooks) | ✅ | ❌ ⁵ | ➖ ⁵ |
|
|
67
|
+
| Excluded objects | ✅ | ✅ | ✅ |
|
|
68
|
+
| Printer URL default (web UI) | ✅ | ✅ Fluidd :4408 | ➖ ⁶ |
|
|
69
|
+
| Settings page | `/notifications/` | `:7125/server/pushraker/page` | `:7125/server/pushraker/page`, or an nginx alias |
|
|
70
|
+
|
|
71
|
+
¹ A Moonraker webcam with a snapshot, or a camera server discovery finds (8080/8081, `/webcam/`); none for WebRTC-only cameras without a profile.
|
|
72
|
+
² When the slicer writes `SET_PRINT_STATS_INFO`, or the Klipper fork counts layers (Creality's `virtual_sdcard.layer`).
|
|
73
|
+
³ Bed mesh, Z tilt, quad gantry level from stock Klipper's messages, when the printer has them.
|
|
74
|
+
⁴ Chamber: any `heater_generic`, a DragonBreath. Driver: TMC2240/TMC5160 on X/Y.
|
|
75
|
+
⁵ *Print complete* and *Cancelled* are sent from the print's end event; the hooks need `_PRINT_END_NTFY`/`_CANCEL_PRINT_NTFY` called from your macros.
|
|
76
|
+
⁶ Fill in offers the web pages found on the printer.
|
|
77
|
+
|
|
78
|
+
Full chart: [guide](docs/guide.md#features-by-printer).
|
|
79
|
+
|
|
80
|
+
**Status: 0.4.** The component has been in use on the Snapmaker U1 for a
|
|
81
|
+
while; the page, the settings file, the installer and the multi-printer
|
|
82
|
+
support are new. Notifications a printer can't produce start off and are
|
|
83
|
+
left off the page; turn one on in `pushraker.conf` and it shows on the
|
|
84
|
+
page and is sent like any other.
|
|
85
|
+
|
|
86
|
+
## Requirements
|
|
87
|
+
|
|
88
|
+
- Moonraker with its `job_state` component (upstream since November 2021;
|
|
89
|
+
the older flat `moonraker.py` layout is fine, as on the Creality Hi).
|
|
90
|
+
- The Python Moonraker runs with: 3.7 or newer with install.py (3.9 or
|
|
91
|
+
newer for `pip install`), with apprise 1.2 or newer, Jinja2 3.0 or newer
|
|
92
|
+
and requests. Pillow (8.2 or newer) is optional with install.py (pip
|
|
93
|
+
installs it): without it notifications go without spool pictures and
|
|
94
|
+
preview images.
|
|
95
|
+
|
|
96
|
+
## Install on a printer whose Moonraker came with its firmware (over SSH)
|
|
97
|
+
|
|
98
|
+
For printers like the Creality Hi, where Moonraker, its Python and nginx
|
|
99
|
+
belong to the firmware: log in over SSH and run
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
python3 -c "import urllib.request as u; exec(u.urlopen('https://raw.githubusercontent.com/noon92/pushraker/main/install.py').read())"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
It finds the running Moonraker, checks the requirements above (it never
|
|
106
|
+
adds, upgrades or removes a package of Moonraker's Python), downloads
|
|
107
|
+
pushraker from PyPI (sha256-checked), unpacks it next to Moonraker's data
|
|
108
|
+
folder (on the Hi: `/mnt/UDISK/pushraker-install`, marked as install.py's
|
|
109
|
+
own: it never deletes a folder it didn't make), adds one component file to
|
|
110
|
+
Moonraker's components folder and `[pushraker]` to `moonraker.conf`
|
|
111
|
+
(backed up first as `moonraker.conf.bak-pushraker`), restarts Moonraker
|
|
112
|
+
(never while printing), checks it loaded, and prints the settings page's
|
|
113
|
+
address: `http://<printer>:7125/server/pushraker/page`, served by Moonraker
|
|
114
|
+
itself, so no web server change is needed (through the printer's own web
|
|
115
|
+
interface's port only where its web server is set up for it, as below). Klipper's config is left alone
|
|
116
|
+
(`--klipper` adds the print-end snapshot macros).
|
|
117
|
+
|
|
118
|
+
Run the same command again to update, or after a firmware update removed
|
|
119
|
+
it: the settings are kept. Options go after the command
|
|
120
|
+
(`python3 -c "..." --uninstall`): `--uninstall` (also when Moonraker no
|
|
121
|
+
longer starts; `--purge` also removes the settings), `--version X`, `--wheel FILE`, `--name`, `--no-restart`;
|
|
122
|
+
`python3 install.py --help` lists them all.
|
|
123
|
+
|
|
124
|
+
### On the Creality Hi
|
|
125
|
+
|
|
126
|
+
The command above, over SSH as root. It puts one file in
|
|
127
|
+
`/usr/share/moonraker/components/` and `[pushraker]` in
|
|
128
|
+
`/usr/share/moonraker/moonraker.conf` (backed up first); pushraker itself
|
|
129
|
+
goes in `/mnt/UDISK/pushraker-install`, the settings in
|
|
130
|
+
`/mnt/UDISK/printer_data/config/pushraker.conf`. Settings page:
|
|
131
|
+
`http://<printer>:7125/server/pushraker/page`.
|
|
132
|
+
|
|
133
|
+
A firmware update removes the first two: run the command again; the
|
|
134
|
+
settings stay. On the Hi, pushraker works with Creality's older Moonraker
|
|
135
|
+
and Apprise, reads the render, estimate and filament from the G-code
|
|
136
|
+
files themselves, takes layers from Creality's own count, and takes
|
|
137
|
+
camera pictures from the Hi's camera through the firmware's ffmpeg. See
|
|
138
|
+
the [guide](docs/guide.md#creality-hi).
|
|
139
|
+
|
|
140
|
+
## Install (any Moonraker printer)
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
pip install pushraker # into the Python Moonraker runs with
|
|
144
|
+
python -m pushraker install # ~/moonraker and ~/printer_data by default
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`install` puts a one-file shim into Moonraker's `components/` folder, adds
|
|
148
|
+
`[pushraker]` to `moonraker.conf`, and includes the Klipper macro file
|
|
149
|
+
from `printer.cfg` (`--no-klipper` skips it). Restart Moonraker and
|
|
150
|
+
Klipper; pushraker writes `printer_data/config/pushraker.conf` at its
|
|
151
|
+
first start. Open `http://<printer>:7125/server/pushraker/page`.
|
|
152
|
+
Optionally, serve the page from the nginx that serves Fluidd or Mainsail
|
|
153
|
+
too (`src/pushraker/web/index.html`, or `python -c "import pushraker, os;
|
|
154
|
+
print(os.path.dirname(pushraker.__file__) + '/web')"`), e.g.
|
|
155
|
+
|
|
156
|
+
```nginx
|
|
157
|
+
location /notifications/ {
|
|
158
|
+
alias /path/to/site-packages/pushraker/web/;
|
|
159
|
+
index index.html;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
and open `http://<printer>/notifications/`. The page talks to Moonraker
|
|
164
|
+
through the `/server/` proxy of that nginx; without one it falls back to
|
|
165
|
+
Moonraker's own port, which needs the page's origin in `cors_domains`
|
|
166
|
+
under `[authorization]` in `moonraker.conf`. With Moonraker's
|
|
167
|
+
authorization on, the page asks for an API key the first time.
|
|
168
|
+
|
|
169
|
+
Call `_PRINT_END_NTFY` at the start of your `PRINT_END` macro and
|
|
170
|
+
`_CANCEL_PRINT_NTFY` at the start of `CANCEL_PRINT` for the print-end and
|
|
171
|
+
cancel snapshots to be taken before the printer parks (the Snapmaker U1
|
|
172
|
+
extended firmware does that through its hook system).
|
|
173
|
+
|
|
174
|
+
`python -m pushraker install --help` lists the paths and options (include
|
|
175
|
+
directories, the printer's default name, the error-code index link, moving
|
|
176
|
+
settings over from an INI section). `python -m pushraker uninstall` takes
|
|
177
|
+
it out again; `--purge` also removes the settings and secrets.
|
|
178
|
+
|
|
179
|
+
## Where things live on the printer
|
|
180
|
+
|
|
181
|
+
- `printer_data/config/pushraker.conf`: the settings, a plain INI file
|
|
182
|
+
(also editable by hand; the component re-reads it when it changes).
|
|
183
|
+
- `printer_data/pushraker.secrets`: tokens and passwords, mode 0600,
|
|
184
|
+
outside the config folder so Moonraker never serves it.
|
|
185
|
+
- Moonraker endpoints: `GET /server/pushraker/page` (the settings page),
|
|
186
|
+
`GET/POST /server/pushraker/config`, `POST /server/pushraker/test`,
|
|
187
|
+
`GET /server/pushraker/status`, `POST /server/pushraker/backup`, and the
|
|
188
|
+
page's helpers (`objects`, `preview`, `preview_image`, `codemirror`,
|
|
189
|
+
`codemirror_js`); all but the page also under
|
|
190
|
+
`/server/push_notifications/`, the 0.1 names.
|
|
191
|
+
|
|
192
|
+
## Layout
|
|
193
|
+
|
|
194
|
+
- `src/pushraker/component.py` — the Moonraker component
|
|
195
|
+
- `src/pushraker/settings.py` — the settings: validation, storage, the
|
|
196
|
+
Apprise URLs built from them
|
|
197
|
+
- `src/pushraker/printers/` — what differs between printers, one module
|
|
198
|
+
per printer: `snapmaker_u1.py`, `creality.py` (the Creality Hi); the
|
|
199
|
+
generic `Printer` in `__init__.py`
|
|
200
|
+
- `src/pushraker/compat.py` — older Moonraker versions
|
|
201
|
+
- `src/pushraker/discover.py` — camera servers and web pages on the printer
|
|
202
|
+
- `src/pushraker/preprint.py` — pre-print calibrations from stock Klipper
|
|
203
|
+
- `src/pushraker/gmeta.py`, `src/pushraker/thumbs.py` — estimate, layers,
|
|
204
|
+
filament and the render from the G-code file itself
|
|
205
|
+
- `src/pushraker/ntfy.py` — ntfy with an access token on Apprise versions
|
|
206
|
+
that can't send one
|
|
207
|
+
- `src/pushraker/values.py`, `values_map.py` — the values a template uses,
|
|
208
|
+
and which printers have them (`values_map.py` and `docs/values*.md` are
|
|
209
|
+
generated by `tests/gen_values.py`)
|
|
210
|
+
- `src/pushraker/images.py` — spool pictures (Pillow)
|
|
211
|
+
- `src/pushraker/email_html.py`, `src/pushraker/discord.py` — email card,
|
|
212
|
+
Discord senders
|
|
213
|
+
- `src/pushraker/web/index.html` — the settings page
|
|
214
|
+
- `src/pushraker/klipper/pushraker.cfg` — the Klipper macro file
|
|
215
|
+
- `src/pushraker/__main__.py` — `python -m pushraker install|uninstall|status`
|
|
216
|
+
- `install.py` — the one-line install over SSH (standard library only; not
|
|
217
|
+
part of the package)
|
|
218
|
+
- `docs/guide.md` — the user guide
|
|
219
|
+
- `docs/porting-guide.md` — bringing pushraker to another printer
|
|
220
|
+
- `tests/` — `python tests/test_pushraker.py` (the component against a
|
|
221
|
+
stand-in Moonraker; also runs `test_settings.py`)
|
|
222
|
+
- `tests/test_install.py` — install.py against a fake `/proc` (also run by
|
|
223
|
+
`test_pushraker.py`)
|
|
224
|
+
- `tests/check_deps.py` — whether pushraker works with the Apprise, Pillow and
|
|
225
|
+
Jinja2 of a printer's Python, without sending anything: copy it and the
|
|
226
|
+
package to the printer and run `<Moonraker's python> check_deps.py <dir
|
|
227
|
+
holding pushraker/>`
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
GPL-3.0-or-later.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pushraker"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4"
|
|
8
8
|
description = "Push notifications for Klipper printers: a Moonraker component with pictures, sent through Apprise (ntfy, Pushover, Telegram, Discord, webhooks, email)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "GPL-3.0-or-later"
|
|
@@ -17,10 +17,13 @@ classifiers = [
|
|
|
17
17
|
"Operating System :: POSIX :: Linux",
|
|
18
18
|
"Topic :: System :: Monitoring",
|
|
19
19
|
]
|
|
20
|
+
# The lowest versions checked (tests/check_deps.py): those of the Creality
|
|
21
|
+
# Hi's stock Moonraker (apprise 1.2.0, Pillow 8.2.0, Jinja2 3.1.2), which
|
|
22
|
+
# pushraker must not upgrade
|
|
20
23
|
dependencies = [
|
|
21
|
-
"apprise>=1.
|
|
24
|
+
"apprise>=1.2",
|
|
22
25
|
"requests",
|
|
23
|
-
"Pillow>=
|
|
26
|
+
"Pillow>=8.2",
|
|
24
27
|
"jinja2>=3.0",
|
|
25
28
|
]
|
|
26
29
|
|