diff --git a/src/components/ha-control-circular-slider.ts b/src/components/ha-control-circular-slider.ts index 3f6344647d07..af9a7cf469d3 100644 --- a/src/components/ha-control-circular-slider.ts +++ b/src/components/ha-control-circular-slider.ts @@ -66,6 +66,9 @@ export class HaControlCircularSlider extends LitElement { @property({ type: Boolean, reflect: true }) public disabled = false; + @property({ type: Boolean, reflect: true }) + public readonly = false; + @property({ type: Boolean }) public dual?: boolean; @@ -258,7 +261,7 @@ export class HaControlCircularSlider extends LitElement { e.srcEvent.preventDefault(); }); this._mc.on("panstart", (e) => { - if (this.disabled) return; + if (this.disabled || this.readonly) return; const percentage = this._getPercentageFromEvent(e); const raw = this._percentageToValue(percentage); this._activeSlider = this._findActiveSlider(raw); @@ -266,11 +269,11 @@ export class HaControlCircularSlider extends LitElement { this.shadowRoot?.getElementById("#slider")?.focus(); }); this._mc.on("pancancel", () => { - if (this.disabled) return; + if (this.disabled || this.readonly) return; this._activeSlider = undefined; }); this._mc.on("panmove", (e) => { - if (this.disabled) return; + if (this.disabled || this.readonly) return; const percentage = this._getPercentageFromEvent(e); const raw = this._percentageToValue(percentage); const bounded = this._boundedValue(raw); @@ -281,7 +284,7 @@ export class HaControlCircularSlider extends LitElement { } }); this._mc.on("panend", (e) => { - if (this.disabled) return; + if (this.disabled || this.readonly) return; const percentage = this._getPercentageFromEvent(e); const raw = this._percentageToValue(percentage); const bounded = this._boundedValue(raw); @@ -296,7 +299,7 @@ export class HaControlCircularSlider extends LitElement { this._activeSlider = undefined; }); this._mc.on("singletap", (e) => { - if (this.disabled) return; + if (this.disabled || this.readonly) return; const percentage = this._getPercentageFromEvent(e); const raw = this._percentageToValue(percentage); this._activeSlider = this._findActiveSlider(raw); @@ -436,11 +439,15 @@ export class HaControlCircularSlider extends LitElement { ? current <= target : false; - const activeArc = showActive - ? mode === "end" - ? this._strokeDashArc(target, current) - : this._strokeDashArc(current, target) - : this._strokeCircleDashArc(target); + const showTarget = value != null; + + const activeArc = showTarget + ? showActive + ? mode === "end" + ? this._strokeDashArc(target, current) + : this._strokeDashArc(current, target) + : this._strokeCircleDashArc(target) + : undefined; const coloredArc = mode === "full" @@ -449,7 +456,9 @@ export class HaControlCircularSlider extends LitElement { ? this._strokeDashArc(target, limit) : this._strokeDashArc(limit, target); - const targetCircle = this._strokeCircleDashArc(target); + const targetCircle = showTarget + ? this._strokeCircleDashArc(target) + : undefined; const currentCircle = this.current != null && @@ -473,26 +482,33 @@ export class HaControlCircularSlider extends LitElement { stroke-dasharray=${coloredArc[0]} stroke-dashoffset=${coloredArc[1]} /> - + ${ + activeArc + ? svg` + + ` + : nothing + } ${ currentCircle ? svg` @@ -505,18 +521,24 @@ export class HaControlCircularSlider extends LitElement { ` : nothing } - - + ${ + targetCircle + ? svg` + + + ` + : nothing + } `; } @@ -568,7 +590,7 @@ export class HaControlCircularSlider extends LitElement { /> ` : nothing} - ${lowValue != null + ${lowValue != null || this.mode === "full" ? this.renderArc( this.dual ? "low" : "value", lowValue, @@ -615,7 +637,8 @@ export class HaControlCircularSlider extends LitElement { #display { pointer-events: none; } - :host([disabled]) #interaction { + :host([disabled]) #interaction, + :host([readonly]) #interaction { cursor: initial; } diff --git a/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts b/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts index c03f63f57e97..05adb8e55640 100644 --- a/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts +++ b/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts @@ -159,6 +159,21 @@ export class HaMoreInfoClimateTemperature extends LitElement { `; } + if ( + !supportsFeature( + this.stateObj, + ClimateEntityFeature.TARGET_TEMPERATURE + ) && + !supportsFeature( + this.stateObj, + ClimateEntityFeature.TARGET_TEMPERATURE_RANGE + ) + ) { + return html` +

${this.hass.formatEntityState(this.stateObj)}

+ `; + } + const action = this.stateObj.attributes.hvac_action; const actionLabel = this.hass.formatEntityAttributeValue( @@ -383,15 +398,17 @@ export class HaMoreInfoClimateTemperature extends LitElement {
diff --git a/src/dialogs/more-info/components/water_heater/ha-more-info-water_heater-temperature.ts b/src/dialogs/more-info/components/water_heater/ha-more-info-water_heater-temperature.ts index f23177a59601..8ced14169a27 100644 --- a/src/dialogs/more-info/components/water_heater/ha-more-info-water_heater-temperature.ts +++ b/src/dialogs/more-info/components/water_heater/ha-more-info-water_heater-temperature.ts @@ -99,6 +99,17 @@ export class HaMoreInfoWaterHeaterTemperature extends LitElement { `; } + if ( + !supportsFeature( + this.stateObj, + WaterHeaterEntityFeature.TARGET_TEMPERATURE + ) + ) { + return html` +

${this.hass.formatEntityState(this.stateObj)}

+ `; + } + return html`

${this.hass.localize( @@ -202,13 +213,20 @@ export class HaMoreInfoWaterHeaterTemperature extends LitElement { } return html` -

+