Skip to content

Commit

Permalink
fix: rename card to power-distribution-card
Browse files Browse the repository at this point in the history
  • Loading branch information
ulic75 committed Apr 29, 2022
1 parent c77ab36 commit 6678525
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 32 deletions.
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# [1.1.0](https://github.com/ulic75/realtime-energy-distribution-card/compare/v1.0.0...v1.1.0) (2022-04-28)

# [1.1.0](https://github.com/ulic75/power-distribution-card/compare/v1.0.0...v1.1.0) (2022-04-28)

### Features

* **flow:** add optional rate configuration ([#5](https://github.com/ulic75/realtime-energy-distribution-card/issues/5)) ([f258f49](https://github.com/ulic75/realtime-energy-distribution-card/commit/f258f49eaa5d2faa8d90830e04c52301a71ed60c))
- **flow:** add optional rate configuration ([#5](https://github.com/ulic75/power-distribution-card/issues/5)) ([f258f49](https://github.com/ulic75/power-distribution-card/commit/f258f49eaa5d2faa8d90830e04c52301a71ed60c))

# 1.0.0 (2022-04-28)

### Features

* initial release ([#2](https://github.com/ulic75/realtime-energy-distribution-card/issues/2)) ([93e9da1](https://github.com/ulic75/realtime-energy-distribution-card/commit/93e9da17c9af172a9d3898f8d6dc2f49df5abfac))
- initial release ([#2](https://github.com/ulic75/power-distribution-card/issues/2)) ([93e9da1](https://github.com/ulic75/power-distribution-card/commit/93e9da17c9af172a9d3898f8d6dc2f49df5abfac))
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Realtime Energy Distribution Card
# Power Distribution Card

[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg?style=flat-square)](https://github.com/hacs/integration)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/ulic75/realtime-energy-distribution-card?style=flat-square)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ulic75/realtime-energy-distribution-card/CI?style=flat-square)
![GitHub all releases](https://img.shields.io/github/downloads/ulic75/realtime-energy-distribution-card/total?style=flat-square)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/ulic75/power-distribution-card?style=flat-square)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ulic75/power-distribution-card/CI?style=flat-square)
![GitHub all releases](https://img.shields.io/github/downloads/ulic75/power-distribution-card/total?style=flat-square)

This card for [Home Assistant](https://github.com/home-assistant/home-assistant) Dashboards is designed to provide realtime energy distribution in an identical style to the Official Energy Distribution card included by Home Assistant.
This card for [Home Assistant](https://github.com/home-assistant/home-assistant) Dashboards is designed to provide power distribution in an identical style to the Official Energy Distribution card included by Home Assistant.

https://user-images.githubusercontent.com/5641964/165832442-b6035400-9857-4e71-aa97-59c261dafae1.mov


## Install

### HACS (recommended)
Expand All @@ -19,26 +18,26 @@ This card is available in [HACS](https://hacs.xyz/) (Home Assistant Community St

### Manual install

1. Download and copy `realtime-energy-distribution-card.js` from the [latest release](https://github.com/ulic75/realtime-energy-distribution-card/releases/latest) into your `config/www` directory.
1. Download and copy `power-distribution-card.js` from the [latest release](https://github.com/ulic75/power-distribution-card/releases/latest) 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 `realtime-energy-distribution-card.js` inside your `configuration.yaml`:
If you configure Dashboards via YAML, add a reference to `power-distribution-card.js` inside your `configuration.yaml`:

```yaml
resources:
- url: /local/realtime-energy-distribution-card.js
- 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/realtime-energy-distribution-card.js` and select type "JavaScript Module".
(Use `/hacsfiles/realtime-energy-distribution-card/realtime-energy-distribution-card.js` and select "JavaScript Module" for HACS install if HACS didn't do it already)
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

Expand All @@ -51,7 +50,7 @@ I recommend looking at the [Example usage section](#example-usage) to understand

| Name | Type | Default | Description |
| ------------------------- | ------ | :-----: | --------------------------------------------------------------------------------------------------------------------------------------- |
| type **_(required)_** | string | | `custom:realtime-energy-distribution-card`. |
| type **_(required)_** | string | | `custom:power-distribution-card`. |
| entities **_(required)_** | map | | One or more sensor entities in a list, see [entities map](#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](#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](#flow-formula). |
Expand All @@ -68,7 +67,7 @@ I recommend looking at the [Example usage section](#example-usage) to understand
### Example usage

```yaml
type: custom:realtime-energy-distribution-card
type: custom:power-distribution-card
title: Realtime Distribution
entities:
battery: sensor.powerwall_battery_now
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "realtime-energy-distribution-card",
"name": "power-distribution-card",
"render_readme": true
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "realtime-energy-distribution-card",
"name": "power-distribution-card",
"version": "1.0.0",
"description": "A realtime energy distribution card for Home Assistant",
"description": "A power distribution card for Home Assistant",
"keywords": [
"home-assistant",
"homeassistant",
Expand All @@ -12,14 +12,14 @@
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/ulic75/realtime-energy-distribution-card.git"
"url": "git+https://github.com/ulic75/power-distribution-card.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/ulic75/realtime-energy-distribution-card/issues"
"url": "https://github.com/ulic75/power-distribution-card/issues"
},
"homepage": "https://github.com/ulic75/realtime-energy-distribution-card#readme",
"homepage": "https://github.com/ulic75/power-distribution-card#readme",
"scripts": {
"build": "rollup -c",
"lint": "eslint src/*",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const serveOptions = {

export default [
{
input: "src/realtime-energy-distribution-card.ts",
input: "src/power-distribution-card.ts",
output: [
{
dir: "./dist",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { LovelaceCardConfig } from "custom-card-helpers";

export interface RealtimeEnergyDistributionCardConfig
extends LovelaceCardConfig {
export interface PowerDistributionCardConfig extends LovelaceCardConfig {
entities: {
battery?: string;
battery_charge?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ import { formatNumber, HomeAssistant } from "custom-card-helpers";
import { css, html, LitElement, svg, TemplateResult } from "lit";
import { customElement, property, query, state } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { RealtimeEnergyDistributionCardConfig } from "./realtime-energy-distribution-card-config.js";
import { PowerDistributionCardConfig } from "./power-distribution-card-config.js";
import { roundValue } from "./utils.js";

const CIRCLE_CIRCUMFERENCE = 238.76104;
const MAX_FLOW_RATE = 6;
const MIN_FLOW_RATE = 0.75;

@customElement("realtime-energy-distribution-card")
export class RealtimeEnergyDistributionCard extends LitElement {
@customElement("power-distribution-card")
export class PowerDistributionCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@state() private _config?: RealtimeEnergyDistributionCardConfig;
@state() private _config?: PowerDistributionCardConfig;

@query("#battery-home-flow") batteryToHomeFlow?: SVGSVGElement;
@query("#grid-home-flow") gridToHomeFlow?: SVGSVGElement;
@query("#solar-battery-flow") solarToBatteryFlow?: SVGSVGElement;
@query("#solar-grid-flow") solarToGridFlow?: SVGSVGElement;
@query("#solar-home-flow") solarToHomeFlow?: SVGSVGElement;

setConfig(config: RealtimeEnergyDistributionCardConfig): void {
setConfig(config: PowerDistributionCardConfig): void {
this._config = {
...config,
min_flow_rate: config.min_flow_rate ?? MIN_FLOW_RATE,
Expand Down Expand Up @@ -639,6 +639,6 @@ export class RealtimeEnergyDistributionCard extends LitElement {

declare global {
interface HTMLElementTagNameMap {
"realtime-energy-distribution-card": RealtimeEnergyDistributionCard;
"power-distribution-card": PowerDistributionCard;
}
}

0 comments on commit 6678525

Please sign in to comment.