← All projects
Active May 2026

Bollette Auto

A self-hosted system that watches my inbox, automatically downloads household utility bills from provider portals, files them on my home NAS, and extracts their data into a web dashboard — with Telegram notifications.

PythonDockerPlaywrightFastAPISQLiteSelf-hosted

The problem

Every month, the same chore: an email arrives from the provider, log into the portal, download the PDF, rename it, save it to the right folder. Multiply that by electricity, gas, phone and internet and it becomes a tedious, repetitive task — exactly the kind of thing a computer should be doing for me.

What it does

Bollette Auto (“auto bills”) runs in the background inside a small Docker container and, on its own:

  1. Checks the inbox over IMAP (Gmail and other mailboxes) at regular intervals.
  2. Recognises bill emails by their sender.
  3. Downloads the PDF from the provider’s portal.
  4. Files it on the NAS in a tidy year/PROVIDER/ structure.
  5. Extracts the data from the PDF into a database so it can be explored.
  6. Notifies the outcome on Telegram — bill downloaded, or an error.

How it works

At its core is an IMAP polling loop: each mailbox gets its own thread that checks for new mail, routes it to the right provider, and triggers the matching scraper. The downloaded PDF is handed to the archiver, which stores it on the NAS (mounted over CIFS) under the folder for that year and provider.

Two download strategies

Configuration-driven design

A single YAML file describes mailboxes, providers, selectors and notifications. Most providers can be added without touching code; only the “hard” portals — single-page apps with tokens in sessionStorage, unusual APIs — need a small dedicated scraper in Python.

From PDFs to a dashboard

The bills don’t just sit as PDFs in a folder. Each file is parsed (text extraction with pdfplumber) to pull out the amount, billing period, invoice date, consumption and provider, and the data lands in a SQLite database.

On top of that data runs a web dashboard — a separate FastAPI + Uvicorn service with a static frontend and Chart.js charts:

The filters (provider, year, month) are global and persist as you move between tabs.

Security matters

Stack

Python · Playwright · IMAP · Docker · Synology NAS (CIFS) · Telegram Bot API

What I learned