MCPcopy Index your code
hub / github.com/Tomer27cz/energy-line-gauge

github.com/Tomer27cz/energy-line-gauge @v2.3.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.3.1 ↗ · + Follow
249 symbols 468 edges 20 files 1 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Energy Line Gauge

GitHub package.json version Maintained Validate HACS GitHub license hacs_badge GitHub Repo stars GitHub issues GitHub Issues or Pull Requests GitHub Downloads (all assets, all releases) GitHub Downloads (all assets, latest release) GitHub code size in bytes

Buy Me A Coffee

A line Gauge with a focus on Energy Usage

Main Image

Energy

Only Gauge

Gradient Humidity

The main idea of this card is to show the energy consumption of your devices as a percentage of the main entity (your entity for tracking whole house consumption).

My electricity meter is a Sagemcom XT211, I made a custom ESPHome component to read data from it (or any other DLMS/COSEM PUSH meter using RS485).

The card is designed to resemble the Home Assistant Energy panel style. The auto color option will use the colors in the same order as the energy panel.

Table of Contents

Installation

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Installation via HACS

  1. Make sure the HACS custom component is installed and working.
  2. Search for energy-line-gauge
  3. Click Download and then select the latest version.
  4. Reload home-assistant.

Manual installation

  1. Download the three files from the latest release
  2. Create a energy-line-gauge folder inside your config/www folder and place the files in there
  3. Include the card code in your ui-lovelace-card.yaml ```yaml resources:
    • url: /local/energy-line-gauge/energy-line-gauge.js type: module `` Or alternatively set it up via the UI:Configuration -> Lovelace Dashboards -> Resources (TAB)` For more guidance check out the docs.

Configuration

Version 2.0 added a Visual Editor to make the configuration easier. You can find the Card in your Card Selector or by scrolling down to the bottom of the Card Selector and selecting Manual Card. Then you can paste the following code into the Card Editor: type: 'custom:energy-line-gauge'

YAML Only

Some features are not yet available in the Visual Editor. For example the ability to set min and max to be an entity or color auto.

type: 'custom:energy-line-gauge'
entity: sensor.glow_power_consumption

title: Power Consumption
subtitle: Glow

title_position: top-left
title_text_size: 2
title_text_style: shadow-light

title_text_color: gray
subtitle_text_color: black

min: 0
max: sensor.glow_power_consumption

precision: 0
unit: W
cutoff: 5
offset: 1d
sorting: value-desc

position: left
text_size: 2.5
text_style: weight-bold
text_color: auto

line_height: 3
corner: 'square'
state_content_separator: '|'
line_separator: true
line_separator_width: 'each010'
line_text_color: auto

color: "#00aafa"
color_bg:
    - 40
    - 40
    - 40

line_text_position: 'bottom-right'
line_text_size: 1.5
line_text_style: shadow-medium
line_text_overflow: fade
overflow_direction: right

tap_action:
  action: more-info
  entity: sensor.glow_power_consumption
hold_action:
  action: none
double_tap_action:
  action: none

legend_hide: false
legend_all: false

legend_position: bottom-center
legend_alignment: center
legend_indicator: icon-fallback
legend_text_size: 1
legend_text_style: italic
legend_text_color: gray

show_delta: false
delta_position: bottom-center

untracked_legend: true
untracked_legend_label: Untracked
untracked_legend_icon: mdi:flash
untracked_legend_indicator: icon-fallback

untracked_state_content:
  - name
  - state
untracked_line_state_content:
  - percentage

suppress_warnings: false

statistics: false
statistics_day_offset: 1
statistics_period: 'hour'
statistics_function: 'mean'

severity: true 
severity_levels:
  - from: 50
    color: red
  - from: 100
    color: yellow
  - form: 200
    color: green
severity_blend: false

entities:
  - entity: sensor.plug_0_power
    name: Plug 0
    icon: mdi:flash
    color: "auto"
    cutoff: 5
    unit: W
    multiplier: 1
    precision: 0
    state_content:
      - name
      - state
      - percentage
    line_state_content:
      - percentage
    legend_indicator: '-'
  - entity: sensor.plug_1_power
    attribute: device_class
    name: Plug 1
    color:
      - 244
      - 189
      - 74

Main Options

There are a lot of settings you can customize your sensors with:

Setting type default example description
entity entityID !required sensor.power You can specify the entity_id here as well.
attribute string none battery_voltage Replace the state with the value of this entity attribute. Does not work when using statistics.
title string none Power Consumption The title of the Card (font_size: 2rem). Supports templating.
subtitle string none Glow Text in gray below the title (font_size: 1rem). Supports templating.
title_position PositionType top-left left Position of the title see examples
title_text_size number 2 1.5 Font size of the title, subtitle is 2x smaller.
title_text_style TextStyleType none ['italic'] Text style of the Title ans Subtitle see examples and hierarchy
title_text_color ColorType var(--primary-text-color) gray Text color of title.
subtitle_text_color ColorType var(--secondary-text-color) black Text color of subtitle.
min number or entityID 0 100 The minimum value of the gauge. Can be an entity_id.
max number or entityID entity sensor.power The maximum value of the gauge. Can be an entity_id.
precision number 0 2 The number of decimals to display.
unit string none W This string will be appended to the end of the value. Supports templating.
cutoff number 0 10 Any entity with a value below or equal to this will not be displayed or counted.
offset string none 1d Offset state into the past see more.
sorting SortingType none alpha-asc Sort the line and legend entities see more.
line_height number 3 2

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 141
Interface 58
Function 32
Class 16
Enum 2

Languages

TypeScript98%
Python2%

Modules by API surface

src/energy-line-gauge.ts78 symbols
src/types.ts54 symbols
src/interaction/action-handler.ts18 symbols
src/editor/editor.ts16 symbols
src/editor/items-editor.ts15 symbols
src/editor/components/color-editor.ts15 symbols
src/editor/components/severity-editor.ts14 symbols
src/config/defaults.ts7 symbols
src/style/color.ts6 symbols
src/localize/localize.ts4 symbols
src/interaction/event-helpers.ts4 symbols
src/editor/item-editor.ts4 symbols

For agents

$ claude mcp add energy-line-gauge \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page