Home Assistant Energy Management

SkillMonitoring & ops

Guidance for using correct energy and power metrics in Home Assistant energy features

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the Home Assistant Energy Management skill

What this skill tells your AI

The instructions your AI receives, as published by taurgis/has-marstek-local-api in .agents/skills/homeassistant-energy-management/SKILL.md and read by ahel’s review.

This skill helps you choose and expose the correct metrics for Home Assistant energy features (Energy Dashboard, grid, and individual devices) to avoid incorrect graphs or totals.

When to Use

  • Adding or auditing energy-related sensors in an integration.
  • Mapping device data to Home Assistant energy concepts (grid import/export, production, consumption).
  • Fixing Energy Dashboard configuration or incorrect totals.

Core Rules

  • Power vs Energy: Power is instantaneous (W), energy is accumulated (kWh).
  • Energy sensors must be monotonically increasing totals (never reset except on rollover).
  • Use state_class total_increasing and device_class energy for kWh totals.
  • Use state_class measurement and device_class power for W values.
  • Avoid mixing sign conventions for energy; separate import and export sensors.

Metric Mapping

ConceptCorrect MetricUnitNotes
Grid importTotal energy importedkWhSeparate from export; total_increasing
Grid exportTotal energy exportedkWhSeparate from import; total_increasing
Solar/productionTotal energy producedkWhMust be total_increasing
Home consumptionTotal energy consumedkWhPrefer derived if not provided
Instant grid powerPower at gridWPositive/negative must be consistent

Grid Data Guidance

  • Provide two energy totals for grid: import and export.
  • If the device reports net energy, split into import/export totals before exposing sensors.
  • Keep grid power sign conventions consistent with your integration (document it).

Individual Devices

  • Each device should expose energy consumed (kWh) as a total_increasing sensor.
  • If only power is available, use a platform-level integration sensor to integrate power into energy.
  • Avoid using daily reset counters as energy totals unless clearly marked and not used in Energy Dashboard totals.

Implementation Checklist

  • Use device_class=energy, state_class=total_increasing, native_unit_of_measurement=kWh.
  • For power, use device_class=power, state_class=measurement, native_unit_of_measurement=W.
  • Ensure totals never decrease; filter resets or rollovers.
  • Add documentation to explain data sources and sign conventions.
  • Validate sensor types in the Energy Dashboard configuration.

Reference

Signals

GitHub stars
35
Forks
5
Last commit
Sep 2026
Advanced
Item type
skill
Key
homeassistant-energy-management
Source
github.com/taurgis/has-marstek-local-api