Visualize Your Home's Energy Flow in Real-Time!
A modular ESPHome project that visualizes daily energy distribution similar to Home Assistant, with real-time data on solar production, grid consumption/feed-in, battery status, and gas consumption, on the Guition-ESP32-S3-4848S040 display.
- π Energy Flow Visualization: See your energy distribution at a glance β flows animate only while power is actually flowing, and faster the more power flows
- βοΈ Solar Production Monitoring: Track your daily solar generation
- π Battery Status: Real-time battery state of charge
- π Dual Page Display:
- Page 1: Daily accumulated energy consumption (Home Assistant style)
- Page 2: Current load table with detailed breakdown
- π Touch Interface: Simply tap the screen to switch between views
- π Auto-Dimming: Backlight dims after inactivity, a tap wakes it up
- π‘ Offline Indicator: A small cloud icon shows when Home Assistant is disconnected
- π¨ Modular Design: Easy to customize and extend
| Requirement | Description |
|---|---|
| π§ Hardware | Guition-ESP32-S3-4848S040 (ESP32-S3 with 4.8" IPS touch display) |
| π Home Assistant | With ESPHome Integration for sensor data |
| π» Software | ESPHome (local or Docker/Podman) |
| π Cable | USB cable for initial flashing |
git clone https://github.com/firsttris/esphome-energy-dashboard.git
cd esphome-energy-dashboardCopy the example and fill in your own values:
cp secrets.example.yaml secrets.yamlwifi_ssid: "Your_WiFi_Name"
wifi_password: "Your_WiFi_Password"
api_key: "Your_ESPHOME_API_Key" # Generate a secure key
fallback_password: "Your_Fallback_Password" # Password of the fallback hotspotπ‘ Important: Use a strong API key (e.g., 32 characters long). You can generate one with:
openssl rand -base64 32
Customize the project to your requirements. Ensure that the entity IDs in sensors/homeassistant.yml match your HA sensors:
Daily values (shown on the dashboard):
| ID | Meaning | Example Entity ID |
|---|---|---|
solar_power |
βοΈ Solar production today (kWh) | sensor.deye_wechselrichter_deye_tagliche_produktion |
grid_power / grid_feed_in |
π Grid import / feed-in today (kWh) | sensor.deye_wechselrichter_deye_taglich_energie_bezogen |
home_power |
π Home consumption today (kWh) | sensor.strom_tagesverbrauch |
battery_soc |
π Battery state of charge (%) | sensor.deye_wechselrichter_deye_batterie_soc |
battery_charge / battery_discharge |
π Battery charged / discharged today (kWh) | sensor.deye_wechselrichter_deye_tagliche_batterie_ladung |
gas_power / water_power |
π₯π§ Gas / water today (mΒ³) | sensor.gas_tagesverbrauch |
heating_rod_daily_energy |
β¨οΈ Heating rod today (kWh) | sensor.ac_elwa_2_energy_consumption_daily |
Current power (drives the flow animations and the power table):
| ID | Meaning | Sign convention |
|---|---|---|
current_solar_power |
βοΈ PV power (W) | |
current_grid_power |
π Grid power (W) | positive = import, negative = feed-in |
current_battery_power |
π Battery power (W) | positive = discharging, negative = charging |
current_home_consumption |
π Home consumption (W) | |
current_pv_surplus |
βοΈ PV surplus (W) | |
current_heating_rod_power |
β¨οΈ Heating rod (W) |
β οΈ Sign conventions: If your inverter reports grid or battery power the other way round, add amultiply: -1filter to that sensor.
β Note: The dashboard works even if some sensors don't exist β the loading screen waits at most 10 s for missing sensors.
π Important: The dashboard requires sensors that accumulate daily consumption values, similar to Home Assistant's energy distribution feature. While Home Assistant typically uses total meters, here daily meters are needed. Since the daily accumulated values from the energy dashboard are not accessible, I created utility meters in Home Assistant for daily consumption.
The substitutions at the top of main.yml control the behaviour:
| Substitution | Default | Description |
|---|---|---|
flow_threshold_w |
20 |
Minimum power (W) before a flow is animated |
flow_full_speed_w |
5000 |
Power (W) at which the animation reaches full speed |
idle_timeout |
5min |
Time without touch before the display dims |
idle_brightness |
30% |
Brightness while dimmed (100% disables dimming) |
Connect your ESP32-S3 via USB and flash the firmware using local ESPHome:
esphome run main.yml --device=/dev/ttyUSB0π‘ Note: Replace
/dev/ttyUSB0with your device path (see troubleshooting below)
π Important Notes & Troubleshooting
| OS | Typical Paths |
|---|---|
| π§ Linux | /dev/ttyUSB0, /dev/ttyACM0, /dev/ttyUSB1 |
| π macOS | /dev/cu.usbserial-*, /dev/cu.wchusbserial* |
| πͺ Windows | COM3, COM4, etc. |
Check available ports:
- Linux/macOS:
ls /dev/tty* - Windows: Device Manager
Standard Linux - Add user to dialout group:
sudo usermod -a -G dialout $USER
# Then log out and back inFedora Atomic/Bazzite with rootless Docker/Podman:
The dialout group doesn't work reliably on immutable systems. You need to fix permissions before each flash:
# Check permissions
ls -la /dev/ttyUSB0
# Output: crw-rw----. 1 root dialout 166, 0 ...
# Fix temporarily (resets on USB reconnect)
sudo chmod 666 /dev/ttyUSB0
# If using Docker/Podman, restart the container
docker-compose restart
β οΈ Note: You need to runsudo chmod 666each time you reconnect the USB device. If using Docker/Podman, restart the container after fixing permissions.
π³ Alternative: Using Docker/Podman
β οΈ Important: When using Docker/Podman (rootless), you need to fix USB permissions before flashing.
# 1. Start container
docker-compose up -d
# 2. Flash the firmware
docker-compose exec esphome esphome run main.yml --device=/dev/ttyUSB0π Note: The docker-compose.yml mounts the config directory and runs in host network mode for easy access.
π Alternative: Web Dashboard (GUI)
Choose between local or hosted dashboard:
Docker Dashboard:
# Start container if not already running
docker-compose up -d
# Start the dashboard
docker-compose exec esphome esphome dashboard /configThen open http://localhost:6052 in your browser.
Local Dashboard (requires local ESPHome):
esphome dashboard .Then open http://localhost:6052 in your browser and use the web interface.
Hosted Dashboard (no installation needed):
π No installation needed! Flash directly from your browser.
- Visit https://web.esphome.io/
- Click "Connect" and select your ESP32-S3 device
- Upload your
main.ymlconfiguration file - Click "Install" to compile and flash
Perfect for: Users who prefer GUI over command line, or quick flashing without local ESPHome installation.
After successful startup, the display shows a loading screen followed by the main dashboard.
π Touch the screen to switch between views:
| View | Description |
|---|---|
| π Dashboard | Overview with energy flow diagrams and current values |
| π Power Table | Detailed table showing the current load |
- π Backlight Control: Automatically turns off during OTA updates, dims after inactivity
- πΆ Fallback Hotspot: If WiFi is unreachable, the device opens the hotspot
Energy-Dashboard Fallback - π Home Assistant Integration: Control backlight via Home Assistant
- π Real-time Updates: Data refreshes automatically from your sensors
The configuration is modular for easy customization:
| File | Description |
|---|---|
| π main.yml | Main configuration file |
| π§ base/hardware.yml | Hardware-specific settings (display, I2C, SPI) |
| π base/network.yml | WiFi, API, OTA configuration |
| π‘ base/backlight.yml | Backlight and auto-dimming |
| π sensors/homeassistant.yml | Home Assistant sensor imports |
| π¨ ui/*.yml | UI components (fonts, layout, animations, pages) |
| π ui/bindings.yml | Which sensor updates which label |
.
βββ main.yml # Main ESPHome configuration
βββ secrets.yaml # Your credentials (not in git)
βββ secrets.example.yaml # Template for secrets.yaml
βββ docker-compose.yml # Docker setup
βββ base/
β βββ hardware.yml # Display & hardware config
β βββ network.yml # Network settings
β βββ backlight.yml # Backlight & auto-dimming
βββ sensors/
β βββ homeassistant.yml # HA sensor definitions (entity IDs)
βββ ui/
β βββ animations.yml # Energy flow animations
β βββ bindings.yml # Sensor -> label updates, clock, home ring
β βββ dashboard.h # C++ helpers for animations
β βββ fonts.yml # Font definitions
β βββ layout.yml # Layout configuration
β βββ loading.yml # Loading screen & connection status
β βββ page_dashboard.yml # Main dashboard page
β βββ page_power_table.yml # Power table page
β βββ widgets/ # Reusable widget templates
βββ fonts/ # Font files
βββ docs/ # Documentation & screenshots
| Resource | Description |
|---|---|
| π ESPHome Documentation | Official ESPHome documentation |
| π Home Assistant | Home automation platform |
| π₯οΈ Guition ESP32-S3-4848S040 | Device information |
| π Energy Dashboard | Home Assistant Energy Dashboard |
Made by the open source community
β Star us on GitHub β’ π Report a Bug β’ π‘ Request a Feature