From 6252955bb5cee4d9c28b76149814186f0b9ba728 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 23 Sep 2022 09:03:17 +0200 Subject: [PATCH] Simplify energy settings (#13846) --- demo/src/stubs/energy.ts | 5 ----- src/data/energy.ts | 8 +------- .../config/energy/dialogs/dialog-energy-gas-settings.ts | 1 - .../energy/dialogs/dialog-energy-grid-flow-settings.ts | 3 --- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/demo/src/stubs/energy.ts b/demo/src/stubs/energy.ts index 00e7ef7c3f..80f10b968c 100644 --- a/demo/src/stubs/energy.ts +++ b/demo/src/stubs/energy.ts @@ -11,14 +11,12 @@ export const mockEnergy = (hass: MockHomeAssistant) => { { stat_energy_from: "sensor.energy_consumption_tarif_1", stat_cost: "sensor.energy_consumption_tarif_1_cost", - entity_energy_from: "sensor.energy_consumption_tarif_1", entity_energy_price: null, number_energy_price: null, }, { stat_energy_from: "sensor.energy_consumption_tarif_2", stat_cost: "sensor.energy_consumption_tarif_2_cost", - entity_energy_from: "sensor.energy_consumption_tarif_2", entity_energy_price: null, number_energy_price: null, }, @@ -27,14 +25,12 @@ export const mockEnergy = (hass: MockHomeAssistant) => { { stat_energy_to: "sensor.energy_production_tarif_1", stat_compensation: "sensor.energy_production_tarif_1_compensation", - entity_energy_to: "sensor.energy_production_tarif_1", entity_energy_price: null, number_energy_price: null, }, { stat_energy_to: "sensor.energy_production_tarif_2", stat_compensation: "sensor.energy_production_tarif_2_compensation", - entity_energy_to: "sensor.energy_production_tarif_2", entity_energy_price: null, number_energy_price: null, }, @@ -55,7 +51,6 @@ export const mockEnergy = (hass: MockHomeAssistant) => { type: "gas", stat_energy_from: "sensor.energy_gas", stat_cost: "sensor.energy_gas_cost", - entity_energy_from: "sensor.energy_gas", entity_energy_price: null, number_energy_price: null, }, diff --git a/src/data/energy.ts b/src/data/energy.ts index c8bb6cf55a..8420419978 100644 --- a/src/data/energy.ts +++ b/src/data/energy.ts @@ -29,7 +29,6 @@ export const emptyFlowFromGridSourceEnergyPreference = (): FlowFromGridSourceEnergyPreference => ({ stat_energy_from: "", stat_cost: null, - entity_energy_from: null, entity_energy_price: null, number_energy_price: null, }); @@ -38,7 +37,6 @@ export const emptyFlowToGridSourceEnergyPreference = (): FlowToGridSourceEnergyPreference => ({ stat_energy_to: "", stat_compensation: null, - entity_energy_to: null, entity_energy_price: null, number_energy_price: null, }); @@ -68,7 +66,6 @@ export const emptyGasEnergyPreference = (): GasSourceTypeEnergyPreference => ({ type: "gas", stat_energy_from: "", stat_cost: null, - entity_energy_from: null, entity_energy_price: null, number_energy_price: null, }); @@ -93,7 +90,6 @@ export interface FlowFromGridSourceEnergyPreference { stat_cost: string | null; // Can be used to generate costs if stat_cost omitted - entity_energy_from: string | null; entity_energy_price: string | null; number_energy_price: number | null; } @@ -105,8 +101,7 @@ export interface FlowToGridSourceEnergyPreference { // $ meter stat_compensation: string | null; - // Can be used to generate costs if stat_cost omitted - entity_energy_to: string | null; + // Can be used to generate costs if stat_compensation omitted entity_energy_price: string | null; number_energy_price: number | null; } @@ -142,7 +137,6 @@ export interface GasSourceTypeEnergyPreference { stat_cost: string | null; // Can be used to generate costs if stat_cost omitted - entity_energy_from: string | null; entity_energy_price: string | null; number_energy_price: number | null; unit_of_measurement?: string | null; diff --git a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts index 2b382a40f4..e98621f903 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts @@ -280,7 +280,6 @@ export class DialogEnergyGasSettings this._source = { ...this._source!, stat_energy_from: ev.detail.value, - entity_energy_from: ev.detail.value, }; } diff --git a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts index a2d688f2b3..c2cab0d7b2 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts @@ -269,9 +269,6 @@ export class DialogEnergyGridFlowSettings [this._params!.direction === "from" ? "stat_energy_from" : "stat_energy_to"]: ev.detail.value, - [this._params!.direction === "from" - ? "entity_energy_from" - : "entity_energy_to"]: ev.detail.value, }; }