Skip to content
Ren0X1Public

About

πŸ–₯️ Control your PC from anywhere without leaving it on: a web panel on a Raspberry Pi Zero 2 W wakes it with Wake on LAN, monitors CPU, RAM, disk and GPU, runs your scripts over SSH and shuts it down again, all through Tailscale.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

15 Commits

Folders and files

Repository files navigation

πŸ–₯️ ZeroDesk

Python Flask SQLite Playwright PowerShell OpenSSH Raspberry Pi Windows Tailscale Telegram

Your gaming PC and your Discord bot, from anywhere. A tiny web panel running on a Raspberry Pi Zero 2 W that wakes the PC with Wake on LAN, monitors it, runs your scripts on it over SSH and turns it off again β€” and manages the RGL Discord BOT that lives on the same Pi. All from your phone, through Tailscale. πŸš€

The Pi is always on and sips power; the PC only runs when there is something to do. From the panel you see CPU, RAM, disk and GPU at a glance, power the PC on/off/restart/sleep, lock it, keep it from locking, restart, update and configure the Discord bot, and even top up a prepaid wallet that needs a real browser β€” which the Pi (415 MB of RAM) could never run itself, so it borrows the PC for 30 seconds. ⚑


🧰 Tech stack

Area Technology
Panel backend Python 3.15 (via uv) Β· Flask 3 Β· waitress
Panel frontend Vanilla HTML + CSS + JS β€” inline SVG icons and charts, zero dependencies Β· Bento theme, dark by default with a light mode (Inter + JetBrains Mono)
Telemetry SQLite (telemetria.db), 30 days of history, bucketed on the fly per range
PC control OpenSSH Server on Windows (key auth only) + PowerShell 5.1 scripts
Power on Wake on LAN magic packet (UDP broadcast from the Pi)
Desktop actions Windows Task Scheduler tasks that run inside the user session
Browser automation Playwright + headless Chromium (wallet top-up)
Alerts Telegram Bot API
Services systemd (recarga-web) β€” starts with the Pi, restarts itself; also drives the bot's discordbot service
Remote access Tailscale (WireGuard VPN, no ports opened)
Hardware Raspberry Pi Zero 2 W Β· Windows 11 PC (AtlasOS)
CI/CD GitHub Actions β€” automatic versioning, tag and release on every push

✨ What the panel does

🎨 The screen

A Bento grid of rounded cards β€” dark by default, with a sun button for light mode (remembered per browser). Figures in a monospace so they line up, one teal accent for what you can touch. On a phone the cards stack and the navigation becomes a bar at the bottom, under your thumb.

β”Œ ZD ZeroDesk ────────────────────────────── ● Todo operativo Β· 13:27  β˜€  β‡₯ ┐
β”‚ [Inicio] Bot  Terminal  GrΓ‘ficas  Sistema                                β”‚
β”‚ β”Œ PC de juegos ─────────────────────────────────────────── [⏻ Apagar PC] ┐│
β”‚ β”‚ RNXPC  ● En lΓ­nea Β· encendido hace 3 h 20 min                          β”‚β”‚
β”‚ β”‚ [CPU 18%] [RAM 41%] [Disco 56%] [GPU 9%] [47 Β°C]                       β”‚β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β”‚ β”Œ Control del PC ─┐ β”Œ RGL Bot ── Activo ┐ β”Œ Scripts ─────────────────┐   β”‚
β”‚ β”‚ 6 buttons       β”‚ β”‚ v2.0.0 Β· 2 d Β· 61MBβ”‚ β”‚ Monedero Casa Ortega     β”‚   β”‚
β”‚ β”‚ Anti-bloqueo β—‹  β”‚ β”‚ Chat de IA ●       β”‚ β”‚ [Simular] [Recargar 10€] β”‚   β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚ β”Œ Terminal ─────────────────────────────┐ β”Œ Raspberry Pi ─────────────┐   β”‚
β”‚ Rendimiento Β· Herramientas del bot (logs, .env, memoria IA) Β· Sistema    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🩺 Monitor

  • πŸ–₯️ Summary β€” the PC's name, state and uptime, one main button (Power on when it is off, Shut down when it is on) and a one-line diagnosis: all good, disk C: at 92 %, GPU at 82 Β°C, waiting at the login screen…
  • πŸ”— Command path β€” browser β†’ Raspberry Pi β†’ PC, each with its own status dot, so you see at a glance which link is down.
  • πŸ“Š Live metrics β€” CPU, RAM, disk C:, GPU load and GPU temperature; the bar turns amber and then red past its threshold.
  • πŸ“ˆ Performance β€” one large chart; pick the metric (PC CPU / RAM / GPU temp, Pi CPU / RAM / temp) in cells that already show its latest value and its peak, with 1 h Β· 6 h Β· 24 h Β· 7 d Β· 30 d ranges, a real scale and hover tooltips. Gaps (PC off, Pi rebooting) break the line instead of lying.
  • 🧾 System β€” Windows edition, CPU, GPU, public IP and session; casaortega.com, Redsys and the Telegram API with their latency; the Pi's CPU, RAM, temperature and uptime.

πŸŽ›οΈ Control

Button How it works
⚑ Power on Wake on LAN from the Pi, then waits until SSH answers
⏻ Shut down shutdown /s over SSH, waits until the PC is really gone
πŸ”„ Restart shutdown /r, tracks it going down and coming back
πŸŒ™ Sleep SetSuspendState β€” wakes up again with Power on
πŸ”’ Lock / πŸšͺ Sign out Scheduled tasks that run inside the desktop session
πŸ–±οΈ Anti-lock Nudges the mouse 1 px every 5 min so Windows never locks (off by default)
πŸ“ Reboot Pi systemctl reboot through an exact-command sudoers rule; the page reconnects by itself

πŸ€– Discord bot

The RGL Discord BOT runs on the same Pi. It used to have its own web panel (another Flask app, another service, more RAM); everything it did now lives here:

  • 🟒 Status β€” running / stopped / crashed, version, uptime and memory of the discordbot service.
  • πŸ” Restart / stop / start, and Update: runs the bot's startup.sh (apt, git reset to the latest main, Python patch, dependencies) as a job, streamed into the terminal, and checks the version that actually came up.
  • πŸ’¬ AI chat switch β€” on/off instantly (data/ai_state.json).
  • πŸ“œ Logs β€” the last lines of its journal, errors in red.
  • ✏️ Config β€” its .env and .env.avisos as a form, comments and order kept; tokens and keys are never sent to the browser (empty = unchanged). After saving it offers to restart the bot.
  • 🧠 AI memory β€” edit the manual context and the learned memory as JSON (validated before saving), or wipe the learned memory in one click.

πŸ§ͺ Scripts

  • πŸ’³ Wallet top-up β€” logs into casaortega.com, fills the Redsys gateway with the Pluxee card and waits for the bank. If the PC was off, it is woken up for the job and shut down afterwards; if it was on, it is left alone.

πŸ–₯️ Terminal

Every operation shows its steps ([ OK ], [FAIL], timings) and the PC's output live; when idle, the terminal shows the operation log.


πŸ—ΊοΈ How it fits together

flowchart LR
    phone["πŸ“± Phone / browser"] -- Tailscale --> pi["πŸ“ Raspberry Pi Zero 2 W<br/>Flask panel :6678"]
    pi -- "Wake on LAN" --> pc["πŸ–₯️ Windows PC"]
    pi -- "SSH (key)" --> pc
    pc -- "scheduled tasks" --> desk["πŸ‘€ User session<br/>jiggler Β· lock"]
    pc -- "Playwright" --> shop["πŸ›’ casaortega.com β†’ Redsys"]
    pi -- "systemd" --> bot["πŸ€– Discord bot<br/>discordbot.service"]
    pi -- alerts --> tg["✈️ Telegram"]
    pc -- alerts --> tg
Loading

πŸ“ Repository layout

ZeroDesk/
β”œβ”€β”€ panel/                  # πŸ“ runs on the Raspberry Pi
β”‚   β”œβ”€β”€ app.py              #    Flask app: monitor thread, jobs, API
β”‚   β”œβ”€β”€ templates/ static/  #    dashboard UI (panel, login) and its single stylesheet
β”‚   β”œβ”€β”€ instalar.sh         #    one-shot installer (venv, SSH key, sudoers, systemd)
β”‚   β”œβ”€β”€ cambiar_password.py #    set / change the panel password
β”‚   β”œβ”€β”€ recarga-web.sudoers #    the exact commands the panel may run with sudo
β”‚   └── recarga-web.service
β”œβ”€β”€ pc/                     # πŸ–₯️ runs on the Windows PC (called by the Pi over SSH)
β”‚   β”œβ”€β”€ preparar_pc.ps1     #    one-shot setup: OpenSSH, firewall, WoL, scheduled tasks
β”‚   β”œβ”€β”€ estado_pc.ps1       #    CPU / RAM / disk / GPU / session β†’ JSON
β”‚   β”œβ”€β”€ jiggler.ps1 Β· mantener_despierto.ps1 Β· lanzar_jiggler.vbs
β”‚   └── sesion.ps1          #    lock / sign out
β”œβ”€β”€ recarga.py              # πŸ’³ wallet top-up (Playwright)
β”œβ”€β”€ notificar.py Β· saldo.py Β· sacar_chat_id.py Β· recargar.bat
└── .github/workflows/release.yml

πŸš€ Setup

1️⃣ Windows PC

  1. Clone the repo (the panel expects it at the path set in PC_DIR).
  2. Wallet top-up (optional):
    pip install -r requirements.txt
    python -m playwright install chromium-headless-shell
    copy .env.example .env   # card, Casa Ortega login, Telegram bot
    python sacar_chat_id.py  # prints your TG_CHAT_ID
  3. From an elevated PowerShell, with the key printed by the Pi installer:
    powershell -ExecutionPolicy Bypass -File .\pc\preparar_pc.ps1 -ClavePi "ssh-ed25519 AAAA... pi-recarga"
    It installs OpenSSH Server from Microsoft's MSI (works on AtlasOS, where Windows Update is off), allows only the Pi's key, opens port 22 only to the Pi, arms Wake on LAN and registers the scheduled tasks.
  4. In the BIOS/UEFI: enable Wake on LAN / Power On By PCI-E and disable ErP / Deep Sleep. The PC must be on Ethernet.

2️⃣ Raspberry Pi

git clone https://github.com/Ren0X1/ZeroDesk.git
sudo bash ZeroDesk/panel/instalar.sh

The panel runs straight from the cloned repo (~/ZeroDesk/panel). The installer creates the venv, generates the SSH key for the PC, asks for the panel password, installs the sudo rule and enables the recarga-web service so it starts on every boot. Then check ~/ZeroDesk/panel/.env (PC_IP, PC_MAC, PC_DIR, TG_TOKEN, TG_CHAT_ID).

3️⃣ Open it

http://<pi-tailscale-ip>:6678 from any device on your tailnet. πŸ“±


πŸ› οΈ Day to day

bash ~/ZeroDesk/panel/actualizar.sh              # πŸ”„ update: git pull + restart (config and history are kept)
                                                 #    the stylesheet URL carries VERSION, so browsers pick up the new look at once
systemctl status recarga-web                     # is the panel up?
journalctl -u recarga-web -n 50 --no-pager       # what happened
cd ~/ZeroDesk/panel && venv/bin/python cambiar_password.py && sudo systemctl restart recarga-web

On the PC nothing needs restarting: the Pi calls the scripts in pc/ and recarga.py from the repo folder on every run, so a git pull there is enough.


πŸ” Security

  • πŸ”‘ SSH into the PC with one key only; password login is disabled; port 22 is open only to the Pi.
  • 🌐 The panel is meant to be reached only through Tailscale β€” nothing is exposed to the internet.
  • πŸ§‚ Panel password stored as a salted hash; 5 wrong attempts β†’ 15 min lockout + Telegram alert.
  • πŸ›‘οΈ Session cookie HttpOnly + SameSite=Strict, and a CSRF token on every action.
  • 🧯 The Pi's sudo rights are limited to exact commands (panel/recarga-web.sudoers): reboot, restart the panel, and start / stop / restart / update the bot.
  • πŸ’³ Card data lives only in the PC's .env (git-ignored). The top-up is once a day max and never retries by itself: a blind retry could charge twice.

🧯 Troubleshooting

  • Power on does nothing β€” Wake on LAN is off in the BIOS, ErP is on, or the PC is on Wi-Fi. The link LED on the NIC should stay lit while the PC is off.
  • Lock / anti-lock greyed out β€” they need someone signed in on the PC; after a Wake on LAN boot the PC sits at the login screen.
  • No GPU temperature β€” it comes from nvidia-smi; Windows' ACPI thermal zone reports a fixed value and is ignored on purpose.
  • Top-up timed out β€” the bank may have charged anyway: check the wallet before trying again.

πŸ› οΈ ZeroDesk by Ren0X1.

About

πŸ–₯️ Control your PC from anywhere without leaving it on: a web panel on a Raspberry Pi Zero 2 W wakes it with Wake on LAN, monitors CPU, RAM, disk and GPU, runs your scripts over SSH and shuts it down again, all through Tailscale.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages