Skip to content

Commit

Permalink
Add defrosting to HVAC actions for ClimateEntity (#21330)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST authored Jul 7, 2024
1 parent aa49d6e commit 877d0db
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions gallery/src/pages/misc/entity-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}),
Expand Down
1 change: 1 addition & 0 deletions src/common/entity/get_states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const FIXED_DOMAIN_ATTRIBUTE_STATES = {
"off",
"idle",
"preheating",
"defrosting",
"heating",
"cooling",
"drying",
Expand Down
12 changes: 7 additions & 5 deletions src/data/climate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 & {
Expand Down Expand Up @@ -89,12 +90,13 @@ export const compareClimateHvacModes = (mode1: HvacMode, mode2: HvacMode) =>

export const CLIMATE_HVAC_ACTION_TO_MODE: Record<HvacAction, HvacMode> = {
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<HvacMode, string> = {
Expand Down
1 change: 1 addition & 0 deletions src/fake_data/entity_component_icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ export const ENTITY_COMPONENT_ICONS: Record<string, ComponentIcons> = {
idle: "mdi:clock-outline",
off: "mdi:power",
preheating: "mdi:heat-wave",
defrosting: "mdi:snowflake-melt",
},
},
preset_mode: {
Expand Down

0 comments on commit 877d0db

Please sign in to comment.