From 0e95debe3b6c249fb52e77edc7b78324f945fabe Mon Sep 17 00:00:00 2001 From: MrPrisoner <2877453+MrPrisoner@users.noreply.github.com> Date: Sat, 20 Apr 2024 10:38:55 +0200 Subject: [PATCH 1/5] fix: :bug: secondary info on individual uses incorrect index --- src/components/individualLeftBottomElement.ts | 2 +- src/components/individualLeftTopElement.ts | 2 +- src/components/individualRightBottomElement.ts | 2 +- src/components/individualRightTopElement.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/individualLeftBottomElement.ts b/src/components/individualLeftBottomElement.ts index 72b1fd8..1ad3e56 100644 --- a/src/components/individualLeftBottomElement.ts +++ b/src/components/individualLeftBottomElement.ts @@ -62,7 +62,7 @@ export const individualLeftBottomElement = ( } }} > - ${individualSecondarySpan(hass, main, config, templatesObj, individualObj, 1, "left-bottom")} + ${individualSecondarySpan(hass, main, config, templatesObj, individualObj, indexOfIndividual, "left-bottom")} ${individualObj?.field?.display_zero_state !== false || (individualObj?.state || 0) > (individualObj.displayZeroTolerance ?? 0) ? html` - ${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, 0, "left-top")} + ${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, indexOfIndividual, "left-top")} ${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0) ? html` diff --git a/src/components/individualRightBottomElement.ts b/src/components/individualRightBottomElement.ts index 341a2f1..91e8095 100644 --- a/src/components/individualRightBottomElement.ts +++ b/src/components/individualRightBottomElement.ts @@ -45,7 +45,7 @@ export const individualRightBottomElement = ( } }} > - ${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, 3, "right-bottom")} + ${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, indexOfIndividual, "right-bottom")} ${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0) ? html` diff --git a/src/components/individualRightTopElement.ts b/src/components/individualRightTopElement.ts index b6a47e4..42bdc73 100644 --- a/src/components/individualRightTopElement.ts +++ b/src/components/individualRightTopElement.ts @@ -46,7 +46,7 @@ export const individualRightTopElement = ( } }} > - ${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, 2, "right-top")} + ${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, indexOfIndividual, "right-top")} ${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0) ? html` From 63e60291dda1ace36026e3176b8225bbc9d29c73 Mon Sep 17 00:00:00 2001 From: MrPrisoner <2877453+MrPrisoner@users.noreply.github.com> Date: Sat, 20 Apr 2024 10:39:26 +0200 Subject: [PATCH 2/5] docs: :memo: fix Power Outage table --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1af0e2d..254898f 100644 --- a/README.md +++ b/README.md @@ -266,13 +266,14 @@ This Feature allows you to configure an additional small text for each Individua This feature allows you to configure how the card handles a Grid Power Outage scenario. | Name | Type | Description | -| ------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| ------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | entity | `string` required | Entity ID providing a state that changes when there is a Power Outage. (eg: `binary_sensor.grid_connection_status`). Doesn't need to be a binary_sensor. | | entity_generator | `string` | Entity ID providing the power of a Generator. (eg: `sensor.generator_power`). This is optional, meaning if you don't use this, the card will assume the grid is the only source of power. | | state_alert | `string` | The state the provided entity is at when there is a power outage. Default is `on`, meaning if the entity's state is `on` the card will assume there is a power outage. | | icon_alert | `string` | An icon path to be override the grid icon when there is a power outage. Default is `mdi:transmission-tower-off`. | | label_alert | `string` | A text that will be displayed below the icon when there is a power outage. | -| calculate_flow_rate | `boolean` or `number` | `false` | If set to `true`, the flow rate will be calculated by using the flow rate formula (either the new or the old one, depending on your configuration). If set to a number, the flow rate will be set to that number. For example, defining the value `10` will ensure one dot will flow every 10 seconds. | +| calculate_flow_rate | `boolean` or `number` | `false` | +| | | If set to `true`, the flow rate will be calculated by using the flow rate formula (either the new or the old one, depending on your configuration). If set to a number, the flow rate will be set to that number. For example, defining the value `10` will ensure one dot will flow every 10 seconds. | #### Display Zero Lines From 988486343a1c08e4d4770bde2ca4d59751264e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20F=C3=A9lix?= Date: Sun, 21 Apr 2024 17:03:17 +0200 Subject: [PATCH 3/5] fix: :bug: decimal values not in individual --- src/power-flow-card-plus.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/power-flow-card-plus.ts b/src/power-flow-card-plus.ts index fd36d0c..ea67aa6 100644 --- a/src/power-flow-card-plus.ts +++ b/src/power-flow-card-plus.ts @@ -481,14 +481,13 @@ export class PowerFlowCardPlus extends LitElement { }, }; - /* return source object with largest value property */ const homeLargestSource = Object.keys(homeSources).reduce((a, b) => (homeSources[a].value > homeSources[b].value ? a : b)); const getIndividualDisplayState = (field?: IndividualObject) => { if (!field) return ""; if (field?.state === undefined) return ""; - // return displayValue(this.hass, field?.state, field?.unit, field?.unit_white_space, field?.decimals); return displayValue(this.hass, this._config, field?.state, { + decimals: field?.decimals, unit: field?.unit, unitWhiteSpace: field?.unit_white_space, watt_threshold: this._config.watt_threshold, From 53a2648612834c31be66f85fc8b5f348a229cd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20F=C3=A9lix?= Date: Sun, 21 Apr 2024 17:15:26 +0200 Subject: [PATCH 4/5] fix: :bug: check if there is fossil --- src/components/nonFossil.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/nonFossil.ts b/src/components/nonFossil.ts index a47cb8c..5d21502 100644 --- a/src/components/nonFossil.ts +++ b/src/components/nonFossil.ts @@ -52,7 +52,7 @@ export const nonFossilElement = ( ? html` - ${checkShouldShowDots(config) && nonFossil.has + ${checkShouldShowDots(config) && nonFossil.has && nonFossil.state.power > 0 ? svg` Date: Sun, 21 Apr 2024 17:33:36 +0200 Subject: [PATCH 5/5] fix: :bug: missing unit white space config individual entity --- src/ui-editor/schema/individual.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ui-editor/schema/individual.ts b/src/ui-editor/schema/individual.ts index 3d075c5..49e8a70 100644 --- a/src/ui-editor/schema/individual.ts +++ b/src/ui-editor/schema/individual.ts @@ -56,6 +56,11 @@ const mainSchema = { label: "Show Direction", selector: { boolean: {} }, }, + { + name: "unit_white_space", + label: "Unit White Space", + selector: { boolean: {} }, + }, { name: "use_metadata", label: "Use Metadata",