All projects

Office Energy Monitor

Real-time energy tracking for 15 devices across 3 rooms — a zero-polling SSE dashboard and a Discord bot on one backend.

Office Energy Monitor — interface preview

About the project

Office Energy Monitor tracks the energy usage of 15 devices across 3 rooms in real time. A live dashboard is driven entirely by Server-Sent Events — no polling — and a Discord bot (!status, !room, !usage) answers with LLM-phrased summaries backed by 3-key Groq API failover. Both interfaces share one backend, so they can never contradict each other. A centralized alerts engine posts deduplicated after-hours and prolonged-usage alerts to Discord, and energy accounting is persisted to PostgreSQL with explicit downtime-gap handling so totals survive restarts. The whole system runs under Docker Compose.

The problem

Device energy usage in an office is invisible until the bill arrives; polling dashboards waste resources and lag behind reality, naive alerting spams the same warning repeatedly, and in-memory accounting silently loses data every time the server restarts.

The solution

One backend as the single source of truth, pushing state to an SSE dashboard and a Discord bot simultaneously; a centralized alerts engine that deduplicates before posting; and restart-safe accounting persisted to PostgreSQL with explicit handling of downtime gaps, so recorded totals stay honest across crashes and deploys.

Why I built it

I wanted to design a real-time system properly — one source of truth serving two very different interfaces, and accounting that stays correct across restarts instead of just looking correct while the process is up.

Tech stack

  • React
  • Node.js
  • Express
  • PostgreSQL
  • Prisma
  • SSE
  • discord.js
  • Groq LLM API
  • Docker

Feedback

Tried this project or read the case study? I'd love to hear your thoughts.