Skip to content

Commit

Permalink
Add none, frost_protection & auto preset mode icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentame committed Dec 24, 2023
1 parent 68ecb7c commit b1cd89f
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 3 deletions.
101 changes: 99 additions & 2 deletions gallery/src/pages/lovelace/thermostat-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,45 @@ const ENTITIES = [
friendly_name: "Nest",
supported_features: 43,
}),
getEntity("climate", "overkiz_radiator", "heat", {
current_temperature: 18,
min_temp: 7,
max_temp: 35,
temperature: 20,
hvac_modes: ["heat", "auto", "off"],
friendly_name: "Overkiz radiator",
supported_features: 17,
preset_mode: "comfort",
preset_modes: [
"none",
"frost_protection",
"eco",
"comfort",
"comfort-1",
"comfort-2",
"auto",
"boost",
"external",
"prog",
],
}),
getEntity("climate", "overkiz_towel_dryer", "heat", {
current_temperature: null,
min_temp: 7,
max_temp: 35,
hvac_modes: ["heat", "off"],
friendly_name: "Overkiz towel dryer",
supported_features: 16,
preset_mode: "eco",
preset_modes: [
"none",
"frost_protection",
"eco",
"comfort",
"comfort-1",
"comfort-2",
],
}),
getEntity("climate", "sensibo", "fan_only", {
current_temperature: null,
temperature: null,
Expand All @@ -58,8 +97,6 @@ const CONFIGS = [
config: `
- type: thermostat
entity: climate.ecobee
- type: thermostat
entity: climate.nest
`,
},
{
Expand All @@ -69,6 +106,66 @@ const CONFIGS = [
entity: climate.nest
`,
},
{
heading: "Feature example",
config: `
- type: thermostat
entity: climate.overkiz_radiator
features:
- type: climate-hvac-modes
hvac_modes:
- heat
- 'off'
- auto
- type: climate-preset-modes
style: icons
preset_modes:
- none
- frost_protection
- eco
- comfort
- comfort-1
- comfort-2
- auto
- boost
- external
- prog
- type: climate-preset-modes
style: dropdown
preset_modes:
- none
- frost_protection
- eco
- comfort
- comfort-1
- comfort-2
- auto
- boost
- external
- prog
`,
},
{
heading: "Preset only example",
config: `
- type: thermostat
entity: climate.overkiz_towel_dryer
features:
- type: climate-hvac-modes
hvac_modes:
- heat
- 'off'
- type: climate-preset-modes
style: icons
preset_modes:
- none
- frost_protection
- eco
- comfort
- comfort-1
- comfort-2
`,
},
{
heading: "Fan only example",
config: `
Expand Down
20 changes: 19 additions & 1 deletion gallery/src/pages/more-info/climate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "../../components/demo-more-infos";
import { ClimateEntityFeature } from "../../../../src/data/climate";

const ENTITIES = [
getEntity("climate", "thermostat", "heat", {
getEntity("climate", "radiator", "heat", {
friendly_name: "Basic heater",
hvac_modes: ["heat", "off"],
hvac_mode: "heat",
Expand Down Expand Up @@ -80,6 +80,24 @@ const ENTITIES = [
max_humidity: 100,
humidity: 50,
}),
getEntity("climate", "towel_dryer", "heat", {
friendly_name: "Preset only heater",
hvac_modes: ["heat", "off"],
hvac_mode: "heat",
preset_modes: [
"none",
"frost_protection",
"eco",
"comfort",
"comfort-1",
"comfort-2",
],
preset_mode: "eco",
current_temperature: null,
min_temp: 7,
max_temp: 35,
supported_features: ClimateEntityFeature.PRESET_MODE,
}),
getEntity("climate", "unavailable", "unavailable", {
friendly_name: "Unavailable heater",
hvac_modes: ["heat", "off"],
Expand Down
8 changes: 8 additions & 0 deletions src/data/climate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
mdiBed,
mdiCircleMedium,
mdiClockOutline,
mdiClose,
mdiFan,
mdiFanAuto,
mdiFanOff,
Expand All @@ -18,6 +19,7 @@ import {
mdiRocketLaunch,
mdiSnowflake,
mdiSofa,
mdiSnowflakeMelt,
mdiSpeedometer,
mdiSpeedometerMedium,
mdiSpeedometerSlow,
Expand Down Expand Up @@ -140,7 +142,10 @@ export const computeHvacModeIcon = (mode: HvacMode) =>
CLIMATE_HVAC_MODE_ICONS[mode];

type ClimateBuiltInPresetMode =
| "none"
| "eco"
| "frost_protection"
| "auto"
| "away"
| "boost"
| "comfort"
Expand All @@ -152,11 +157,14 @@ export const CLIMATE_PRESET_MODE_ICONS: Record<
ClimateBuiltInPresetMode,
string
> = {
auto: mdiThermostatAuto,
away: mdiAccountArrowRight,
boost: mdiRocketLaunch,
comfort: mdiSofa,
eco: mdiLeaf,
frost_protection: mdiSnowflakeMelt,
home: mdiHome,
none: mdiClose,
sleep: mdiBed,
activity: mdiMotionSensor,
};
Expand Down

0 comments on commit b1cd89f

Please sign in to comment.