DBa2016 / power-usage-card-regex

Lovelace pie chart card that displays current energy usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hacs_badge

Lovelace power usage graph card with regexp

This card will display a doughnut chard that gives insights in your current power usage. Unlike the original one, you don't need to enumerate all the devices you have - you just need to define a regular expression matching all the entities.

Note: the card is not collecting any data, it is only displaying momentary values. If your devices report "power" (in Watt) and not "power usage" (kWh, sometimes Ws), then you should consider using "integration" (https://www.home-assistant.io/integrations/integration/) or "utility meter" (https://www.home-assistant.io/integrations/utility_meter/) components as input sources for this card.

The card will suppress displaying entities which do not have a numeric state (normally "unavailable", on devices which are really unavailable or just not initialized yet).

Usage

  • HACS: add through HACS. You will likely need to have HACS include this plugin into the Lovelace ressources and to reload the page after it
  • manual: Add plugin .js as a module:
- url: /local/power-usage-card-regex.js
  type: module
  1. Add lovelace card to view:
- type: "custom:power-usage-card-regex"            # Mandatory
  title: "Power consumption"                       # Optional customized title
  total_power_usage: sensor.power_consumption      # Optional total power consumption (DSMR) sensor.
                                                   # If available then other measured values will be 
                                                   # substracted from total to calculate 'unknown' value.
  unknownText: "Total"                             # Optional customized unknown text. Only applicable
                                                   # with total_power_usage option enabled.
  filter: "^.*_total$"                             # Mandatory - regular expression to match; 
                                                   #    all entities matching this RE will be treated
                                                   #    as included, if they have a numeric state;
                                                   #    their name will be taken from "friendly_name" attribute,
                                                   #    so set them wisely

screenshot

About

Lovelace pie chart card that displays current energy usage


Languages

Language:JavaScript 100.0%