From 879d538defa7885c874fee23bdaab184212dd2e3 Mon Sep 17 00:00:00 2001 From: Eric Meyer Date: Thu, 3 Nov 2022 18:29:41 -0600 Subject: [PATCH] Initial takeover commit --- .releaserc.js | 8 +- CHANGELOG.md | 108 ------------------ README.md | 30 ++--- hacs.json | 2 +- package.json | 10 +- rollup.config.js | 2 +- src/logging.ts | 6 +- ...d-config.ts => system-flow-card-config.ts} | 2 +- ...power-flow-card.ts => system-flow-card.ts} | 18 +-- 9 files changed, 39 insertions(+), 147 deletions(-) delete mode 100644 CHANGELOG.md rename src/{power-flow-card-config.ts => system-flow-card-config.ts} (86%) rename src/{power-flow-card.ts => system-flow-card.ts} (98%) diff --git a/.releaserc.js b/.releaserc.js index a4dd0dd..3ed9573 100644 --- a/.releaserc.js +++ b/.releaserc.js @@ -10,12 +10,12 @@ module.exports = { { replacements: [ { - files: ["dist/power-flow-card.js"], - from: /Power Flow Card v(\d+\.\d+\.\d+)/, - to: "Power Flow Card v${nextRelease.version}", + files: ["dist/system-flow-card.js"], + from: /System Flow Card v(\d+\.\d+\.\d+)/, + to: "System Flow Card v${nextRelease.version}", results: [ { - file: "dist/power-flow-card.js", + file: "dist/system-flow-card.js", hasChanged: true, numMatches: 2, numReplacements: 2, diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 1cd1a0f..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,108 +0,0 @@ -### [2.5.1](https://github.com/ulic75/power-distribution-card/compare/v2.5.0...v2.5.1) (2022-07-05) - - -### Bug Fixes - -* smooth out flow dots on safari based guis ([#85](https://github.com/ulic75/power-distribution-card/issues/85)) ([3ce9ebf](https://github.com/ulic75/power-distribution-card/commit/3ce9ebf47a4c638b98f722788946540ed669cda7)), closes [#82](https://github.com/ulic75/power-distribution-card/issues/82) - -## [2.5.0](https://github.com/ulic75/power-distribution-card/compare/v2.4.0...v2.5.0) (2022-05-22) - - -### Features - -* log unavailable/misconfigured entities to browser console ([#61](https://github.com/ulic75/power-distribution-card/issues/61)) ([f32576a](https://github.com/ulic75/power-distribution-card/commit/f32576a58c14666dd75e495e9d4d05a9a9c25cb3)) -* off grid support ([#63](https://github.com/ulic75/power-distribution-card/issues/63)) ([7676356](https://github.com/ulic75/power-distribution-card/commit/7676356d3a6b82269e5cd22ca927c1f2674e6a8e)) - - -### Bug Fixes - -* debounce error logging ([#62](https://github.com/ulic75/power-distribution-card/issues/62)) ([de73d05](https://github.com/ulic75/power-distribution-card/commit/de73d05e5032465956c4b75ecc41c1644bb2ce64)) - -## [2.4.0](https://github.com/ulic75/power-distribution-card/compare/v2.3.0...v2.4.0) (2022-05-18) - - -### Features - -* add new `dashboard_link` option (see readme) ([#46](https://github.com/ulic75/power-distribution-card/issues/46)) ([e979053](https://github.com/ulic75/power-distribution-card/commit/e97905346ec1f66a862f2fa684bf2c4f571a1b7f)) -* support grid<>battery flow ([#53](https://github.com/ulic75/power-distribution-card/issues/53)) ([cf4b7b9](https://github.com/ulic75/power-distribution-card/commit/cf4b7b973c48ca8c74772e32854e6f6cb6ed143a)) -* watt decimals can be configured via w_decimals option ([#52](https://github.com/ulic75/power-distribution-card/issues/52)) ([c15a375](https://github.com/ulic75/power-distribution-card/commit/c15a3754a61aaccfc1f62801915902b2e64756b8)), closes [#45](https://github.com/ulic75/power-distribution-card/issues/45) - -## [2.3.0](https://github.com/ulic75/power-distribution-card/compare/v2.2.0...v2.3.0) (2022-05-13) - - -### Features - -* add new `inverted_entities` option (see readme) ([#43](https://github.com/ulic75/power-distribution-card/issues/43)) ([53200bb](https://github.com/ulic75/power-distribution-card/commit/53200bb99583c5365ef5f760020e6208f4899b41)) -* make power-flow-card available from the ui picker ([#38](https://github.com/ulic75/power-distribution-card/issues/38)) ([fa16d3d](https://github.com/ulic75/power-distribution-card/commit/fa16d3de57ac4e36a25f0a11e2200e185c36deb9)) - -## [2.2.0](https://github.com/ulic75/power-distribution-card/compare/v2.1.1...v2.2.0) (2022-05-11) - - -### Features - -* add new option `kw_decimals` ([#32](https://github.com/ulic75/power-distribution-card/issues/32)) ([a2af9d0](https://github.com/ulic75/power-distribution-card/commit/a2af9d0de134ff803911c88ef5a9c1c8ea38aab5)) - - -### Bug Fixes - -* prevent negative solar state ([#25](https://github.com/ulic75/power-distribution-card/issues/25)) ([162376b](https://github.com/ulic75/power-distribution-card/commit/162376bd9ade661e0094223f911b38a57772c528)), closes [#23](https://github.com/ulic75/power-distribution-card/issues/23) - -### [2.1.1](https://github.com/ulic75/power-distribution-card/compare/v2.1.0...v2.1.1) (2022-05-10) - - -### Bug Fixes - -* round watts to 1 decimal place ([#22](https://github.com/ulic75/power-distribution-card/issues/22)) ([2606dbd](https://github.com/ulic75/power-distribution-card/commit/2606dbd3623e49c3e8418ee75f12c78361052258)) - -## [2.1.0](https://github.com/ulic75/power-distribution-card/compare/v2.0.0...v2.1.0) (2022-05-09) - - -### Features - -* support watts and kilowats ([#18](https://github.com/ulic75/power-distribution-card/issues/18)) ([9596eeb](https://github.com/ulic75/power-distribution-card/commit/9596eebe336cf12798386da1a3bdeebb457cf567)) - -## [2.0.0](https://github.com/ulic75/power-distribution-card/compare/v1.2.0...v2.0.0) (2022-05-09) - - -### ⚠ BREAKING CHANGES - -* card name - -card type will need to be changed from `custom:power-distribution-card` to `custom:power-flow-card` - -### Miscellaneous Chores - -* rename to power-flow-card ([#17](https://github.com/ulic75/power-distribution-card/issues/17)) ([bb26ad7](https://github.com/ulic75/power-distribution-card/commit/bb26ad7a498ddd77f72d81939769c48f786a09bd)), closes [#15](https://github.com/ulic75/power-distribution-card/issues/15) - -## [1.2.0](https://github.com/ulic75/power-distribution-card/compare/v1.1.1...v1.2.0) (2022-05-03) - - -### Features - -* support split consumption/production entities ([#12](https://github.com/ulic75/power-distribution-card/issues/12)) ([da78757](https://github.com/ulic75/power-distribution-card/commit/da78757a54efedf79d34c296dd4029f481ec67ac)), closes [#8](https://github.com/ulic75/power-distribution-card/issues/8) - - -### Bug Fixes - -* always show solar value for consistency ([#9](https://github.com/ulic75/power-distribution-card/issues/9)) ([adf4d15](https://github.com/ulic75/power-distribution-card/commit/adf4d155b74ae78ad93422b8f5fa92189d0d1a29)) -* detection of grid return ([#13](https://github.com/ulic75/power-distribution-card/issues/13)) ([adeee30](https://github.com/ulic75/power-distribution-card/commit/adeee30a75adb67b713d6900dcd6c099c46ed808)) -* display issue without battery_charge entity ([#11](https://github.com/ulic75/power-distribution-card/issues/11)) ([79f84ca](https://github.com/ulic75/power-distribution-card/commit/79f84cac373878334ddff5a8459fdfe5bd5dc342)) - -## [1.1.1](https://github.com/ulic75/power-distribution-card/compare/v1.1.0...v1.1.1) (2022-04-29) - - -### Bug Fixes - -* rename card to power-distribution-card ([6678525](https://github.com/ulic75/power-distribution-card/commit/667852570cf2e5eb06509ac1717c25a91cff6faa)) - -## [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/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/power-distribution-card/issues/2)) ([93e9da1](https://github.com/ulic75/power-distribution-card/commit/93e9da17c9af172a9d3898f8d6dc2f49df5abfac)) diff --git a/README.md b/README.md index 13f3c02..ec776a2 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# Power Flow Card +# System Flow 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/power-flow-card?style=flat-square) -![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ulic75/power-flow-card/CI?style=flat-square) -![GitHub all releases](https://img.shields.io/github/downloads/ulic75/power-flow-card/total?style=flat-square) +![GitHub release (latest by date)](https://img.shields.io/github/v/release/ulic75/system-flow-card?style=flat-square) +![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ulic75/system-flow-card/CI?style=flat-square) +![GitHub all releases](https://img.shields.io/github/downloads/ulic75/system-flow-card/total?style=flat-square) [![ko-fi support](https://img.shields.io/badge/support-me-ff5e5b?style=flat-square&logo=ko-fi)](https://ko-fi.com/ulic75) -This card for [Home Assistant](https://home-assistant.io/) Dashboards is designed to provide power distribution in an identical style to the Official Energy Distribution card included by Home Assistant. +This card for [Home Assistant](https://home-assistant.io/) Dashboards is designed to provide system distribution in an identical style to the Official Energy Distribution card included by Home Assistant. -![power-flow-2 4 0](https://user-images.githubusercontent.com/5641964/169116530-f5ddefc4-6ee1-46cc-b89e-a8d8fabaa892.png) +![system-flow-2 4 0](https://user-images.githubusercontent.com/5641964/169116530-f5ddefc4-6ee1-46cc-b89e-a8d8fabaa892.png) ## Install @@ -19,17 +19,17 @@ This card is available in [HACS](https://hacs.xyz/) (Home Assistant Community St ### Manual install -1. Download and copy `power-flow-card.js` from the [latest release](https://github.com/ulic75/power-flow-card/releases/latest) into your `config/www` directory. +1. Download and copy `system-flow-card.js` from the [latest release](https://github.com/ulic75/system-flow-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 `power-flow-card.js` inside your `configuration.yaml`: +If you configure Dashboards via YAML, add a reference to `system-flow-card.js` inside your `configuration.yaml`: ```yaml resources: - - url: /local/power-flow-card.js + - url: /local/system-flow-card.js type: module ``` @@ -40,8 +40,8 @@ Else, if you prefer the graphical editor, use the menu to add the resource: 3. Click three dot icon 4. Select Resources 5. Hit (+ ADD RESOURCE) icon -6. Enter URL `/local/power-flow-card.js` and select type "JavaScript Module". - (Use `/hacsfiles/power-flow-card/power-flow-card.js` and select "JavaScript Module" for HACS install if HACS didn't do it already) +6. Enter URL `/local/system-flow-card.js` and select type "JavaScript Module". + (Use `/hacsfiles/system-flow-card/system-flow-card.js` and select "JavaScript Module" for HACS install if HACS didn't do it already) ## Using the card @@ -54,7 +54,7 @@ I recommend looking at the [Example usage section](#example-usage) to understand | Name | Type | Default | Description | | ----------------- | -------- | :----------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | `string` | **required** | `custom:power-flow-card`. | +| type | `string` | **required** | `custom:system-flow-card`. | | entities | `object` | **required** | One or more sensor entities, see [entities object](#entities-object) for additional entity options. | | title | `string` | | Shows a title at the top of the card. | | dashboard_link | `string` | | Shows a link to an Energy Dashboard. Should be a url path to location of your choice. If you wanted to link to the built-in dashboard you would enter `/energy` for example. | @@ -92,7 +92,7 @@ Can be use with either Grid or Battery configuration. The same `unit_of_measurem Using combined entities for grid, battery and solor that support positive state values for consumption and negative state values for production. ```yaml -type: custom:power-flow-card +type: custom:system-flow-card entities: battery: sensor.battery_in_out battery_charge: sensor.battery_percent @@ -105,7 +105,7 @@ entities: Using combined entites as above but where the battery and grid entities are inverted (negative = consumption and positive = production). ```yaml -type: custom:power-flow-card +type: custom:system-flow-card entities: battery: sensor.battery_in_out battery_charge: sensor.battery_percent @@ -119,7 +119,7 @@ inverted_entities: battery, grid Using split entities for grid and battery where each consumption and production entity state has a positive value. ```yaml -type: custom:power-flow-card +type: custom:system-flow-card entities: battery: consumption: sensor.battery_out diff --git a/hacs.json b/hacs.json index a048343..7a0f513 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { - "name": "Power Flow Card", + "name": "System Flow Card", "render_readme": true, "homeassistant": "2021.8.0" } diff --git a/package.json b/package.json index aa50f42..7df5ba4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "power-distribution-card", + "name": "system-flow-card", "version": "2.5.1", - "description": "A power distribution card for Home Assistant", + "description": "A system flow card for Home Assistant", "keywords": [ "home-assistant", "homeassistant", @@ -12,14 +12,14 @@ "main": "index.js", "repository": { "type": "git", - "url": "git+https://github.com/ulic75/power-distribution-card.git" + "url": "git+https://github.com/flyrmyr/system-flow-card.git" }, "author": "", "license": "ISC", "bugs": { - "url": "https://github.com/ulic75/power-distribution-card/issues" + "url": "https://github.com/flyrmyr/system-flow-card/issues" }, - "homepage": "https://github.com/ulic75/power-distribution-card#readme", + "homepage": "https://github.com/flyrmyr/system-flow-card#readme", "scripts": { "build": "rollup -c", "lint": "eslint src/*", diff --git a/rollup.config.js b/rollup.config.js index 7776a4f..6804e5e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -20,7 +20,7 @@ const serveOptions = { export default [ { - input: "src/power-flow-card.ts", + input: "src/system-flow-card.ts", output: [ { dir: "./dist", diff --git a/src/logging.ts b/src/logging.ts index 8e9ada0..3e7d785 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -4,15 +4,15 @@ import { version } from "../package.json"; // Log Version console.groupCollapsed( - `%c⚡ Power Flow Card v${version} is installed`, + `%c⚡ System Flow Card v${version} is installed`, "color: #488fc2; font-weight: bold" ); -console.log("Readme:", "https://github.com/ulic75/power-flow-card"); +console.log("Readme:", "https://github.com/ulic75/system-flow-card"); console.groupEnd(); export const logError = debounce((error: string) => { console.log( - `%c⚡ Power Flow Card v${version} %cError: ${error}`, + `%c⚡ System Flow Card v${version} %cError: ${error}`, "color: #488fc2; font-weight: bold", "color: #b33a3a; font-weight: normal" ); diff --git a/src/power-flow-card-config.ts b/src/system-flow-card-config.ts similarity index 86% rename from src/power-flow-card-config.ts rename to src/system-flow-card-config.ts index d37e597..4f5e775 100644 --- a/src/power-flow-card-config.ts +++ b/src/system-flow-card-config.ts @@ -1,7 +1,7 @@ import { LovelaceCardConfig } from "custom-card-helpers"; import { ComboEntity } from "./type.js"; -export interface PowerFlowCardConfig extends LovelaceCardConfig { +export interface SystemFlowCardConfig extends LovelaceCardConfig { entities: { battery?: string | ComboEntity; battery_charge?: string; diff --git a/src/power-flow-card.ts b/src/system-flow-card.ts similarity index 98% rename from src/power-flow-card.ts rename to src/system-flow-card.ts index 4600e32..625323d 100644 --- a/src/power-flow-card.ts +++ b/src/system-flow-card.ts @@ -17,7 +17,7 @@ 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 { PowerFlowCardConfig } from "./power-flow-card-config.js"; +import { SystemFlowCardConfig } from "./system-flow-card-config.js"; import { coerceNumber, coerceStringArray, @@ -33,10 +33,10 @@ const MAX_FLOW_RATE = 6; const MIN_FLOW_RATE = 0.75; const W_DECIMALS = 1; -@customElement("power-flow-card") -export class PowerFlowCard extends LitElement { +@customElement("system-flow-card") +export class SystemFlowCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @state() private _config?: PowerFlowCardConfig; + @state() private _config?: SystemFlowCardConfig; @query("#battery-grid-flow") batteryGridFlow?: SVGSVGElement; @query("#battery-home-flow") batteryToHomeFlow?: SVGSVGElement; @@ -45,7 +45,7 @@ export class PowerFlowCard extends LitElement { @query("#solar-grid-flow") solarToGridFlow?: SVGSVGElement; @query("#solar-home-flow") solarToHomeFlow?: SVGSVGElement; - setConfig(config: PowerFlowCardConfig): void { + setConfig(config: SystemFlowCardConfig): void { if ( !config.entities || (!config.entities.battery && @@ -907,14 +907,14 @@ const windowWithCards = window as unknown as Window & { }; windowWithCards.customCards = windowWithCards.customCards || []; windowWithCards.customCards.push({ - type: "power-flow-card", - name: "Power Flow Card", + type: "system-flow-card", + name: "System Flow Card", description: - "A power distribution card inspired by the official Energy Distribution card for Home Assistant", + "A system distribution card inspired by the official Energy Distribution card for Home Assistant", }); declare global { interface HTMLElementTagNameMap { - "power-flow-card": PowerFlowCard; + "system-flow-card": SystemFlowCard; } }