Skip to content

A power distribution card inspired by the official Energy Distribution card for Home Assistant

Notifications You must be signed in to change notification settings

ulic75/power-flow-card

Repository files navigation

Power Distribution Card

hacs_badge GitHub release (latest by date) GitHub Workflow Status GitHub all releases

This card for Home Assistant Dashboards is designed to provide power distribution in an identical style to the Official Energy Distribution card included by Home Assistant.

preview.mov

Install

HACS (recommended)

This card is available in HACS (Home Assistant Community Store). HACS is a third party community store and is not included in Home Assistant out of the box.

Manual install

  1. Download and copy power-distribution-card.js from the latest release into your config/www directory.

  2. Add the resource reference as decribed below.

Add resource reference

If you configure Dashboards via YAML, add a reference to power-distribution-card.js inside your configuration.yaml:

resources:
  - url: /local/power-distribution-card.js
    type: module

Else, if you prefer the graphical editor, use the menu to add the resource:

  1. Make sure, advanced mode is enabled in your user profile (click on your user name to get there)
  2. Navigate to Configuration -> Dashboards -> Resources Tab. Hit (+ ADD RESOURCE) icon
  3. Enter URL /local/power-distribution-card.js and select type "JavaScript Module". (Use /hacsfiles/power-distribution-card/power-distribution-card.js and select "JavaScript Module" for HACS install if HACS didn't do it already)

Using the card

I recommend looking at the Example usage section to understand the basics to configure this card. (also) pay attention to the required options mentioned below.

Options

Card options

Name Type Default Description
type (required) string custom:power-distribution-card.
entities (required) map One or more sensor entities in a list, see entities map for additional entity options.
min_flow_rate number .75 Represents the fastest amount of time in seconds for a flow dot to travel from one end to the other, see flow formula.
max_flow_rate number 6 Represents the slowest amount of time in seconds for a flow dot to travel from one end to the other, see flow formula.

Entities map

Name Unit Description
grid (required) kW Entity providing a state with a positive value when consuming and a negative value when producting.
battery kW Entity providing a state with a positive value when charging and a negative value when discharging.
battery_charge % Entity providing a state with the current percentage of charge on the battery.
solar kW Entity providing a state with the value of generation.

Example usage

type: custom:power-distribution-card
title: Realtime Distribution
entities:
  battery: sensor.powerwall_battery_now
  battery_charge: sensor.powerwall_charge
  grid: sensor.powerwall_site_now
  solar: sensor.powerwall_solar_now
max_flow_rate: 10

Flow Formula

This formula is based on the offical formula used by the Energy Distribution card.

max - (value / total) * (max - min);

I'm not 100% happy with this. I'd prefer to see the dots travel slower when flow is low, but faster when flow is high. For example if the only flow is Grid to Home, I'd like to see the dot move faster if the flow is 15kW, but slower if it's only 2kW. Right now the speed would be the same. If you have a formula you'd like to propose please submit a PR.