Add defrosting to HVAC actions for ClimateEntity (#21330)

This commit is contained in:
G Johansson 2024-07-07 18:54:58 +02:00 committed by GitHub
parent aa49d6ef6b
commit 877d0db1bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 5 deletions

View File

@ -140,6 +140,9 @@ const ENTITIES: HassEntity[] = [
createEntity("climate.auto_preheating", "auto", undefined, { createEntity("climate.auto_preheating", "auto", undefined, {
hvac_action: "preheating", hvac_action: "preheating",
}), }),
createEntity("climate.auto_defrosting", "auto", undefined, {
hvac_action: "defrosting",
}),
createEntity("climate.auto_heating", "auto", undefined, { createEntity("climate.auto_heating", "auto", undefined, {
hvac_action: "heating", hvac_action: "heating",
}), }),

View File

@ -125,6 +125,7 @@ const FIXED_DOMAIN_ATTRIBUTE_STATES = {
"off", "off",
"idle", "idle",
"preheating", "preheating",
"defrosting",
"heating", "heating",
"cooling", "cooling",
"drying", "drying",

View File

@ -28,13 +28,14 @@ export type HvacMode = (typeof HVAC_MODES)[number];
export const CLIMATE_PRESET_NONE = "none"; export const CLIMATE_PRESET_NONE = "none";
export type HvacAction = export type HvacAction =
| "off"
| "preheating"
| "heating"
| "cooling" | "cooling"
| "defrosting"
| "drying" | "drying"
| "fan"
| "heating"
| "idle" | "idle"
| "fan"; | "off"
| "preheating";
export type ClimateEntity = HassEntityBase & { export type ClimateEntity = HassEntityBase & {
attributes: HassEntityAttributeBase & { attributes: HassEntityAttributeBase & {
@ -89,12 +90,13 @@ export const compareClimateHvacModes = (mode1: HvacMode, mode2: HvacMode) =>
export const CLIMATE_HVAC_ACTION_TO_MODE: Record<HvacAction, HvacMode> = { export const CLIMATE_HVAC_ACTION_TO_MODE: Record<HvacAction, HvacMode> = {
cooling: "cool", cooling: "cool",
defrosting: "heat",
drying: "dry", drying: "dry",
fan: "fan_only", fan: "fan_only",
preheating: "heat",
heating: "heat", heating: "heat",
idle: "off", idle: "off",
off: "off", off: "off",
preheating: "heat",
}; };
export const CLIMATE_HVAC_MODE_ICONS: Record<HvacMode, string> = { export const CLIMATE_HVAC_MODE_ICONS: Record<HvacMode, string> = {

View File

@ -907,6 +907,7 @@ export const ENTITY_COMPONENT_ICONS: Record<string, ComponentIcons> = {
idle: "mdi:clock-outline", idle: "mdi:clock-outline",
off: "mdi:power", off: "mdi:power",
preheating: "mdi:heat-wave", preheating: "mdi:heat-wave",
defrosting: "mdi:snowflake-melt",
}, },
}, },
preset_mode: { preset_mode: {