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
This commit is contained in:
Paul Bottein 2023-12-08 11:58:08 +01:00 committed by GitHub
parent 61117bb34f
commit 6d36b0e28c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,12 +143,15 @@ export const computeCards = (
const cardConfig: ThermostatCardConfig = { const cardConfig: ThermostatCardConfig = {
type: "thermostat", type: "thermostat",
entity: entityId, entity: entityId,
features: [ features:
(states[entityId]?.attributes?.hvac_modes?.length ?? 0) > 1
? [
{ {
type: "climate-hvac-modes", type: "climate-hvac-modes",
hvac_modes: states[entityId]?.attributes?.hvac_modes, hvac_modes: states[entityId]?.attributes?.hvac_modes,
}, },
], ]
: undefined,
}; };
cards.push(cardConfig); cards.push(cardConfig);
} else if (domain === "humidifier") { } else if (domain === "humidifier") {