Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defrosting to HVAC actions for ClimateEntity #21330

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
}),
frenck marked this conversation as resolved.
Show resolved Hide resolved
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
Loading