From 6d36b0e28ce9630002aff206725f54cda084ddca Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 8 Dec 2023 11:58:08 +0100 Subject: [PATCH] Hide climate mode control on default dashboard if there is only one hvac mode (#18964) Hide hvac mode on default dashboard if there is only one hvac mode --- .../lovelace/common/generate-lovelace-config.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/panels/lovelace/common/generate-lovelace-config.ts b/src/panels/lovelace/common/generate-lovelace-config.ts index 02e0f970ba..2b5437a93d 100644 --- a/src/panels/lovelace/common/generate-lovelace-config.ts +++ b/src/panels/lovelace/common/generate-lovelace-config.ts @@ -143,12 +143,15 @@ export const computeCards = ( const cardConfig: ThermostatCardConfig = { type: "thermostat", entity: entityId, - features: [ - { - type: "climate-hvac-modes", - hvac_modes: states[entityId]?.attributes?.hvac_modes, - }, - ], + features: + (states[entityId]?.attributes?.hvac_modes?.length ?? 0) > 1 + ? [ + { + type: "climate-hvac-modes", + hvac_modes: states[entityId]?.attributes?.hvac_modes, + }, + ] + : undefined, }; cards.push(cardConfig); } else if (domain === "humidifier") {