Display cover position in tile card when opening and closing (#15809)

This commit is contained in:
Paul Bottein 2023-03-13 17:33:14 +01:00 committed by GitHub
parent bf1cabca6e
commit 7b676cbd91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,7 +224,10 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
this.hass!.entities
);
if (domain === "cover" && stateObj.state === "open") {
if (
domain === "cover" &&
["open", "opening", "closing"].includes(stateObj.state)
) {
const position = (stateObj as CoverEntity).attributes.current_position;
if (position && position !== 100) {
return `${stateDisplay} - ${Math.round(position)}${blankBeforePercent(