Personal project · api.pnacek.sk

SensorMetrics

A platform that receives readings from sensors (temperature, humidity, CO₂, power…) over a REST API, stores them in MySQL/MariaDB and aggregates them by the selected period into charts and dashboards built from widgets. When a value crosses a threshold or a sensor stops sending data, it notifies you by email or webhook.

Role
Author — design, development, operation
Period
2026 – dnes
Languages
SK
Status
In production
The SensorMetrics app — temperature curves from several sensors with a period selector
SensorMetrics on mobile — temperature chart and bottom navigation

Technologies

PHP 8.4 Symfony 7.4 Doctrine DBAL MySQL / MariaDB Twig Stimulus Symfony Messenger Chart.js GridStack Deployer

What the application does

Widget dashboards Chart, statistics, table and gauge. Widgets can be dragged and resized, with any number of pages.
Minimums and maximums Extreme values and the average for an hour, day, week or month.
Metric management Type, unit, icon and colour of each metric, online/offline status and manually added records.
Alerts and notifications Rules for a threshold or a sensor outage, notification by email or a signed webhook, and a daily status digest.
Public view for TVs A read-only dashboard at its own address or subdomain, with no login.

Technical solutions

Ingesting data even from devices without HTTPS Microcontrollers such as the NodeMCU can't do HTTPS, so writes are protected by an API key of which only a SHA-256 hash is stored. An optional HMAC signature adds a timestamp and replay protection. The key is write-only — it can neither log in nor read data — and writes are throttled by a rate limiter. A faulty sensor reading (e.g. −127 °C from a DS18B20) is not stored but replaced by the previous measurement.
Graf The chart resolution follows the selected period — minutes, 15-minute, hourly and daily averages — so a monthly chart stays fast even with hundreds of thousands of readings. A metric with no reading for over 15 minutes is marked offline.
Multi-user without an ORM Data is read and written with hand-written SQL through Doctrine DBAL, the schema is managed by Doctrine Migrations and no ORM is used. Every metric belongs to a single user and every query filters by it, so another user's data can't be loaded even through an ID in a widget. Sign-up has email verification, Google sign-in, a honeypot and Cloudflare Turnstile.
Public dashboards on a subdomain A page can be published at /v/slug or on its own subdomain through wildcard DNS. The public view runs without a session, returns noindex and no-store headers, and on such a host nothing exists besides the dashboard itself.
Alerty Evaluation runs as a state machine (ok → pending → firing) and changes state with a conditional UPDATE, so a data write and the scheduler can't create the same event twice. Notifications are first written to a queue and sent by a worker with retries and a per-account limit, so an SMTP outage never stops ingestion. The webhook is HMAC-signed and protected against SSRF.
Next project Hivey An AI-powered app for beekeepers: a voice note from an inspection is transcribed
Planning a similar application? Let’s talk →