From 877d0db1bb6f85bee59ff00a23e113db011793cd Mon Sep 17 00:00:00 2001 From: G Johansson Date: Sun, 7 Jul 2024 18:54:58 +0200 Subject: [PATCH] Add defrosting to HVAC actions for ClimateEntity (#21330) --- gallery/src/pages/misc/entity-state.ts | 3 +++ src/common/entity/get_states.ts | 1 + src/data/climate.ts | 12 +++++++----- src/fake_data/entity_component_icons.ts | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gallery/src/pages/misc/entity-state.ts b/gallery/src/pages/misc/entity-state.ts index ab395b71a1..8d38fe9413 100644 --- a/gallery/src/pages/misc/entity-state.ts +++ b/gallery/src/pages/misc/entity-state.ts @@ -140,6 +140,9 @@ const ENTITIES: HassEntity[] = [ createEntity("climate.auto_preheating", "auto", undefined, { hvac_action: "preheating", }), + createEntity("climate.auto_defrosting", "auto", undefined, { + hvac_action: "defrosting", + }), createEntity("climate.auto_heating", "auto", undefined, { hvac_action: "heating", }), diff --git a/src/common/entity/get_states.ts b/src/common/entity/get_states.ts index 24e9fa4a7e..901cf95a8c 100644 --- a/src/common/entity/get_states.ts +++ b/src/common/entity/get_states.ts @@ -125,6 +125,7 @@ const FIXED_DOMAIN_ATTRIBUTE_STATES = { "off", "idle", "preheating", + "defrosting", "heating", "cooling", "drying", diff --git a/src/data/climate.ts b/src/data/climate.ts index 97a2557c71..30ee11d2b9 100644 --- a/src/data/climate.ts +++ b/src/data/climate.ts @@ -28,13 +28,14 @@ export type HvacMode = (typeof HVAC_MODES)[number]; export const CLIMATE_PRESET_NONE = "none"; export type HvacAction = - | "off" - | "preheating" - | "heating" | "cooling" + | "defrosting" | "drying" + | "fan" + | "heating" | "idle" - | "fan"; + | "off" + | "preheating"; export type ClimateEntity = HassEntityBase & { attributes: HassEntityAttributeBase & { @@ -89,12 +90,13 @@ export const compareClimateHvacModes = (mode1: HvacMode, mode2: HvacMode) => export const CLIMATE_HVAC_ACTION_TO_MODE: Record = { cooling: "cool", + defrosting: "heat", drying: "dry", fan: "fan_only", - preheating: "heat", heating: "heat", idle: "off", off: "off", + preheating: "heat", }; export const CLIMATE_HVAC_MODE_ICONS: Record = { diff --git a/src/fake_data/entity_component_icons.ts b/src/fake_data/entity_component_icons.ts index 90b580f977..242f301516 100644 --- a/src/fake_data/entity_component_icons.ts +++ b/src/fake_data/entity_component_icons.ts @@ -907,6 +907,7 @@ export const ENTITY_COMPONENT_ICONS: Record = { idle: "mdi:clock-outline", off: "mdi:power", preheating: "mdi:heat-wave", + defrosting: "mdi:snowflake-melt", }, }, preset_mode: {