Ohm Assistant
Open Source

Ohm Assistant

2025·Open Source / Community

Overview

Modern energy and power-consumption views for Home Assistant, turning meter and circuit entities into readable charts and summaries for everyday use. Aims to make usage patterns and peaks obvious without exporting data to a separate tool. TypeScript Lovelace front end, HACS distribution, and design tuned for clarity on both phone and desktop dashboards.

README

⚡ Ohm Assistant Card

<p align="center"> <img src="assets/card.png" align="center" width="50%"> </p> <p align="center"><h1 align="center">Ohm Assistant Card</h1></p> <p align="center"> <em>Modern energy monitoring and power consumption visualization for Home Assistant</em> </p>

Home Assistant hacs_badge

GitHub Release GitHub Pre-Release GitHub Tag GitHub branch status

stars home commits license

<p align="center">Built with the tools and technologies:</p> <p align="center"> <img src="https://img.shields.io/badge/npm-CB3837.svg?style=for-the-badge&logo=npm&logoColor=white" alt="npm"> <img src="https://img.shields.io/badge/Prettier-F7B93E.svg?style=for-the-badge&logo=Prettier&logoColor=black" alt="Prettier"> <img src="https://img.shields.io/badge/TypeScript-3178C6.svg?style=for-the-badge&logo=TypeScript&logoColor=white" alt="TypeScript"> <img src="https://img.shields.io/badge/GitHub%20Actions-2088FF.svg?style=for-the-badge&logo=GitHub-Actions&logoColor=white" alt="GitHub%20Actions"> <img src="https://img.shields.io/badge/Lit-324FFF.svg?style=for-the-badge&logo=Lit&logoColor=white" alt="Lit"> </p> <br>

Overview

A modern, professional Home Assistant custom card for displaying electricity usage and power consumption data. The Ohm Assistant Card provides real-time energy monitoring with beautiful charts and intuitive area-based entity discovery, making it easy to track your home's energy consumption patterns.

Features

📊 Dual Metric Display

  • Real-time Power Monitoring - Shows current power consumption in Watts with live updates
  • Daily Energy Tracking - Displays daily energy usage in kWh with historical data
  • Dual Y-Axis Charts - Separate scales for power (W) and energy (kWh) on the same chart
  • Interactive Tooltips - Hover over data points to see exact values and timestamps

Dual Metric Display

🎨 Modern Design

  • Professional UI - Clean, modern card design with gradient icons and smooth animations
  • Theme Integration - Automatically adapts to Home Assistant's light and dark themes
  • Responsive Layout - Optimized for both desktop and mobile viewing
  • Visual Indicators - Color-coded statistics to understand energy consumption at a glance

Minimalist

🏠 Area-Based Discovery

  • Automatic Entity Detection - Automatically finds power and energy entities within a specified area
  • Smart Entity Mapping - Intelligently identifies power (W) and energy (kWh) sensors
  • Device Integration - Works seamlessly with Home Assistant's area and device structure
  • Flexible Configuration - Override auto-discovery with custom entity lists

📈 Advanced Charting

  • Interactive Charts - Built with Chart.js for smooth, responsive data visualization
  • Chart Type Selection - Choose between Line charts (detailed), Stacked Bar charts (overview), or Stacked Line charts
    • Line charts: 5-minute data aggregation for smooth, detailed visualization
    • Stacked Line charts: Line charts with stacking enabled for cumulative visualization
    • Bar charts: Hourly aggregation for larger, easier-to-read bars with stacking support
  • Untracked Power Visualization - See power consumption not tracked by individual entities (bar charts only)
    • Automatically calculates: untracked = total_power - sum(tracked_power_entities)
    • Displays as a gray bar stacked on top of tracked power
    • Perfect for identifying phantom loads and unmetered devices
  • Multiple Line Types - Choose from normal, gradient, gradient-no-fill, or no-fill line styles
  • Customizable Legends - Configure legend display (entities, compact, or none)
  • Axis Control - Show/hide X and Y axes independently. Power (W) and Energy (kWh) axes are only displayed when their data is present.
  • Time-based Data - Automatic time scaling with proper date/time formatting

No Fill No Fill

Gradient No Fill Gradient No Fill

Gradient Gradient

Bar Stacked Bar Chart w/ Untracked Consumption

Line Stacked Line Chart w/ Untracked Consumption

⚙️ Flexible Configuration

  • Visual Editor - Easy configuration through Home Assistant's card editor
  • YAML Support - Full YAML configuration for advanced users
  • Feature Flags - Toggle functionality like hiding card name or excluding default entities
  • Chart Customization - Fine-tune chart appearance and behavior
  • Entity Override - Specify custom entities to include or exclude

Installation

Prerequisites

[!NOTE]
This card works with any Home Assistant entities that have device_class: power (for Watts) or device_class: energy (for kWh). No additional integrations are required.

HACS (Recommended)

NOTE: may not work until the project is added to HACS official, see Manual Installation

HACS

  1. Open HACS in your Home Assistant instance
  2. Click the menu icon in the top right and select "Custom repositories"
  3. Add this repository URL and select "Dashboard" as the category
    • https://github.com/homeassistant-extras/ohm-assistant
  4. Click "Install"

Manual Installation

  1. Download the ohm-assistant.js file from the latest release in the Releases tab.
  2. Copy it to your www/community/ohm-assistant/ folder
  3. Add the following to your configuration.yaml (or add as a resource in dashboards menu)
lovelace:
  resources:
    - url: /local/community/ohm-assistant/ohm-assistant.js
      type: module

Usage

Add the card to your dashboard using the UI editor or YAML:

Card Editor

The card is fully configurable through the card editor, allowing you to customize:

  • Area selection for automatic entity discovery
  • Custom entity lists
  • Chart configuration options
  • Feature toggles

YAML

This is the most minimal configuration needed to get started:

type: custom:area-energy-card
area: living_room

For custom entity configuration:

type: custom:area-energy-card
area: living_room
entities:
  - sensor.living_room_power
  - sensor.living_room_energy

The card will automatically:

  • Detect power and energy entities within the specified area
  • Create beautiful charts with dual Y-axis (power in W, energy in kWh)
  • Display real-time data with historical context
  • Adapt to your Home Assistant theme

Configuration Options

NameTypeDefaultDescription
areastringRequiredThe area name to automatically discover energy/power entities
namestringArea EnergyCustom name for the card
entitiesarrayautoCustom list of entities to include (see Entity Configuration)
chartobjectnoneChart configuration options
featuresarraynoneFeature flags to enable/disable functionality

Entity Configuration

The entities field accepts two formats:

String Format (simple entity IDs):

entities:
  - sensor.living_room_power
  - sensor.living_room_energy

Object Format (with custom colors and names):

entities:
  - entity_id: sensor.living_room_power
    color: '#ff0000' # Hex color
  - entity_id: sensor.living_room_energy
    color: 'rgba(0, 255, 0, 0.8)' # RGBA color with transparency
  - entity_id: sensor.waschmaschinensteckdose_leistung
    name: Waschmaschine # Custom display name in charts/legends
  - entity_id: sensor.kuhlschrank_garage_leistung
    name: Kühlschrank Garage
  - entity_id: sensor.bedroom_power
    color: 'primary' # Home Assistant theme color

Mixed Format (combine both):

entities:
  - sensor.living_room_power # Uses default color
  - entity_id: sensor.living_room_energy
    color: '#00ff00' # Custom color

When using the object format:

  • entity_id (required): The entity ID string
  • color (optional): Color value in any CSS format (hex, rgba, named colors, etc.) or Home Assistant theme colors (primary, accent, red, blue, green, etc.)
  • name (optional): Custom display name for the entity in charts and legends (e.g. "Waschmaschine" instead of the entity's friendly_name)

Entities without custom colors will use the default color scheme based on their type (power/energy) and position.

Chart Configuration

NameTypeDefaultDescription
chart_typestringlineChart type: line (detailed), stacked_bar (overview), or stacked_line (stacked lines)
total_power_entitystringnoneTotal power entity ID for untracked power visualization (stacked charts only)
legend_stylestringentitiesLegend display style: entities, compact, none
axis_stylestringallAxis display: all, x_only, y_only, none. Power/Energy axes are only shown when their data is present.
line_typestringnormalLine style: normal, gradient, gradient_no_fill, no_fill

Feature Flags

FeatureDescription
hide_nameHide the card name from display
exclude_default_entitiesExclude default auto-discovered entities

Entity Requirements

Power Entity:

  • device_class: power
  • unit_of_measurement: W
  • Example: sensor.living_room_power

Energy Entity:

  • device_class: energy
  • unit_of_measurement: kWh
  • Example: sensor.living_room_energy

Auto-discovery

The card automatically discovers energy and power entities within the specified area based on:

  • Entity device_class (power or energy)
  • Entity unit_of_measurement (W for power, kWh for energy)
  • Entity relationships to the area

This includes sensors with the appropriate device classes and units.

Example Configurations

Basic Configuration

type: custom:area-energy-card
area: living_room

With Custom Name

type: custom:area-energy-card
area: living_room
name: 'Living Room Energy Monitor'

With Custom Entities

type: custom:area-energy-card
area: living_room
entities:
  - sensor.living_room_power
  - sensor.living_room_energy

With Custom Entity Colors and Names

type: custom:area-energy-card
area: living_room
entities:
  - sensor.living_room_power # Default color
  - entity_id: sensor.living_room_energy
    color: '#ff6b6b' # Custom red color
  - entity_id: sensor.kitchen_power
    color: '#4ecdc4' # Custom teal color
    name: Kühlschrank Garage # Custom display name
  - entity_id: sensor.bedroom_power
    color: 'primary' # Home Assistant theme color

With Chart Configuration

type: custom:area-energy-card
area: living_room
chart:
  chart_type: stacked_bar # Use bar charts for better overview
  legend_style: compact
  axis_style: y_only
  line_type: gradient

With Untracked Power Visualization

type: custom:area-energy-card
area: living_room
chart:
  chart_type: stacked_bar # Required for untracked power
  total_power_entity: sensor.total_power # Your total power entity

Note: Untracked power visualization only works with chart_type: stacked_bar or chart_type: stacked_line. The card will automatically calculate and display the difference between total power and the sum of tracked power entities.

With Feature Flags

type: custom:area-energy-card
area: living_room
features:
  - hide_name
  - exclude_default_entities

Full Configuration Example

type: custom:area-energy-card
area: living_room
name: 'Living Room Energy Monitor'
entities:
  - sensor.living_room_power # Default color
  - entity_id: sensor.living_room_energy
    color: '#10b981' # Custom green color
chart:
  chart_type: stacked_bar # Use bar charts
  total_power_entity: sensor.total_power # Track untracked power
  legend_style: entities
  axis_style: all
  line_type: gradient_no_fill
features:
  - hide_name

Screenshots

Coming soon - screenshots of the card in action will be added here.

Project Roadmap

  • Initial design: Create initial area energy card design
  • Area-based discovery: Automatic detection of energy/power entities within areas
  • Dual metric display: Real-time power (W) and energy (kWh) visualization
  • Chart integration: Chart.js implementation with dual Y-axis support
  • Modern UI: Professional design with theme integration
  • Configuration options: Visual editor and YAML support
  • Feature flags: Toggle functionality like hiding card name
  • Chart customization: Multiple line types and legend styles
  • Performance optimization: Efficient rendering with memoization
  • TypeScript support: Full type safety and modern development
  • UI improvements: Tweaks and changes for the UI - thanks @LamarcLS
  • Custom entity colors and name: Choose colors/name for individual chart items - thanks @LamarcLS, @frankfrommelt
  • Conditional axis display: Show Power/Energy axes only when their data is displayed - thanks @frankfrommelt
  • Chart type selection: Line and Stacked Bar chart options - thanks @LamarcLS
  • Untracked power visualization: Visualize power consumption not tracked by individual entities - thanks @LamarcLS

Contributing

<details closed> <summary>Contributing Guidelines</summary>
  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/homeassistant-extras/ohm-assistant
    
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
    
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
    
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
    
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
</details>

Development

Prerequisites

  • Node.js 18+
  • Yarn or npm

Setup

cd ohm-assistant
yarn install

Development Mode

yarn watch

Build

yarn build

Testing

yarn test

Formatting

yarn format

License

This project is protected under the MIT License. For more details, refer to the LICENSE file.

Acknowledgments

  • Built using LitElement
  • Chart visualization powered by Chart.js
  • Inspired by modern energy monitoring dashboards
  • Thanks to all contributors!

contributors

ko-fi

Code Quality

Forgive me and my badges..

Stats

Bugs Vulnerabilities Code Smells Technical Debt Duplicated Lines (%) Lines of Code Coverage

Ratings

Quality Gate Status Reliability Rating Security Rating Maintainability Rating

Build Status

Main

CodeQL Dependabot Updates Main Branch CI Fast Forward Check

Release

Release & Deploy Merge

Other

Issue assignment Manual Release