Home Energy & Geo Analytics Platform
Self-hosted platform with three parts: live home energy monitoring from a Shelly meter over MQTT and TimescaleDB, wind analytics for 155 Galician weather stations, and a cadastral map of Spain with a 1956 aerial photo layer.
Overview
This platform runs on my own server next to this website. It has three parts that share one Go backend, one TimescaleDB instance, and one Next.js frontend:
Key Features
- Energy - live readings from a Shelly Pro EM meter, stored as a time series and pushed to the browser and a mobile app
- Wind - current wind and wind roses for 155 weather stations in Galicia, from MeteoGalicia open data
- Cadastre - click any point on a map of Spain to get the parcel and property data from the official Catastro, with a 1956 aerial photo layer for Galicia
The energy part is public: you can watch it live on the Live Energy Pipeline page. The wind and cadastre map is part of the admin dashboard, so the screenshots below show it.
Energy: From Meter to Browser
A Shelly Pro EM meter publishes its status over MQTT with TLS to a Mosquitto broker on the server. A Go service subscribes to the meter topics and handles every reading in the same way:
Key Features
- Parse the JSON payload of the meter
- Insert one row into a TimescaleDB hypertable, with continuous aggregates for hourly and daily charts and compression for old data
- Keep the latest value for each channel in Redis, so the current-value API does not query the database
- Push the reading to open dashboards with Server-Sent Events and to the React Native app with WebSocket
There is no queue between MQTT and the database. One reading is one insert, and it takes a few milliseconds. The Live Energy Pipeline page shows this path for every reading, with the time of each step measured on the server.

Wind Analytics
A poller asks the MeteoGalicia API for the latest 10-minute data of every station and stores it in TimescaleDB. Older data comes from the daily archive through an import job.
Key Features
- Station markers with arrows for the current wind direction and speed; a click opens the station panel with its wind rose
- Wind roses calculated in SQL for any period, with a night-only mode (23:00 to 06:00) to see where air from a polluting source goes at night
- A history API for each station with raw, hourly, or daily data
- Redis caches for stations, current data, and wind roses, so the map stays fast and MeteoGalicia gets few requests

Cadastral Map
Click a point on the map, and the backend asks the public Catastro services for the cadastral reference, the property data (type, use, built area, year of construction), and the parcel shape from the INSPIRE WFS service. The GML answer is converted to GeoJSON for the map.
Key Features
- Address search with Google Places
- Catastro WMS parcel overlay from zoom level 15
- Two cache levels (in-memory LRU and Redis for 7 days) and a limit on parallel requests, so the public Catastro services are not overloaded
- Links to the same parcel in the Sede del Catastro and in the Xunta de Galicia map viewer

The 1956 layer shows the aerial photos of the 1956-1957 American flight (Serie B, 1 m per pixel) from the Xunta de Galicia WMS service. The backend works as a tile proxy and caches tiles for 30 days. It is useful to see what a place looked like before modern construction.

Lessons Learned
- A queue is not always needed - at one reading every few seconds, a direct insert is simpler and fast enough, and a live page proves it.
- Be polite to public services - Catastro and MeteoGalicia are free, so caching and request limits are part of the design, not an extra.
- Proxies change streaming - Server-Sent Events through a Next.js rewrite
needed
Cache-Control: no-transform, or the stream was gzipped and stuck in a buffer.