Build a real-time power monitoring dashboard using Prometheus, Grafana, and smart plugs. Track costs, identify energy vampires, and optimize homelab consumption.
Ever wondered exactly how much electricity your homelab consumes? Beyond simple kill-a-watt readings, building a real-time power monitoring dashboard gives you continuous visibility into your energy usage, helps identify power-hungry devices, and enables data-driven optimization decisions.
This guide walks you through creating a complete power monitoring stack using Prometheus, Grafana, and smart plugs. By the end, you'll have beautiful dashboards tracking every watt your servers consume.

Before diving into the technical setup, let's understand why power monitoring matters for home server enthusiasts.

A typical homelab might consume 50-200W continuously. At $0.12/kWh (US average), that's:
| Daily Consumption | Monthly Cost | Annual Cost |
|---|---|---|
| 50W (efficient) | $4.32 | $52 |
| 100W (moderate) | $8.64 | $104 |
| 200W (heavy) | $17.28 | $207 |
Understanding exactly where those watts go helps you make informed decisions about hardware upgrades and usage patterns.

Identify Energy Vampires: Discover which devices consume more than expected. That "idle" gaming PC might be drawing 80W instead of the expected 20W.
Track Usage Patterns: See how power consumption varies with workloads. Media transcoding, backups, and AI inference all have distinct power signatures.
Validate Optimizations: When you apply power-saving tweaks, verify they actually work with hard data.
Cost Attribution: If you run services for family or friends, understand the true cost of each service.
Anomaly Detection: Sudden power spikes might indicate hardware issues or runaway processes.
Our power monitoring solution consists of three main components:
Smart Plug (Shelly/Tasmota)
↓ (HTTP/MQTT)
Prometheus (Time-Series Database)
↓ (PromQL)
Grafana (Visualization)
Smart Plugs: Hardware devices that measure actual power consumption and expose metrics via HTTP or MQTT.
Prometheus: A time-series database that scrapes and stores metrics from your smart plugs at regular intervals.
Grafana: A visualization platform that queries Prometheus and renders beautiful, interactive dashboards.
The foundation of power monitoring is hardware that can measure watts accurately and expose data programmatically.
| Smart Plug | Price | Features | Firmware | Best For |
|---|---|---|---|---|
| Shelly Plug S | $20 | Native REST API, 12A | Stock | Beginners, no flash needed |
| Shelly Plus Plug S | $22 | ESP32, better Wi-Fi | Stock | 2024+ purchases |
| Sonoff S31 | $12 | Requires flashing | Tasmota | Budget builds |
| Athom Pre-flashed | $18 | Ships with Tasmota | Tasmota | Skip flashing hassle |
| TP-Link Kasa HS110 | $25 | Energy monitoring | Stock | Existing Kasa users |
Choose Shelly if:
Choose Tasmota if:
For server monitoring, consider the maximum power draw:
Pro Tip: Never exceed 80% of a plug's rated capacity for continuous loads. A 10A/1200W plug should handle no more than 960W continuous.
Shelly plugs offer the easiest path to power monitoring with their native HTTP API.
Connect to Shelly's Setup Network
ShellyPlus-XXXX WiFi network192.168.33.1 in your browserConfigure Your WiFi
Find the IP Address
nmap -sn 192.168.1.0/24 | grep -i shellyEnable the HTTP API
For Shelly Gen1 (Plug S):
# Get current power reading
curl http://192.168.1.100/meter/0
# Response example:
{
"power": 45.23,
"is_valid": true,
"total": 12345.67
}
For Shelly Gen2 (Plus Plug S):
# Get switch status with power data
curl http://192.168.1.100/rpc/Switch.GetStatus?id=0
# Response example:
{
"id": 0,
"output": true,
"apower": 42.5,
"voltage": 121.3,
"current": 0.352,
"aenergy": {"total": 1234.56}
}
Tasmota offers more flexibility but requires initial flashing.
Required Tools:
Flashing Steps:
Prepare Hardware
Download and Flash
# Install esptool
pip install esptool
# Download Tasmota firmware
wget https://github.com/arendst/Tasmota/releases/download/v13.4.0/tasmota.bin
# Flash (hold GPIO0 button while powering on)
esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB 0x0 tasmota.bin
Configure Tasmota
tasmota-XXXX WiFiAdd these commands via the Tasmota console:
# Enable web server metrics endpoint
SetOption123 1
# Alternatively, use the /metrics endpoint
# Available at: http://tasmota-ip/metrics
curl http://192.168.1.101/metrics
# Response (Prometheus format):
# HELP tasmota_energy_power_active_watts Active power in watts
# TYPE tasmota_energy_power_active_watts gauge
tasmota_energy_power_active_watts 42.3
# HELP tasmota_energy_total_kwh Total energy in kWh
tasmota_energy_total_kwh 123.456
Prometheus collects and stores time-series metrics from your smart plugs.
Create a docker-compose.yml file:
version: '3.8'
services:
prometheus:
image: prom/prometheus:v2.50.1
container_name: prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=90d'
- '--web.enable-lifecycle'
grafana:
image: grafana/grafana:10.3.3
container_name: grafana
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- grafana_data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=your_secure_password
- GF_USERS_ALLOW_SIGN_UP=false
depends_on:
- prometheus
volumes:
prometheus_data:
grafana_data:
Create prometheus.yml alongside your docker-compose file:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
# Prometheus self-monitoring
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
# Shelly Gen1 plugs (using JSON exporter or direct metrics)
- job_name: 'shelly_plugs'
metrics_path: /metrics
static_configs:
- targets: ['192.168.1.100:80']
labels:
device: 'home-server'
location: 'office'
- targets: ['192.168.1.101:80']
labels:
device: 'nas'
location: 'closet'
# Tasmota plugs (native Prometheus metrics)
- job_name: 'tasmota_plugs'
metrics_path: /metrics
static_configs:
- targets: ['192.168.1.102:80']
labels:
device: 'network-switch'
location: 'rack'
For Shelly devices without native Prometheus support, use a dedicated exporter:
# Add to docker-compose.yml
shelly-exporter:
image: ghcr.io/trickest/shelly-plug-prometheus:latest
container_name: shelly-exporter
restart: unless-stopped
ports:
- "9784:9784"
environment:
- SHELLY_HOSTS=192.168.1.100,192.168.1.101
Then add to prometheus.yml:
- job_name: 'shelly_exporter'
static_configs:
- targets: ['shelly-exporter:9784']
# Start all services
docker-compose up -d
# Check status
docker-compose ps
# View Prometheus targets
open http://localhost:9090/targets
Verify all targets show as "UP" in the Prometheus targets page.
Now for the fun part—creating beautiful visualizations of your power data.
http://localhost:3000http://prometheus:9090Create a gauge showing current total power:
sum(tasmota_energy_power_active_watts)
Settings:
A bar chart showing power per device:
tasmota_energy_power_active_watts
Settings:
{{device}}Line chart showing historical consumption:
sum(tasmota_energy_power_active_watts)
Settings:
Calculate daily kWh usage:
increase(tasmota_energy_total_kwh[24h])
Settings:
Calculate projected monthly electricity cost:
(sum(rate(tasmota_energy_total_kwh[1h])) * 24 * 30) * 0.12
Replace 0.12 with your local electricity rate per kWh.
Settings:
Visualize usage patterns across days and hours:
sum(tasmota_energy_power_active_watts) by (hour)
Settings:
Save time with community dashboards:
Set up alerts to catch unusual power consumption.
Go to Alerting → Alert Rules → Create alert rule:
High Power Alert:
sum(tasmota_energy_power_active_watts) > 300
Device Offline Alert:
up{job="tasmota_plugs"} == 0
Unusual Spike Detection:
sum(tasmota_energy_power_active_watts) >
avg_over_time(sum(tasmota_energy_power_active_watts)[7d:1h]) * 1.5
Here's what homelab users typically discover with power monitoring:
NAS Power Patterns:
Mini PC Servers:
Network Equipment:
Users commonly find:
Not every setup needs Prometheus and Grafana. Consider these alternatives:
| Approach | Complexity | Features | Best For |
|---|---|---|---|
| Kill-A-Watt | Low | Basic readings | Quick checks |
| Shelly App | Low | Basic history | Single device |
| Home Assistant | Medium | Full automation | HA users |
| This stack | Medium | Full analytics | Data enthusiasts |
| InfluxDB + Grafana | Medium | Better compression | Long retention |
If you already run Home Assistant, integrate your smart plugs there instead:
# configuration.yaml
sensor:
- platform: integration
source: sensor.shelly_power
name: "Server Energy"
unit_prefix: k
round: 2
Symptoms: Targets showing as "DOWN"
Solutions:
curl http://plug-ip/metricsSymptoms: Some metrics not appearing
Solutions:
Symptoms: Panels empty or showing "No data"
Solutions:
Symptoms: Reported watts don't match expectations
Solutions:
Most smart plugs are accurate within ±2-5% for resistive loads. For inductive loads (motors, compressors) or switching power supplies, accuracy may decrease due to power factor considerations. For homelab monitoring, this accuracy is generally sufficient.
Yes! Prometheus can scrape hundreds of targets. Simply add more smart plugs to your prometheus.yml configuration with appropriate labels to distinguish between circuits, rooms, or devices.
For most homelabs, 90 days provides enough history for trend analysis while keeping storage requirements reasonable. Prometheus typically uses 1-2 bytes per sample, so a year of 15-second resolution data for 10 devices requires about 2GB.
Some options:
Absolutely! Monitor your solar production alongside consumption to calculate net usage. Some users create dashboards showing production vs consumption, with alerts when consumption exceeds production.
Building a Prometheus + Grafana power monitoring stack transforms vague assumptions about electricity usage into concrete, actionable data. Within a few hours of setup, you'll have:
The investment in monitoring often pays for itself through discovered optimization opportunities. Many homelab users report finding 20-50W of unnecessary consumption—devices left on, inefficient configurations, or unexpected power draws.
Start with a single smart plug on your primary server, then expand as you discover the value of granular power data. Your future self (and electricity bill) will thank you.

Optimization
Compare Beszel, Uptime Kuma, and Grafana for low-power home servers. Resource usage benchmarks, Docker setup guides, and which monitoring tool to choose.

Optimization
Compare Tailscale and Cloudflare Tunnel for home server access. Setup guides, security analysis, and best practices for 2025.

Optimization
Master Linux power management with Powertop, TLP, and kernel tuning. Reduce your home server power consumption to under 10 watts idle.
Use our Power Calculator to see how much you can save.
Try Power Calculator