Humidifier action (#17056)

* Add action attribute to humidifier

* Humidifier: Use action instead of state if that is available

* rebase

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Denis Shulyaka 2023-06-28 17:47:39 +03:00 committed by GitHub
parent 345aef8d65
commit 81bd4a247b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 8 deletions

View File

@ -14,7 +14,7 @@ export type HumidifierEntity = HassEntityBase & {
min_humidity?: number; min_humidity?: number;
max_humidity?: number; max_humidity?: number;
mode?: string; mode?: string;
action: HumidifierAction; action?: HumidifierAction;
available_modes?: string[]; available_modes?: string[];
}; };
}; };

View File

@ -165,13 +165,24 @@ export class HuiHumidifierCard extends LitElement implements LovelaceCard {
text-anchor="middle" text-anchor="middle"
id="set-mode" id="set-mode"
> >
${computeStateDisplay( ${
this.hass.localize, stateObj.attributes.action
stateObj, ? computeAttributeValueDisplay(
this.hass.locale, this.hass.localize,
this.hass.config, stateObj,
this.hass.entities this.hass.locale,
)} this.hass.config,
this.hass.entities,
"action"
)
: computeStateDisplay(
this.hass.localize,
stateObj,
this.hass.locale,
this.hass.config,
this.hass.entities
)
}
${ ${
stateObj.state !== UNAVAILABLE && stateObj.attributes.mode stateObj.state !== UNAVAILABLE && stateObj.attributes.mode
? html` ? html`