@@ -6,7 +6,6 @@ import type { HomeAssistant } from "../../../types";
66import type { LovelaceViewConfig } from "../../../data/lovelace/config/view" ;
77import type { LovelaceStrategyConfig } from "../../../data/lovelace/config/strategy" ;
88import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section" ;
9- import type { LovelaceCardConfig } from "../../../data/lovelace/config/card" ;
109import { DEFAULT_ENERGY_COLLECTION_KEY } from "../ha-panel-energy" ;
1110
1211const sourceHasCost = ( source : Record < string , any > ) : boolean =>
@@ -52,10 +51,6 @@ export class EnergyViewStrategy extends ReactiveElement {
5251 source . type === "grid" &&
5352 ( source . flow_from ?. length || source . flow_to ?. length )
5453 ) as GridSourceTypeEnergyPreference ;
55- const hasReturn = hasGrid && hasGrid . flow_to . length > 0 ;
56- const hasSolar = prefs . energy_sources . some (
57- ( source ) => source . type === "solar"
58- ) ;
5954 const hasGas = prefs . energy_sources . some ( ( source ) => source . type === "gas" ) ;
6055 const hasBattery = prefs . energy_sources . some (
6156 ( source ) => source . type === "battery"
@@ -143,43 +138,10 @@ export class EnergyViewStrategy extends ReactiveElement {
143138 modes : [ "bar" ] ,
144139 } ) ;
145140 } else if ( hasGrid ) {
146- const gauges : LovelaceCardConfig [ ] = [ ] ;
147- // Only include if we have a grid source & return.
148- if ( hasReturn ) {
149- gauges . push ( {
150- type : "energy-grid-neutrality-gauge" ,
151- view_layout : { position : "sidebar" } ,
152- collection_key : collectionKey ,
153- } ) ;
154- }
155-
156- gauges . push ( {
157- type : "energy-carbon-consumed-gauge" ,
158- view_layout : { position : "sidebar" } ,
159- collection_key : collectionKey ,
160- } ) ;
161-
162- // Only include if we have a solar source.
163- if ( hasSolar ) {
164- if ( hasReturn ) {
165- gauges . push ( {
166- type : "energy-solar-consumed-gauge" ,
167- view_layout : { position : "sidebar" } ,
168- collection_key : collectionKey ,
169- } ) ;
170- }
171- gauges . push ( {
172- type : "energy-self-sufficiency-gauge" ,
173- view_layout : { position : "sidebar" } ,
174- collection_key : collectionKey ,
175- } ) ;
176- }
177-
178141 electricitySection . cards ! . push ( {
179- type : "grid" ,
180- columns : 2 ,
181- square : false ,
182- cards : gauges ,
142+ title : hass . localize ( "ui.panel.energy.cards.energy_usage_graph_title" ) ,
143+ type : "energy-usage-graph" ,
144+ collection_key : collectionKey ,
183145 } ) ;
184146 }
185147
0 commit comments