Skip to content

Commit

Permalink
Merge pull request #55 from flixlix/53-feature-request-secondary-info…
Browse files Browse the repository at this point in the history
…-shows-decimals

feat: add secondary decimals
  • Loading branch information
flixlix committed Jun 13, 2023
2 parents 30f9563 + e20a2bd commit f44c8a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/energy-flow-card-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ export default class EnergyFlowCardPlus extends SubscribeMixin(LitElement) {
icon: entities.grid?.secondary_info?.icon,
unit: entities.grid?.secondary_info?.unit_of_measurement,
unit_white_space: entities.grid?.secondary_info?.unit_white_space,
decimals: entities.grid?.secondary_info?.decimals,
energyDateSelection: entities.grid?.secondary_info?.energy_date_selection || false,
color: {
type: entities.grid?.secondary_info?.color_value,
Expand All @@ -465,6 +466,7 @@ export default class EnergyFlowCardPlus extends SubscribeMixin(LitElement) {
state: initialSecondaryState,
icon: entities.solar?.secondary_info?.icon,
unit: entities.solar?.secondary_info?.unit_of_measurement,
decimals: entities.solar?.secondary_info?.decimals,
unit_white_space: entities.solar?.secondary_info?.unit_white_space,
energyDateSelection: entities.solar?.secondary_info?.energy_date_selection || false,
},
Expand Down Expand Up @@ -544,6 +546,7 @@ export default class EnergyFlowCardPlus extends SubscribeMixin(LitElement) {
unit: entities[field]?.secondary_info?.unit_of_measurement,
unit_white_space: entities[field]?.secondary_info?.unit_white_space,
displayZero: entities[field]?.secondary_info?.display_zero,
decimals: entities[field]?.secondary_info?.decimals,
displayZeroTolerance: entities[field]?.secondary_info?.display_zero_tolerance,
energyDateSelection: entities[field]?.secondary_info?.energy_date_selection || false,
},
Expand Down Expand Up @@ -1132,7 +1135,7 @@ export default class EnergyFlowCardPlus extends SubscribeMixin(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),
})}`
: ''}`;
};
Expand Down
3 changes: 2 additions & 1 deletion src/ui-editor/schema/_schema-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ export const secondaryInfoSchema = [
{ name: 'unit_of_measurement', label: 'Unit of Measurement', selector: { text: {} } },
{ 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: {} } },
{ name: 'display_zero_tolerance', label: 'Display Zero Tolerance', selector: { number: { mode: 'box', min: 0, max: 1000000, step: 0.1 } } },
{ name: 'decimals', label: 'Decimals', selector: { number: { mode: 'box', min: 0, max: 10, step: 1 } } },
{ name: 'display_zero', label: 'Display Zero', selector: { boolean: {} } },
{ name: 'energy_date_selection', label: 'Energy Date Selection', selector: { boolean: {} } },
],
},
Expand Down

0 comments on commit f44c8a9

Please sign in to comment.