← projects
Self-hosting · automation

Self-hosted assistant on a Raspberry Pi 5

A personal assistant that syncs my university calendar, watches deadlines and will grow into a PWA and an MCP server.

  • python
  • systemd
  • raspberry-pi
  • google-calendar
  • cloudflare
Flow of one sync run: download the ICS, validate it, upsert by UID, guarded deletions, and an ntfy alert after repeated failures.
How it works

Problem

The university campus only exposes deadlines as an ICS export, and I don’t want to check it by hand.

Design

One Python module holds the logic. It’s exposed three ways: a systemd timer for the sync, a FastAPI backend for a phone PWA, and an MCP server so an LLM can query it on demand.

Decisions

  • Upsert keyed on the UNIR UID, stored in the event’s private extended properties: idempotent, safe to re-run.
  • Delete only after two missing runs: protection against partial feeds.
  • Cloudflare Tunnel instead of port forwarding: works behind CGNAT and keeps the router closed.
  • API LLMs first, local models later: a Pi 5 only runs 1–3B models well.

Status

Sync in production on the Pi since October 2026: a systemd timer runs it every 30 minutes, and re-runs are idempotent. Since November a private daily check-in app runs on the same Pi, also behind the tunnel.

Roadmap

Done

  • Calendar sync with guarded deletions, as a hardened systemd service and timer.
  • Self-hosted ntfy for failure alerts, published through an outbound Cloudflare Tunnel with WAF rules and rate limiting.
  • External heartbeat: if the Pi goes silent, an outside monitor raises the alarm.
  • Remote SSH through Cloudflare Access with two-factor login, no open ports.
  • This website, built and served on the same Pi: atomic releases with automatic rollback, hardened Caddy behind the tunnel.
  • Nightly encrypted backups with age (the Pi only holds the public key), with a tested restore.
  • A private daily check-in app (FastAPI + SQLite) behind Cloudflare Access with Google login, and ntfy reminders that only fire when something is missing.

Next

  • Copying the backups off the Pi, so they survive a dead SD card.
  • Notes synced across devices with Syncthing, with an explicit list of what the assistant may read.
  • Publishing from Obsidian: mark a note as public and it appears on this site, no manual deploy.

Later

  • A FastAPI backend and a PWA with Web Push notifications.
  • An MCP server so an LLM can query the same functions on demand.
  • An LLM router across providers, and study blocks planned from free time and deadlines.

Being designed

  • Power-cut handling and better storage (UPS or HAT, NVMe, clean shutdown, alerts).
  • Voice input and output.
  • Home automation.