← All projects
Active September 2026

HomeDomoticaCollector

A Raspberry Pi hub that collects data from every device in my home — solar, weather, EV charger, awnings, thermostats, AC — stores it, and lets me monitor and control everything from a Telegram bot, a LAN web dashboard, and by voice through Alexa.

PythonRaspberry PiSQLiteTelegram BotIoTHome Automation

The idea

My home is full of “smart” devices, each with its own app and portal: solar inverter, weather station, EV charger, sun awnings, thermostats, air conditioners. I wanted one place to see everything, keep its history, and automate how it behaves. So I built a small hub running on an always-on Raspberry Pi.

What it does

It polls the various home systems on a schedule and stores their readings in a SQLite database:

And it offers three ways to interact:

A separate, confirmation-gated emergency command shuts everything down in sequence when needed: awnings, AC, NAS, other PCs, and the router itself last.

The automation engine

The “smart” core is a rule engine: rules are defined in the configuration and evaluated after every weather poll. Examples: close the awnings on wind or rain, put the thermostats into frost protection, switch on the AC when the conditions are right.

Rules support multiple AND conditions across different sources (weather, solar, thermostats), time windows, and two priority levels: critical rules (e.g. strong wind) can fire multiple times and lock out the normal rules on the same devices for the rest of the day.

How it’s built

A concurrency bug and its cure

After months in production, the rule engine had started silently missing its own triggers — up to eleven times a day — with no visible error in the bot or the dashboard. The cause was a SQLite database under pressure: reads, writes, and a dashboard tab left open in a browser (generating around 1,500 calls a day on its own) were locking each other out, and a lock hit while reading the rules’ context quietly crashed the very cycle that evaluates them. Fixed by switching SQLite to WAL mode, adding indexes on the hottest queries, pausing the dashboard’s polling when its tab is hidden, and making the rule engine tolerate a failed read instead of stopping altogether.

Engineering notes

Stack

Python (async) · Raspberry Pi 4 · SQLite · Telegram Bot · aiohttp · OCPP · Cloudflare Tunnel · systemd

Next steps