Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 Fix Secondary info decimals #296

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/power-flow-card-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export class PowerFlowCardPlus extends LitElement {
},
secondary: {
entity: entities.grid?.secondary_info?.entity,
decimals: entities.grid?.secondary_info?.decimals,
template: entities.grid?.secondary_info?.template,
has: this.hasField(entities.grid?.secondary_info, true),
state: initialSecondaryState,
Expand All @@ -354,6 +355,7 @@ export class PowerFlowCardPlus extends LitElement {
name: this.computeFieldName(entities.solar, this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.solar")),
secondary: {
entity: entities.solar?.secondary_info?.entity,
decimals: entities.solar?.secondary_info?.decimals,
template: entities.solar?.secondary_info?.template,
has: this.hasField(entities.solar?.secondary_info, true),
state: initialSecondaryState,
Expand Down Expand Up @@ -1044,7 +1046,7 @@ export class PowerFlowCardPlus extends LitElement {
className: key,
entityId: field.secondary.entity,
icon: field.secondary.icon,
value: this.displayValue(field.secondary.state, field.secondary.unit, field.secondary.unit_white_space),
value: this.displayValue(field.secondary.state, field.secondary.unit, field.secondary.unit_white_space, field.secondary.decimals),
template: templatesObj[`${key}Secondary`],
})}`
: ""}`;
Expand Down Expand Up @@ -1676,12 +1678,14 @@ export class PowerFlowCardPlus extends LitElement {
id="solar-battery-flow"
class="flat-line"
>
<path id="battery-solar" class="battery-solar ${this.styleLine(
solar.state.toBattery || 0
)}" d="M50,0 V100" vector-effect="non-scaling-stroke"></path>
${
solar.state.toBattery
? svg`<circle
<path
id="battery-solar"
class="battery-solar ${this.styleLine(solar.state.toBattery || 0)}"
d="M50,0 V100"
vector-effect="non-scaling-stroke"
></path>
${solar.state.toBattery
? svg`<circle
r="1"
class="battery-solar"
vector-effect="non-scaling-stroke"
Expand All @@ -1694,8 +1698,7 @@ export class PowerFlowCardPlus extends LitElement {
<mpath xlink:href="#battery-solar" />
</animateMotion>
</circle>`
: ""
}
: ""}
</svg>
</div>`
: ""}
Expand Down
2 changes: 0 additions & 2 deletions src/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export const styles = css`
--transparency: var(--transparency-unused-lines);
--greyed-out--line-color: #bdbdbd;
}
:root {
}

ha-card.full-size {
height: 100%;
Expand Down
1 change: 1 addition & 0 deletions src/ui-editor/schema/_schema-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const secondaryInfoSchema = [
schema: [
{ name: "icon", selector: { icon: {} } },
{ name: "unit_of_measurement", label: "Unit of Measurement", selector: { text: {} } },
{ name: "decimals", label: "Decimals", selector: { number: { mode: "box", min: 0, max: 10, step: 1 } } },
{ name: "color_value", label: "Color Value", selector: { boolean: {} } },
{ name: "unit_white_space", label: "Unit White Space", selector: { boolean: {} } },
{ name: "display_zero", label: "Display Zero", selector: { boolean: {} } },
Expand Down