diff --git a/src/panels/lovelace/dialogs/hui-dialog-group-toggle.ts b/src/panels/lovelace/dialogs/hui-dialog-group-toggle.ts index e0a3661eb6..25113cce86 100644 --- a/src/panels/lovelace/dialogs/hui-dialog-group-toggle.ts +++ b/src/panels/lovelace/dialogs/hui-dialog-group-toggle.ts @@ -21,6 +21,7 @@ import type { HomeAssistant } from "../../../types"; import type { TileCardConfig } from "../cards/types"; import "../sections/hui-section"; import type { GroupToggleDialogParams } from "./show-group-toggle-dialog"; +import { isFullyClosed, isFullyOpen } from "../../../data/cover"; @customElement("hui-dialog-group-toggle") class HuiGroupToggleDialog extends LitElement { @@ -79,6 +80,19 @@ class HuiGroupToggleDialog extends LitElement { const deviceClass = mainStateObj.attributes.device_class; + const isGroup = this._params.entityIds.length > 1; + + const isAllOn = entities.every((entity) => + computeDomain(entity.entity_id) === "cover" + ? isFullyOpen(entity) + : entity.state === "on" + ); + const isAllOff = entities.every((entity) => + computeDomain(entity.entity_id) === "cover" + ? isFullyClosed(entity) + : entity.state === "off" + ); + return html` - + ${domain !== "light" ? html`` : html` `} -

${domain === "cover" ? "Open all" : "Turn all on"}

+

+ ${domain === "cover" + ? isGroup + ? "Open all" + : "Open" + : isGroup + ? "Turn all on" + : "Turn on"} +

- + ${domain !== "light" - ? html`` + ? html` + + ` : html` `} -

${domain === "cover" ? "Close all" : "Turn all off"}

+

+ ${domain === "cover" + ? isGroup + ? "Close all" + : "Close" + : isGroup + ? "Turn all off" + : "Turn off"} +