Skip to content

Commit

Permalink
Merge pull request #9 from flixlix/revert-7-revert-6-change-to-plus
Browse files Browse the repository at this point in the history
Revert "Revert "Change Card name and type to "...-plus"""
  • Loading branch information
flixlix authored Mar 25, 2023
2 parents 271aa18 + fca33d4 commit ed455b5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ module.exports = {
{
replacements: [
{
files: ["dist/power-flow-card.js"],
files: ["dist/power-flow-card-plus.js"],
from: /Power Flow Card v(\d+\.\d+\.\d+)/,
to: "Power Flow Card v${nextRelease.version}",
results: [
{
file: "dist/power-flow-card.js",
file: "dist/power-flow-card-plus.js",
hasChanged: true,
numMatches: 2,
numReplacements: 2,
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ To install this:

### Manual install

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.
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.

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 `power-flow-card-plus.js` inside your `configuration.yaml`:

```yaml
resources:
- url: /local/power-flow-card.js
- url: /local/power-flow-card-plus.js
type: module
```
Expand All @@ -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.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/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)

## Using the card

Expand All @@ -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`. |
| type | `string` | **required** | `custom:power-flow-card-plus`. |
| 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. |
Expand Down Expand Up @@ -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
type: custom:power-flow-card-plus
entities:
battery: sensor.battery_in_out
battery_charge: sensor.battery_percent
Expand All @@ -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
type: custom:power-flow-card-plus
entities:
battery: sensor.battery_in_out
battery_charge: sensor.battery_percent
Expand All @@ -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
type: custom:power-flow-card-plus
entities:
battery:
consumption: sensor.battery_out
Expand Down Expand Up @@ -166,7 +166,7 @@ Using individual devices for consumption.
##### Example using individual devices

```yaml
type: custom:power-flow-card
type: custom:power-flow-card-plus
entities:
grid:
production:
Expand Down Expand Up @@ -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
type: custom:power-flow-card-plus
entities:
grid:
production:
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const serveOptions = {

export default [
{
input: "src/power-flow-card.ts",
input: "src/power-flow-card-plus.ts",
output: [
{
dir: "./dist",
Expand Down
2 changes: 1 addition & 1 deletion src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/ulic75/power-flow-card");
console.log("Readme:", "https://github.com/flixlix/power-flow-card-plus");
console.groupEnd();

export const logError = debounce((error: string) => {
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/power-flow-card.ts → src/power-flow-card-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 { PowerFlowCardConfig } from "./power-flow-card-plus-config.js";
import {
coerceNumber,
coerceStringArray,
Expand All @@ -33,7 +33,7 @@ const MAX_FLOW_RATE = 6;
const MIN_FLOW_RATE = 0.75;
const W_DECIMALS = 1;

@customElement("power-flow-card")
@customElement("power-flow-card-plus")
export class PowerFlowCard extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@state() private _config = {} as PowerFlowCardConfig;
Expand Down Expand Up @@ -1396,14 +1396,14 @@ const windowWithCards = window as unknown as Window & {
};
windowWithCards.customCards = windowWithCards.customCards || [];
windowWithCards.customCards.push({
type: "power-flow-card",
name: "Power Flow Card",
type: "power-flow-card-plus",
name: "Power Flow Card Plus",
description:
"A power distribution card inspired by the official Energy Distribution card for Home Assistant",
});

declare global {
interface HTMLElementTagNameMap {
"power-flow-card": PowerFlowCard;
"power-flow-card-plus": PowerFlowCard;
}
}

0 comments on commit ed455b5

Please sign in to comment.