Show buttons in cover and valve more info if it supports position (#22569)

* Show buttons in cover more info if the cover supports position

* Same for valve

* Refactor
This commit is contained in:
Paul Bottein 2024-10-28 16:33:12 +01:00 committed by GitHub
parent 1542095138
commit 3180747a0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View File

@ -93,12 +93,13 @@ class MoreInfoCover extends LitElement {
supportsFeature(this.stateObj, CoverEntityFeature.CLOSE_TILT) || supportsFeature(this.stateObj, CoverEntityFeature.CLOSE_TILT) ||
supportsFeature(this.stateObj, CoverEntityFeature.STOP_TILT); supportsFeature(this.stateObj, CoverEntityFeature.STOP_TILT);
const supportsOpenCloseWithoutStop = const supportsOpenCloseOnly =
supportsFeature(this.stateObj, CoverEntityFeature.OPEN) && supportsFeature(this.stateObj, CoverEntityFeature.OPEN) &&
supportsFeature(this.stateObj, CoverEntityFeature.CLOSE) && supportsFeature(this.stateObj, CoverEntityFeature.CLOSE) &&
!supportsFeature(this.stateObj, CoverEntityFeature.STOP) && !supportsFeature(this.stateObj, CoverEntityFeature.STOP) &&
!supportsFeature(this.stateObj, CoverEntityFeature.OPEN_TILT) && !supportsTilt &&
!supportsFeature(this.stateObj, CoverEntityFeature.CLOSE_TILT); !supportsPosition &&
!supportsTiltPosition;
return html` return html`
<ha-more-info-state-header <ha-more-info-state-header
@ -133,7 +134,7 @@ class MoreInfoCover extends LitElement {
${ ${
this._mode === "button" this._mode === "button"
? html` ? html`
${supportsOpenCloseWithoutStop ${supportsOpenCloseOnly
? html` ? html`
<ha-state-control-cover-toggle <ha-state-control-cover-toggle
.stateObj=${this.stateObj} .stateObj=${this.stateObj}

View File

@ -83,10 +83,11 @@ class MoreInfoValve extends LitElement {
supportsFeature(this.stateObj, ValveEntityFeature.CLOSE) || supportsFeature(this.stateObj, ValveEntityFeature.CLOSE) ||
supportsFeature(this.stateObj, ValveEntityFeature.STOP); supportsFeature(this.stateObj, ValveEntityFeature.STOP);
const supportsOpenCloseWithoutStop = const supportsOpenCloseOnly =
supportsFeature(this.stateObj, ValveEntityFeature.OPEN) && supportsFeature(this.stateObj, ValveEntityFeature.OPEN) &&
supportsFeature(this.stateObj, ValveEntityFeature.CLOSE) && supportsFeature(this.stateObj, ValveEntityFeature.CLOSE) &&
!supportsFeature(this.stateObj, ValveEntityFeature.STOP); !supportsFeature(this.stateObj, ValveEntityFeature.STOP) &&
!supportsPosition;
return html` return html`
<ha-more-info-state-header <ha-more-info-state-header
@ -113,7 +114,7 @@ class MoreInfoValve extends LitElement {
${ ${
this._mode === "button" this._mode === "button"
? html` ? html`
${supportsOpenCloseWithoutStop ${supportsOpenCloseOnly
? html` ? html`
<ha-state-control-valve-toggle <ha-state-control-valve-toggle
.stateObj=${this.stateObj} .stateObj=${this.stateObj}