Skip to content

Commit

Permalink
Fix energy consumer grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
davet2001 committed Jan 29, 2025
1 parent cbf3fca commit 997b092
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const ENERGY_CARD_NAME = `${PREFIX_NAME}-energy-elec-flow-card`;
export const ENERGY_CARD_EDITOR_NAME = `${ENERGY_CARD_NAME}-editor`;

export const HIDE_CONSUMERS_BELOW_THRESHOLD_W = 100;
export const HIDE_CONSUMERS_BELOW_THRESHOLD_WH = 100;
export const HIDE_CONSUMERS_BELOW_THRESHOLD_KWH = 0.1;

export const GENERIC_LABELS = [
"appearance",
Expand Down
9 changes: 6 additions & 3 deletions src/hui-energy-elec-flow-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { EnergyElecFlowCardConfig } from "./types";
import { registerCustomCard } from "./utils/custom-cards";
import {
ENERGY_CARD_EDITOR_NAME,
HIDE_CONSUMERS_BELOW_THRESHOLD_WH,
HIDE_CONSUMERS_BELOW_THRESHOLD_KWH,
} from "./const";

registerCustomCard({
Expand Down Expand Up @@ -88,8 +88,10 @@ export class HuiEnergyElecFlowCard
if (!this.hass || !this._config) {
return nothing;
}
const hideConsumersBelow = this._config.hide_consumers_below
? HIDE_CONSUMERS_BELOW_THRESHOLD_WH : 0;

const maxConsumerBranches = this._config.max_consumer_branches || 0;
const hideConsumersBelow = this._config.hide_small_consumers
? HIDE_CONSUMERS_BELOW_THRESHOLD_KWH : 0;
return html`
<ha-card>
${this._config.title
Expand All @@ -106,6 +108,7 @@ export class HuiEnergyElecFlowCard
.gridOutRoute=${this._gridOutRoute || undefined}
.generationInRoutes=${this._generationInRoutes || {}}
.consumerRoutes=${this._consumerRoutes || {}}
.maxConsumerBranches=${maxConsumerBranches}
.hideConsumersBelow=${hideConsumersBelow}
></ha-elec-sankey>
</div>
Expand Down

0 comments on commit 997b092

Please sign in to comment.