mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Fix target_temperature_step (#3386)
* target_temp_step fix * Fix undefined * Small fix * Linter fix * Linter fix
This commit is contained in:
parent
95d6cbd130
commit
8265a55838
@ -71,9 +71,7 @@ class MoreInfoClimate extends LitElement {
|
|||||||
|
|
||||||
const temperatureStepSize =
|
const temperatureStepSize =
|
||||||
stateObj.attributes.target_temp_step ||
|
stateObj.attributes.target_temp_step ||
|
||||||
hass.config.unit_system.temperature.indexOf("F") === -1
|
(hass.config.unit_system.temperature.indexOf("F") === -1 ? 0.5 : 1);
|
||||||
? 0.5
|
|
||||||
: 1;
|
|
||||||
|
|
||||||
const rtlDirection = computeRTLDirection(hass);
|
const rtlDirection = computeRTLDirection(hass);
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
this._jQuery("#thermostat", this.shadowRoot).roundSlider({
|
this._jQuery("#thermostat", this.shadowRoot).roundSlider({
|
||||||
sliderType,
|
sliderType,
|
||||||
value: sliderValue,
|
value: sliderValue,
|
||||||
|
disabled: sliderValue === null,
|
||||||
});
|
});
|
||||||
this._updateSetTemp(uiValue);
|
this._updateSetTemp(uiValue);
|
||||||
}
|
}
|
||||||
@ -261,6 +262,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
change: (value) => this._setTemperature(value),
|
change: (value) => this._setTemperature(value),
|
||||||
drag: (value) => this._dragEvent(value),
|
drag: (value) => this._dragEvent(value),
|
||||||
value: sliderValue,
|
value: sliderValue,
|
||||||
|
disabled: sliderValue === null,
|
||||||
step: this._stepSize,
|
step: this._stepSize,
|
||||||
});
|
});
|
||||||
this._updateSetTemp(uiValue);
|
this._updateSetTemp(uiValue);
|
||||||
@ -268,9 +270,9 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
private _genSliderValue(
|
private _genSliderValue(
|
||||||
stateObj: ClimateEntity
|
stateObj: ClimateEntity
|
||||||
): [string | number, string, string] {
|
): [string | number | null, string, string] {
|
||||||
let sliderType: string;
|
let sliderType: string;
|
||||||
let sliderValue: string | number;
|
let sliderValue: string | number | null;
|
||||||
let uiValue: string;
|
let uiValue: string;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -290,11 +292,10 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
sliderType = "min-range";
|
sliderType = "min-range";
|
||||||
sliderValue = stateObj.attributes.temperature;
|
sliderValue = Number.isFinite(Number(stateObj.attributes.temperature))
|
||||||
uiValue =
|
? stateObj.attributes.temperature
|
||||||
stateObj.attributes.temperature !== null
|
: null;
|
||||||
? String(stateObj.attributes.temperature)
|
uiValue = sliderValue !== null ? String(sliderValue) : "";
|
||||||
: "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [sliderValue, uiValue, sliderType];
|
return [sliderValue, uiValue, sliderType];
|
||||||
@ -495,6 +496,10 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
.rs-bar.rs-transition.rs-second {
|
.rs-bar.rs-transition.rs-second {
|
||||||
z-index: 20 !important;
|
z-index: 20 !important;
|
||||||
}
|
}
|
||||||
|
#thermostat .rs-readonly {
|
||||||
|
z-index: 10;
|
||||||
|
top: auto;
|
||||||
|
}
|
||||||
#thermostat .rs-inner.rs-bg-color.rs-border,
|
#thermostat .rs-inner.rs-bg-color.rs-border,
|
||||||
#thermostat .rs-overlay.rs-transition.rs-bg-color {
|
#thermostat .rs-overlay.rs-transition.rs-bg-color {
|
||||||
background-color: var(--paper-card-background-color, white);
|
background-color: var(--paper-card-background-color, white);
|
||||||
@ -512,6 +517,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
#set-temperature {
|
#set-temperature {
|
||||||
font-size: var(--set-temperature-font-size);
|
font-size: var(--set-temperature-font-size);
|
||||||
margin-bottom: var(--set-temperature-margin-bottom);
|
margin-bottom: var(--set-temperature-margin-bottom);
|
||||||
|
min-height: 1.2em;
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
font-size: var(--title-font-size);
|
font-size: var(--title-font-size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user