Fix a coloring issue with climate states (#15325)

This commit is contained in:
Flavien Charlon 2023-02-03 09:00:54 +00:00 committed by GitHub
parent 52d869f5b8
commit adb65176f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -133,7 +133,7 @@ export class StateBadge extends LitElement {
} }
if (stateObj.attributes.hvac_action) { if (stateObj.attributes.hvac_action) {
const hvacAction = stateObj.attributes.hvac_action; const hvacAction = stateObj.attributes.hvac_action;
if (["heating", "cooling", "drying", "fan"].includes(hvacAction)) { if (hvacAction in HVAC_ACTION_TO_MODE) {
iconStyle.color = stateColorCss( iconStyle.color = stateColorCss(
stateObj, stateObj,
HVAC_ACTION_TO_MODE[hvacAction] HVAC_ACTION_TO_MODE[hvacAction]

View File

@ -323,7 +323,7 @@ export class HuiButtonCard extends LitElement implements LovelaceCard {
} }
if (stateObj.attributes.hvac_action) { if (stateObj.attributes.hvac_action) {
const hvacAction = stateObj.attributes.hvac_action; const hvacAction = stateObj.attributes.hvac_action;
if (["heating", "cooling", "drying", "fan"].includes(hvacAction)) { if (hvacAction in HVAC_ACTION_TO_MODE) {
return stateColorCss(stateObj, HVAC_ACTION_TO_MODE[hvacAction]); return stateColorCss(stateObj, HVAC_ACTION_TO_MODE[hvacAction]);
} }
return undefined; return undefined;

View File

@ -195,7 +195,7 @@ export class HuiEntityCard extends LitElement implements LovelaceCard {
private _computeColor(stateObj: HassEntity): string | undefined { private _computeColor(stateObj: HassEntity): string | undefined {
if (stateObj.attributes.hvac_action) { if (stateObj.attributes.hvac_action) {
const hvacAction = stateObj.attributes.hvac_action; const hvacAction = stateObj.attributes.hvac_action;
if (["heating", "cooling", "drying", "fan"].includes(hvacAction)) { if (hvacAction in HVAC_ACTION_TO_MODE) {
return stateColorCss(stateObj, HVAC_ACTION_TO_MODE[hvacAction]); return stateColorCss(stateObj, HVAC_ACTION_TO_MODE[hvacAction]);
} }
return undefined; return undefined;