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

Use EnergyCardBaseConfig where appropriate #20896

Merged
merged 5 commits into from
Jun 21, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { calculateStatisticsSumGrowth } from "../../../../data/recorder";
import { SubscribeMixin } from "../../../../mixins/subscribe-mixin";
import type { HomeAssistant } from "../../../../types";
import type { LovelaceCard } from "../../types";
import type { EnergyGridGaugeCardConfig } from "../types";
import type { EnergyGridNeutralityGaugeCardConfig } from "../types";
import { hasConfigChanged } from "../../common/has-changed";

const LEVELS: LevelDefinition[] = [
Expand All @@ -39,7 +39,7 @@ class HuiEnergyGridGaugeCard
{
@property({ attribute: false }) public hass?: HomeAssistant;

@state() private _config?: EnergyGridGaugeCardConfig;
@state() private _config?: EnergyGridNeutralityGaugeCardConfig;

@state() private _data?: EnergyData;

Expand All @@ -59,7 +59,7 @@ class HuiEnergyGridGaugeCard
return 4;
}

public setConfig(config: EnergyGridGaugeCardConfig): void {
public setConfig(config: EnergyGridNeutralityGaugeCardConfig): void {
this._config = config;
}

Expand Down
43 changes: 16 additions & 27 deletions src/panels/lovelace/cards/types.ts
TurnrDev marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -118,85 +118,74 @@ export interface EnergyCardBaseConfig extends LovelaceCardConfig {
collection_key?: string;
}

export interface EnergySummaryCardConfig extends LovelaceCardConfig {
export interface EnergySummaryCardConfig extends EnergyCardBaseConfig {
type: "energy-summary";
title?: string;
collection_key?: string;
}

export interface EnergyDistributionCardConfig extends LovelaceCardConfig {
export interface EnergyDistributionCardConfig extends EnergyCardBaseConfig {
type: "energy-distribution";
title?: string;
link_dashboard?: boolean;
collection_key?: string;
}
export interface EnergyUsageGraphCardConfig extends LovelaceCardConfig {
export interface EnergyUsageGraphCardConfig extends EnergyCardBaseConfig {
type: "energy-usage-graph";
title?: string;
collection_key?: string;
}

export interface EnergySolarGraphCardConfig extends LovelaceCardConfig {
export interface EnergySolarGraphCardConfig extends EnergyCardBaseConfig {
type: "energy-solar-graph";
title?: string;
collection_key?: string;
}

export interface EnergyGasGraphCardConfig extends LovelaceCardConfig {
export interface EnergyGasGraphCardConfig extends EnergyCardBaseConfig {
type: "energy-gas-graph";
title?: string;
collection_key?: string;
}

export interface EnergyWaterGraphCardConfig extends LovelaceCardConfig {
export interface EnergyWaterGraphCardConfig extends EnergyCardBaseConfig {
type: "energy-water-graph";
title?: string;
collection_key?: string;
}

export interface EnergyDevicesGraphCardConfig extends LovelaceCardConfig {
export interface EnergyDevicesGraphCardConfig extends EnergyCardBaseConfig {
type: "energy-devices-graph";
title?: string;
collection_key?: string;
max_devices?: number;
}

export interface EnergyDevicesDetailGraphCardConfig extends LovelaceCardConfig {
export interface EnergyDevicesDetailGraphCardConfig
extends EnergyCardBaseConfig {
type: "energy-devices-detail-graph";
title?: string;
collection_key?: string;
max_devices?: number;
}

export interface EnergySourcesTableCardConfig extends LovelaceCardConfig {
export interface EnergySourcesTableCardConfig extends EnergyCardBaseConfig {
type: "energy-sources-table";
title?: string;
collection_key?: string;
}

export interface EnergySolarGaugeCardConfig extends LovelaceCardConfig {
export interface EnergySolarGaugeCardConfig extends EnergyCardBaseConfig {
type: "energy-solar-consumed-gauge";
title?: string;
collection_key?: string;
}

export interface EnergySelfSufficiencyGaugeCardConfig
extends LovelaceCardConfig {
extends EnergyCardBaseConfig {
type: "energy-self-sufficiency-gauge";
title?: string;
collection_key?: string;
}

export interface EnergyGridGaugeCardConfig extends LovelaceCardConfig {
type: "energy-grid-result-gauge";
export interface EnergyGridNeutralityGaugeCardConfig
extends EnergyCardBaseConfig {
type: "energy-grid-neutrality-gauge";
title?: string;
collection_key?: string;
}

export interface EnergyCarbonGaugeCardConfig extends LovelaceCardConfig {
export interface EnergyCarbonGaugeCardConfig extends EnergyCardBaseConfig {
type: "energy-carbon-consumed-gauge";
title?: string;
collection_key?: string;
}

export interface EntityFilterCardConfig extends LovelaceCardConfig {
Expand Down
Loading