From a2c0ab079976cebb237d6fb090b67893bf7632c8 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 28 Oct 2024 15:20:04 +0100 Subject: [PATCH 1/3] Show buttons in cover more info if the cover supports position --- src/dialogs/more-info/controls/more-info-cover.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-cover.ts b/src/dialogs/more-info/controls/more-info-cover.ts index a352002e4adb..7c434a1b3600 100644 --- a/src/dialogs/more-info/controls/more-info-cover.ts +++ b/src/dialogs/more-info/controls/more-info-cover.ts @@ -93,12 +93,15 @@ class MoreInfoCover extends LitElement { supportsFeature(this.stateObj, CoverEntityFeature.CLOSE_TILT) || supportsFeature(this.stateObj, CoverEntityFeature.STOP_TILT); - const supportsOpenCloseWithoutStop = + const supportsOpenCloseOnly = supportsFeature(this.stateObj, CoverEntityFeature.OPEN) && supportsFeature(this.stateObj, CoverEntityFeature.CLOSE) && !supportsFeature(this.stateObj, CoverEntityFeature.STOP) && !supportsFeature(this.stateObj, CoverEntityFeature.OPEN_TILT) && - !supportsFeature(this.stateObj, CoverEntityFeature.CLOSE_TILT); + !supportsFeature(this.stateObj, CoverEntityFeature.CLOSE_TILT) && + !supportsFeature(this.stateObj, CoverEntityFeature.STOP_TILT) && + !supportsFeature(this.stateObj, CoverEntityFeature.SET_POSITION) && + !supportsFeature(this.stateObj, CoverEntityFeature.SET_TILT_POSITION); return html` Date: Mon, 28 Oct 2024 15:22:47 +0100 Subject: [PATCH 2/3] Same for valve --- src/dialogs/more-info/controls/more-info-valve.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-valve.ts b/src/dialogs/more-info/controls/more-info-valve.ts index f7bae2a9bef5..6905cc20eada 100644 --- a/src/dialogs/more-info/controls/more-info-valve.ts +++ b/src/dialogs/more-info/controls/more-info-valve.ts @@ -83,10 +83,11 @@ class MoreInfoValve extends LitElement { supportsFeature(this.stateObj, ValveEntityFeature.CLOSE) || supportsFeature(this.stateObj, ValveEntityFeature.STOP); - const supportsOpenCloseWithoutStop = + const supportsOpenCloseOnly = supportsFeature(this.stateObj, ValveEntityFeature.OPEN) && supportsFeature(this.stateObj, ValveEntityFeature.CLOSE) && - !supportsFeature(this.stateObj, ValveEntityFeature.STOP); + !supportsFeature(this.stateObj, ValveEntityFeature.STOP) && + !supportsFeature(this.stateObj, ValveEntityFeature.SET_POSITION); return html` Date: Mon, 28 Oct 2024 16:20:13 +0100 Subject: [PATCH 3/3] Refactor --- src/dialogs/more-info/controls/more-info-cover.ts | 8 +++----- src/dialogs/more-info/controls/more-info-valve.ts | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-cover.ts b/src/dialogs/more-info/controls/more-info-cover.ts index 7c434a1b3600..bf96995fcfe8 100644 --- a/src/dialogs/more-info/controls/more-info-cover.ts +++ b/src/dialogs/more-info/controls/more-info-cover.ts @@ -97,11 +97,9 @@ class MoreInfoCover extends LitElement { supportsFeature(this.stateObj, CoverEntityFeature.OPEN) && supportsFeature(this.stateObj, CoverEntityFeature.CLOSE) && !supportsFeature(this.stateObj, CoverEntityFeature.STOP) && - !supportsFeature(this.stateObj, CoverEntityFeature.OPEN_TILT) && - !supportsFeature(this.stateObj, CoverEntityFeature.CLOSE_TILT) && - !supportsFeature(this.stateObj, CoverEntityFeature.STOP_TILT) && - !supportsFeature(this.stateObj, CoverEntityFeature.SET_POSITION) && - !supportsFeature(this.stateObj, CoverEntityFeature.SET_TILT_POSITION); + !supportsTilt && + !supportsPosition && + !supportsTiltPosition; return html`