mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Use EnergyCardBaseConfig where appropriate (#20896)
* Use EnergyCardBaseConfig where appropriate * Update type key * Rename class * Run prettier
This commit is contained in:
parent
686424fc70
commit
eb0579ddc5
@ -24,7 +24,7 @@ import { calculateStatisticsSumGrowth } from "../../../../data/recorder";
|
|||||||
import { SubscribeMixin } from "../../../../mixins/subscribe-mixin";
|
import { SubscribeMixin } from "../../../../mixins/subscribe-mixin";
|
||||||
import type { HomeAssistant } from "../../../../types";
|
import type { HomeAssistant } from "../../../../types";
|
||||||
import type { LovelaceCard } from "../../types";
|
import type { LovelaceCard } from "../../types";
|
||||||
import type { EnergyGridGaugeCardConfig } from "../types";
|
import type { EnergyGridNeutralityGaugeCardConfig } from "../types";
|
||||||
import { hasConfigChanged } from "../../common/has-changed";
|
import { hasConfigChanged } from "../../common/has-changed";
|
||||||
|
|
||||||
const LEVELS: LevelDefinition[] = [
|
const LEVELS: LevelDefinition[] = [
|
||||||
@ -39,7 +39,7 @@ class HuiEnergyGridGaugeCard
|
|||||||
{
|
{
|
||||||
@property({ attribute: false }) public hass?: HomeAssistant;
|
@property({ attribute: false }) public hass?: HomeAssistant;
|
||||||
|
|
||||||
@state() private _config?: EnergyGridGaugeCardConfig;
|
@state() private _config?: EnergyGridNeutralityGaugeCardConfig;
|
||||||
|
|
||||||
@state() private _data?: EnergyData;
|
@state() private _data?: EnergyData;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class HuiEnergyGridGaugeCard
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setConfig(config: EnergyGridGaugeCardConfig): void {
|
public setConfig(config: EnergyGridNeutralityGaugeCardConfig): void {
|
||||||
this._config = config;
|
this._config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,85 +118,74 @@ export interface EnergyCardBaseConfig extends LovelaceCardConfig {
|
|||||||
collection_key?: string;
|
collection_key?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergySummaryCardConfig extends LovelaceCardConfig {
|
export interface EnergySummaryCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-summary";
|
type: "energy-summary";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergyDistributionCardConfig extends LovelaceCardConfig {
|
export interface EnergyDistributionCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-distribution";
|
type: "energy-distribution";
|
||||||
title?: string;
|
title?: string;
|
||||||
link_dashboard?: boolean;
|
link_dashboard?: boolean;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
export interface EnergyUsageGraphCardConfig extends LovelaceCardConfig {
|
export interface EnergyUsageGraphCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-usage-graph";
|
type: "energy-usage-graph";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergySolarGraphCardConfig extends LovelaceCardConfig {
|
export interface EnergySolarGraphCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-solar-graph";
|
type: "energy-solar-graph";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergyGasGraphCardConfig extends LovelaceCardConfig {
|
export interface EnergyGasGraphCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-gas-graph";
|
type: "energy-gas-graph";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergyWaterGraphCardConfig extends LovelaceCardConfig {
|
export interface EnergyWaterGraphCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-water-graph";
|
type: "energy-water-graph";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergyDevicesGraphCardConfig extends LovelaceCardConfig {
|
export interface EnergyDevicesGraphCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-devices-graph";
|
type: "energy-devices-graph";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
max_devices?: number;
|
max_devices?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergyDevicesDetailGraphCardConfig extends LovelaceCardConfig {
|
export interface EnergyDevicesDetailGraphCardConfig
|
||||||
|
extends EnergyCardBaseConfig {
|
||||||
type: "energy-devices-detail-graph";
|
type: "energy-devices-detail-graph";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
max_devices?: number;
|
max_devices?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergySourcesTableCardConfig extends LovelaceCardConfig {
|
export interface EnergySourcesTableCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-sources-table";
|
type: "energy-sources-table";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergySolarGaugeCardConfig extends LovelaceCardConfig {
|
export interface EnergySolarGaugeCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-solar-consumed-gauge";
|
type: "energy-solar-consumed-gauge";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergySelfSufficiencyGaugeCardConfig
|
export interface EnergySelfSufficiencyGaugeCardConfig
|
||||||
extends LovelaceCardConfig {
|
extends EnergyCardBaseConfig {
|
||||||
type: "energy-self-sufficiency-gauge";
|
type: "energy-self-sufficiency-gauge";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergyGridGaugeCardConfig extends LovelaceCardConfig {
|
export interface EnergyGridNeutralityGaugeCardConfig
|
||||||
type: "energy-grid-result-gauge";
|
extends EnergyCardBaseConfig {
|
||||||
|
type: "energy-grid-neutrality-gauge";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EnergyCarbonGaugeCardConfig extends LovelaceCardConfig {
|
export interface EnergyCarbonGaugeCardConfig extends EnergyCardBaseConfig {
|
||||||
type: "energy-carbon-consumed-gauge";
|
type: "energy-carbon-consumed-gauge";
|
||||||
title?: string;
|
title?: string;
|
||||||
collection_key?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EntityFilterCardConfig extends LovelaceCardConfig {
|
export interface EntityFilterCardConfig extends LovelaceCardConfig {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user