Files
mop-skills/skills/brother-printer/SKILL.md
T

108 lines
4.7 KiB
Markdown

---
name: brother-printer
description: Print PDF documents, text, and files directly to the Brother HL-L8240CDW duplex color laser printer at Grabengasse 7 (192.168.10.91). Handles interactive Telegram print options (Color/B&W, Pages per Sheet / N-Up, Duplex/Simplex) and live-updating Telegram status messages.
---
# 🖨️ Brother HL-L8240CDW Laser Printer
Direct network printing to the **Brother HL-L8240CDW** duplex color laser printer on the home network (`192.168.10.91:631`) via IPP Everywhere.
## 🎯 When to Use
- Whenever the user asks to print something: *"Bitte drucke XY"*, *"Druck das bitte aus"*, *"Kannst du das drucken?"*.
- Whenever the user sends a PDF, image, document, or ticket on Telegram with a request to print.
- Whenever the user asks to print recipes, shopping lists, flight tickets, packing lists, or notes.
- Whenever the user asks for printer status or toner levels: *"Wie viel Toner ist noch im Drucker?"*, *"Ist der Drucker online?"*.
---
## 🕹️ Interactive Telegram Options Protocol (CRITICAL)
When the user requests a print (e.g. *"Bitte drucke die Rechnung"* or sends a PDF), **DO NOT print blindly immediately**.
Provide an interactive decision prompt on Telegram using the `ask_user` tool with pre-configured defaults:
### Fast-Path Preset Menu via `ask_user`
Call `ask_user` with:
- `id`: `"print_options"`
- `header`: `"Drucker"`
- `question`: `"Wie möchtest du das Dokument drucken?"`
- `options`:
1. `label`: `"🌱 Spar-Druck: S/W, 2 Seiten, Duplex (Recommended)"`
`description`: `"Schwarz-Weiß, 2 Seiten pro Blatt, beidseitig (spart Papier)"`
*(Maps to: `--color monochrome --nup 2 --duplex two-sided-long-edge`)*
2. `label`: `"📄 Standard: S/W, 1 Seite, Duplex"`
`description`: `"Schwarz-Weiß, 1 Seite pro Blatt, beidseitig"`
*(Maps to: `--color monochrome --nup 1 --duplex two-sided-long-edge`)*
3. `label`: `"🎨 Vollfarbe: 1 Seite, Duplex"`
`description`: `"Farbdruck, 1 Seite pro Blatt, beidseitig"`
*(Maps to: `--color color --nup 1 --duplex two-sided-long-edge`)*
4. `label`: `"📄 Einseitig (Simplex): S/W, 1 Seite"`
`description`: `"Schwarz-Weiß, 1 Seite pro Blatt, nur Vorderseite"`
*(Maps to: `--color monochrome --nup 1 --duplex one-sided`)*
> [!TIP]
> If the user specifically asks for custom parameters (e.g. *"Druck das in Farbe auf 2 Seiten"*), parse the options directly and run without extra prompt.
---
## 🚀 Execution & Live Telegram Status Updates
Execute the bundled driver script with `uv run`.
Always pass `--chat-id <chat_id>` so the script automatically creates and live-updates a single Telegram message (`⏳ Bereite vor...` ➔ `📡 Sende an Drucker...` ➔ `🖨️ Druckt...` ➔ `✅ Erfolgreich gedruckt!`):
### 1. Print a PDF file with selected options
```bash
uv run /home/node/mop-skills/mop-skills/skills/brother-printer/scripts/brother_printer.py print \
--file "/home/node/.openclaw/workspace/document.pdf" \
--color monochrome \
--nup 2 \
--duplex two-sided-long-edge \
--chat-id "306373425"
```
### 2. Print a document from a URL
```bash
uv run /home/node/mop-skills/mop-skills/skills/brother-printer/scripts/brother_printer.py print \
--url "https://example.com/ticket.pdf" \
--title "Konzertticket" \
--color color \
--nup 1 \
--duplex two-sided-long-edge \
--chat-id "306373425"
```
### 3. Print plain text or notes
```bash
uv run /home/node/mop-skills/mop-skills/skills/brother-printer/scripts/brother_printer.py print \
--text "Einkaufsliste für Samstag:\n- Hafermilch\n- Kaffee\n- Bananen" \
--title "Einkaufszettel" \
--color monochrome \
--nup 1 \
--duplex one-sided \
--chat-id "306373425"
```
### 4. Check status & toner levels
```bash
uv run /home/node/mop-skills/mop-skills/skills/brother-printer/scripts/brother_printer.py status
```
---
## ⚙️ CLI Options Reference
| Argument | Values / Type | Default | Description |
|---|---|---|---|
| `--file` | File path | None | Local PDF path to print |
| `--url` | URL string | None | Download and print PDF from web |
| `--text` | String | None | Text content to format as A4 PDF and print |
| `--title` | String | Basename | Document title for print queue and Telegram header |
| `--color` | `monochrome`, `color` | `monochrome` | Print color mode |
| `--nup` | `1`, `2`, `4` | `1` | Hardware pages per sheet (1 = normal, 2 = 2 pages/sheet) |
| `--duplex` | `two-sided-long-edge`, `one-sided`, `two-sided-short-edge` | `two-sided-long-edge` | Duplex binding mode |
| `--copies` | Integer | `1` | Number of printed copies |
| `--chat-id` | Telegram Chat ID | None | Target chat ID for live status updates |
| `--max-pages`| Integer | `30` | Safety limit to prevent runaway printing |
| `--force` | Flag | `false` | Bypass page limit |