# POS-Automation Context ## Overview POS-only daily news briefing for the **Epson TM-m30** receipt printer. Fetches unread articles from FreshRSS, selects and summarizes them via Ollama, then sends a native ESC/POS receipt over TCP to the printer. No PDF generation, no CUPS, no full-size printer support. Forked from `Seth/PrinterAutomation` on Gitea. ## Components - `pos_briefing.py` — Main script. Run directly or via cron. - `config.json` — Credentials and endpoints (not committed). - `config.example.json` — Template for config.json. ## How It Works 1. Logs into FreshRSS (Google Reader API), fetches up to 100 unread items. 2. Sends headlines to Ollama — Phase 1 selects top 5, Phase 2 summarizes each in 30-50 words. 3. Collects dashboard data: weather (open-meteo), ZFS status (SSH to remote host), Grafana metrics, market data (yfinance), Uptime Kuma alerts (pct exec). 4. Builds ESC/POS receipt bytes via `python-escpos` (Dummy printer). 5. Sends raw bytes to printer via TCP socket on port 9100. 6. Marks articles as read in FreshRSS. ## Configuration (`config.json`) | Key | Description | Example | |---|---|---| | `freshrss_url` | FreshRSS base URL | `http://192.168.0.157` | | `freshrss_user` | FreshRSS username | `Admin` | | `freshrss_api_key` | FreshRSS API password | `seth123!` | | `ollama_url` | Ollama instance URL | `http://192.168.0.141:11434` | | `ollama_model` | Model name | `qwen2.5:1.5b` | | `yourls_url` | YOURLS API endpoint | `http://192.168.0.152:8080/yourls-api.php` | | `yourls_user` | YOURLS username | `admin` | | `yourls_pass` | YOURLS password | | | `grafana_url` | Grafana base URL | `https://monitor.atermiter-x79.xyz` | | `grafana_token` | Grafana service account token | `glsa_...` | | `remote_host` | Host to SSH into for ZFS status | `192.168.0.197` | | `remote_pass` | SSH password for remote_host | | | `printer_ip` | TM-m30 IP address | `192.168.0.137` | | `printer_port` | ESC/POS TCP port (default 9100) | `9100` | ## Infrastructure - **Printer:** Epson TM-m30 at `192.168.0.137`, ESC/POS TCP port 9100. - **FreshRSS:** CT 120, `192.168.0.157` / `fresh.sethpc.xyz`. - **Ollama:** `192.168.0.141` (Gaming PC, `steel141`). Model: `qwen2.5:1.5b`. - **YOURLS:** `192.168.0.152:8080` — shortens article URLs printed on receipt. - **Grafana:** `monitor.atermiter-x79.xyz` — Proxmox node metrics (173, 112, 197). - **ZFS:** SSH to `192.168.0.197` (node-197) — queries `zpool list tank`. - **Uptime Kuma:** CT 147 — queried via `pct exec 147` (requires Proxmox host). - **This script runs on:** CT 166 (`192.168.0.175`, OpenClaw2). ## Cron Runs daily at 04:30 via crontab on CT 166: ``` 30 4 * * * python3 /root/bin/POS-Automation/pos_briefing.py >> /var/log/pos_briefing.log 2>&1 ``` ## Setup ```bash pip3 install requests python-escpos yfinance qrcode apt install sshpass cp config.example.json config.json # Edit config.json with credentials python3 pos_briefing.py ``` ## Known Issues / Notes - `pct exec 147` (Uptime Kuma check) only works on a Proxmox host, not inside a CT — silently returns None. - `printer_ip` direct access (`192.168.0.137`) may be unreachable from some CTs due to Proxmox bridge/firewall state; pinging first resolves intermittent ARP issues. - FreshRSS direct IP (`192.168.0.157`) can be intermittently unreachable from CT 166 — `fresh.sethpc.xyz` (via Caddy) works as fallback but adds latency. - yfinance ETH-USD occasionally fails with a NoneType error — non-fatal, other tickers still print. ## Gitea - Repo: `https://git.sethpc.xyz/Seth/POS-Automation.git` - Parent project: `https://git.sethpc.xyz/Seth/PrinterAutomation.git`