From 472ae7f6b5c65e43b83dc24def816ae399ee1ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20F=C3=A9lix?= <61006057+flixlix@users.noreply.github.com> Date: Sat, 25 Mar 2023 13:52:22 +0100 Subject: [PATCH] Revert "Change Card name and type to "...-plus"" --- .releaserc.js | 4 ++-- README.md | 22 +++++++++---------- rollup.config.js | 2 +- src/logging.ts | 2 +- ...us-config.ts => power-flow-card-config.ts} | 0 ...r-flow-card-plus.ts => power-flow-card.ts} | 10 ++++----- 6 files changed, 20 insertions(+), 20 deletions(-) rename src/{power-flow-card-plus-config.ts => power-flow-card-config.ts} (100%) rename src/{power-flow-card-plus.ts => power-flow-card.ts} (99%) diff --git a/.releaserc.js b/.releaserc.js index 3cf95b2..a4dd0dd 100644 --- a/.releaserc.js +++ b/.releaserc.js @@ -10,12 +10,12 @@ module.exports = { { replacements: [ { - files: ["dist/power-flow-card-plus.js"], + files: ["dist/power-flow-card.js"], from: /Power Flow Card v(\d+\.\d+\.\d+)/, to: "Power Flow Card v${nextRelease.version}", results: [ { - file: "dist/power-flow-card-plus.js", + file: "dist/power-flow-card.js", hasChanged: true, numMatches: 2, numReplacements: 2, diff --git a/README.md b/README.md index aafeebf..24af14f 100644 --- a/README.md +++ b/README.md @@ -35,17 +35,17 @@ To install this: ### Manual install -1. Download and copy `power-flow-card-plus.js` from the [latest release](https://github.com/flixlix/power-flow-card-plus/releases/latest) into your `config/www` directory. +1. Download and copy `power-flow-card.js` from the [latest release](https://github.com/flixlix/power-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-plus.js` inside your `configuration.yaml`: +If you configure Dashboards via YAML, add a reference to `power-flow-card.js` inside your `configuration.yaml`: ```yaml resources: - - url: /local/power-flow-card-plus.js + - url: /local/power-flow-card.js type: module ``` @@ -56,8 +56,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-plus.js` and select type "JavaScript Module". - (Use `/hacsfiles/power-flow-card-plus/power-flow-card-plus.js` and select "JavaScript Module" for HACS install if HACS didn't do it already) +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) ## Using the card @@ -70,7 +70,7 @@ I recommend looking at the [Example usage section](#example-usage) to understand | Name | Type | Default | Description | | ------------------ | --------- | :----------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| type | `string` | **required** | `custom:power-flow-card-plus`. | +| type | `string` | **required** | `custom:power-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. | @@ -111,7 +111,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-plus +type: custom:power-flow-card entities: battery: sensor.battery_in_out battery_charge: sensor.battery_percent @@ -124,7 +124,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-plus +type: custom:power-flow-card entities: battery: sensor.battery_in_out battery_charge: sensor.battery_percent @@ -138,7 +138,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-plus +type: custom:power-flow-card entities: battery: consumption: sensor.battery_out @@ -166,7 +166,7 @@ Using individual devices for consumption. ##### Example using individual devices ```yaml -type: custom:power-flow-card-plus +type: custom:power-flow-card entities: grid: production: @@ -214,7 +214,7 @@ I'm not 100% happy with this. I'd prefer to see the dots travel slower when flow This example aims to show you what is possible using this card, I don't recommend copying and pasting it without understanding what each property does. ``` -type: custom:power-flow-card-plus +type: custom:power-flow-card entities: grid: production: diff --git a/rollup.config.js b/rollup.config.js index b531b65..7776a4f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -20,7 +20,7 @@ const serveOptions = { export default [ { - input: "src/power-flow-card-plus.ts", + input: "src/power-flow-card.ts", output: [ { dir: "./dist", diff --git a/src/logging.ts b/src/logging.ts index 19c0f71..8e9ada0 100644 --- a/src/logging.ts +++ b/src/logging.ts @@ -7,7 +7,7 @@ console.groupCollapsed( `%c⚡ Power Flow Card v${version} is installed`, "color: #488fc2; font-weight: bold" ); -console.log("Readme:", "https://github.com/flixlix/power-flow-card-plus"); +console.log("Readme:", "https://github.com/ulic75/power-flow-card"); console.groupEnd(); export const logError = debounce((error: string) => { diff --git a/src/power-flow-card-plus-config.ts b/src/power-flow-card-config.ts similarity index 100% rename from src/power-flow-card-plus-config.ts rename to src/power-flow-card-config.ts diff --git a/src/power-flow-card-plus.ts b/src/power-flow-card.ts similarity index 99% rename from src/power-flow-card-plus.ts rename to src/power-flow-card.ts index 46ef3c4..b937948 100644 --- a/src/power-flow-card-plus.ts +++ b/src/power-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-plus-config.js"; +import { PowerFlowCardConfig } from "./power-flow-card-config.js"; import { coerceNumber, coerceStringArray, @@ -33,7 +33,7 @@ const MAX_FLOW_RATE = 6; const MIN_FLOW_RATE = 0.75; const W_DECIMALS = 1; -@customElement("power-flow-card-plus") +@customElement("power-flow-card") export class PowerFlowCard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @state() private _config = {} as PowerFlowCardConfig; @@ -1396,14 +1396,14 @@ const windowWithCards = window as unknown as Window & { }; windowWithCards.customCards = windowWithCards.customCards || []; windowWithCards.customCards.push({ - type: "power-flow-card-plus", - name: "Power Flow Card Plus", + type: "power-flow-card", + name: "Power Flow Card", description: "A power distribution card inspired by the official Energy Distribution card for Home Assistant", }); declare global { interface HTMLElementTagNameMap { - "power-flow-card-plus": PowerFlowCard; + "power-flow-card": PowerFlowCard; } }