Building Your First Energy Dashboard in Home Assistant

January 15, 2025 8 min read By Thomas K. @ SmartWattFlow

Creating an energy monitoring dashboard in Home Assistant is one of the most rewarding projects you can undertake. Not only does it provide real-time insights into your energy consumption, but it also helps you identify opportunities for cost savings and efficiency improvements.

In this comprehensive guide, we'll walk through building a professional energy dashboard from scratch, complete with real-time monitoring, cost tracking, and beautiful visualizations.

What You'll Learn

  • Setting up the Energy integration in Home Assistant
  • Creating custom sensors for cost calculation
  • Building dashboard cards with Lovelace UI
  • Implementing historical data tracking
  • Adding alerts for unusual consumption

Prerequisites

Before we begin, make sure you have:

  • Home Assistant 2024.1 or later installed
  • At least one energy monitoring device (smart meter, Shelly, etc.)
  • Basic familiarity with Home Assistant's interface
  • Access to your electricity tariff information

Step 1: Configure the Energy Integration

Home Assistant's built-in Energy integration is the foundation of our dashboard. It provides standardized tracking and makes it easy to monitor consumption patterns.

Enable the Integration

  1. Navigate to Settings > Dashboards > Energy
  2. Click "Add Consumption"
  3. Select your main electricity meter entity
  4. Configure your energy tariff (we'll set up time-of-use pricing later)

Pro Tip

If you don't see your energy entities, check that they have the correct device_class set to 'energy' and state_class set to 'total_increasing'.

Step 2: Create Cost Calculation Sensors

To track costs accurately, we need to create template sensors that calculate expenses based on your electricity rates.

Basic Cost Sensor

Add this to your configuration.yaml:

configuration.yaml
template:
  - sensor:
      - name: "Daily Energy Cost"
        unit_of_measurement: "€"
        state: >
          {% set energy = states('sensor.daily_energy') | float %}
          {% set rate = 0.23 %}  # Your electricity rate per kWh
          {{ (energy * rate) | round(2) }}
        availability: >
          {{ states('sensor.daily_energy') not in ['unknown', 'unavailable'] }}

Time-of-Use Pricing

For more accurate cost tracking with variable pricing:

configuration.yaml
template:
  - sensor:
      - name: "Current Electricity Rate"
        unit_of_measurement: "€/kWh"
        state: >
          {% set hour = now().hour %}
          {% if hour >= 22 or hour < 6 %}
            0.18  # Off-peak rate
          {% elif hour >= 17 and hour < 22 %}
            0.28  # Peak rate
          {% else %}
            0.23  # Standard rate
          {% endif %}

Step 3: Build the Dashboard

Now for the fun part - creating a beautiful, informative dashboard that displays all your energy data.

Essential Cards

Here are the key cards every energy dashboard needs:

1. Current Power Usage

lovelace.yaml
type: gauge
entity: sensor.current_power
min: 0
max: 5000
name: Current Usage
unit: W
severity:
  green: 0
  yellow: 2000
  red: 3500

2. Daily Energy Consumption

lovelace.yaml
type: energy-date-selection

3. Cost Tracking

lovelace.yaml
type: entities
entities:
  - entity: sensor.daily_energy_cost
    name: Today's Cost
  - entity: sensor.monthly_energy_cost
    name: Monthly Cost
  - entity: sensor.current_electricity_rate
    name: Current Rate

Step 4: Add Historical Charts

Historical data helps you identify trends and track the effectiveness of energy-saving measures.

lovelace.yaml
type: history-graph
entities:
  - sensor.daily_energy
  - sensor.daily_energy_cost
hours_to_show: 168  # Show last 7 days
refresh_interval: 0

Step 5: Set Up Automation Alerts

Create automations to alert you about unusual energy consumption:

automations.yaml
automation:
  - id: high_energy_usage_alert
    alias: "High Energy Usage Alert"
    trigger:
      - platform: numeric_state
        entity_id: sensor.current_power
        above: 4000
        for:
          minutes: 10
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "High Energy Usage"
          message: "Power consumption has been above 4kW for 10 minutes"

Advanced Features

Once you have the basics working, consider adding these advanced features:

Solar Production Integration

If you have solar panels, integrate production data:

lovelace.yaml
type: energy-solar-graph
entities:
  - sensor.solar_production
  - sensor.energy_consumption

Device-Level Monitoring

Track individual appliances with smart plugs:

lovelace.yaml
type: grid
cards:
  - type: gauge
    entity: sensor.washing_machine_power
    name: Washing Machine
  - type: gauge
    entity: sensor.dishwasher_power
    name: Dishwasher

Troubleshooting Common Issues

Missing Energy Data

If your energy entities aren't showing up:

  • Check that the device_class is set to 'energy'
  • Verify the state_class is 'total_increasing'
  • Restart Home Assistant after making changes

Incorrect Cost Calculations

Common causes of wrong cost calculations:

  • Incorrect electricity rate in templates
  • Missing unit conversions (Wh vs kWh)
  • Time zone issues with time-of-use rates

Next Steps

Now that you have a working energy dashboard, consider these next steps:

  • Add more monitoring points throughout your home
  • Implement demand response automations
  • Set up energy efficiency tracking
  • Integrate with battery storage systems

Conclusion

Building an energy dashboard in Home Assistant is a powerful way to take control of your energy consumption. With real-time monitoring, cost tracking, and historical analysis, you'll be well-equipped to make informed decisions about your energy usage.

The dashboard we've built today provides a solid foundation that you can expand and customize based on your specific needs. Remember, the key to effective energy management is consistent monitoring and gradual optimization.

Ready to Build on These Features?

Our guides show you exactly how to create advanced energy dashboards and automations for Home Assistant.

View Guides