Skip to content

Commit

Permalink
Merge branch 'v0.2.2-release' into 567-bug-v021-individual-doesnt-sho…
Browse files Browse the repository at this point in the history
…w-secondary-info
  • Loading branch information
flixlix authored Apr 21, 2024
2 parents d31dec9 + ebdbe77 commit 29dc608
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "power-flow-card-plus",
"version": "0.2.1",
"version": "0.2.2",
"description": "A power flow card for Home Assistant",
"keywords": [
"home-assistant",
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualLeftBottomElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?.icon !== " " ? html` <ha-icon id="individual-left-bottom-icon" .icon=${individualObj?.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj?.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-bottom individual-left-bottom"
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualLeftTopElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const individualLeftTopElement = (
}
}}
>
${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, 0, "left-top")}
${individualSecondarySpan(main.hass, main, config, templatesObj, individualObj, indexOfIndividual, "left-top")}
${individualObj.icon !== " " ? html` <ha-icon id="individual-left-top-icon" .icon=${individualObj.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-top individual-left-top">
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualRightBottomElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.icon !== " " ? html` <ha-icon id="individual-right-bottom-icon" .icon=${individualObj.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-bottom individual-right-bottom">
Expand Down
2 changes: 1 addition & 1 deletion src/components/individualRightTopElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.icon !== " " ? html` <ha-icon id="individual-right-top-icon" .icon=${individualObj.icon} />` : null}
${individualObj?.field?.display_zero_state !== false || (individualObj.state || 0) > (individualObj.displayZeroTolerance ?? 0)
? html` <span class="individual-top individual-right-top">
Expand Down
2 changes: 1 addition & 1 deletion src/components/nonFossil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const nonFossilElement = (
? html`
<svg width="80" height="30">
<path d="M40 -10 v40" class="low-carbon ${styleLine(nonFossil.state.power || 0, config)}" id="low-carbon" />
${checkShouldShowDots(config) && nonFossil.has
${checkShouldShowDots(config) && nonFossil.has && nonFossil.state.power > 0
? svg`<circle
r="1.75"
class="low-carbon"
Expand Down
3 changes: 1 addition & 2 deletions src/power-flow-card-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions src/ui-editor/schema/individual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 29dc608

Please sign in to comment.