From b1cd89f1f3a3933bed673c651eb1ee60585d40bb Mon Sep 17 00:00:00 2001 From: Quentin POLLET Date: Wed, 20 Dec 2023 01:06:15 +0000 Subject: [PATCH 1/2] Add none, frost_protection & auto preset mode icons --- gallery/src/pages/lovelace/thermostat-card.ts | 101 +++++++++++++++++- gallery/src/pages/more-info/climate.ts | 20 +++- src/data/climate.ts | 8 ++ 3 files changed, 126 insertions(+), 3 deletions(-) diff --git a/gallery/src/pages/lovelace/thermostat-card.ts b/gallery/src/pages/lovelace/thermostat-card.ts index 623adf5e3436..285cdb348ffb 100644 --- a/gallery/src/pages/lovelace/thermostat-card.ts +++ b/gallery/src/pages/lovelace/thermostat-card.ts @@ -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, @@ -58,8 +97,6 @@ const CONFIGS = [ config: ` - type: thermostat entity: climate.ecobee -- type: thermostat - entity: climate.nest `, }, { @@ -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: ` diff --git a/gallery/src/pages/more-info/climate.ts b/gallery/src/pages/more-info/climate.ts index f6216a55b1c4..a52c08044f57 100644 --- a/gallery/src/pages/more-info/climate.ts +++ b/gallery/src/pages/more-info/climate.ts @@ -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", @@ -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"], diff --git a/src/data/climate.ts b/src/data/climate.ts index b3b7087a3bfa..502a63e1bc7c 100644 --- a/src/data/climate.ts +++ b/src/data/climate.ts @@ -6,6 +6,7 @@ import { mdiBed, mdiCircleMedium, mdiClockOutline, + mdiClose, mdiFan, mdiFanAuto, mdiFanOff, @@ -18,6 +19,7 @@ import { mdiRocketLaunch, mdiSnowflake, mdiSofa, + mdiSnowflakeMelt, mdiSpeedometer, mdiSpeedometerMedium, mdiSpeedometerSlow, @@ -140,7 +142,10 @@ export const computeHvacModeIcon = (mode: HvacMode) => CLIMATE_HVAC_MODE_ICONS[mode]; type ClimateBuiltInPresetMode = + | "none" | "eco" + | "frost_protection" + | "auto" | "away" | "boost" | "comfort" @@ -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, }; From 7e6addc50ea3b4292733a6a23a0aa441860427e0 Mon Sep 17 00:00:00 2001 From: Quentin POLLET Date: Wed, 20 Dec 2023 19:28:55 +0000 Subject: [PATCH 2/2] Revert preset icons addition --- src/data/climate.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/data/climate.ts b/src/data/climate.ts index 502a63e1bc7c..b3b7087a3bfa 100644 --- a/src/data/climate.ts +++ b/src/data/climate.ts @@ -6,7 +6,6 @@ import { mdiBed, mdiCircleMedium, mdiClockOutline, - mdiClose, mdiFan, mdiFanAuto, mdiFanOff, @@ -19,7 +18,6 @@ import { mdiRocketLaunch, mdiSnowflake, mdiSofa, - mdiSnowflakeMelt, mdiSpeedometer, mdiSpeedometerMedium, mdiSpeedometerSlow, @@ -142,10 +140,7 @@ export const computeHvacModeIcon = (mode: HvacMode) => CLIMATE_HVAC_MODE_ICONS[mode]; type ClimateBuiltInPresetMode = - | "none" | "eco" - | "frost_protection" - | "auto" | "away" | "boost" | "comfort" @@ -157,14 +152,11 @@ 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, };