mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 19:56:42 +00:00
less broken thermostat-card (#2793)
* Update hui-thermostat-card.ts * made light and thermo more consistent
This commit is contained in:
parent
79a5947587
commit
32d0e8bf1d
@ -135,6 +135,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard {
|
||||
const stateObj = this.hass!.states[this._config!.entity] as LightEntity;
|
||||
|
||||
if (!stateObj) {
|
||||
// Card will require refresh to work again
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -213,6 +213,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
||||
|
||||
private get _stepSize(): number {
|
||||
const stateObj = this.hass!.states[this._config!.entity];
|
||||
|
||||
if (stateObj.attributes.target_temp_step) {
|
||||
return stateObj.attributes.target_temp_step;
|
||||
}
|
||||
@ -220,6 +221,13 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
|
||||
private async _initialLoad(): Promise<void> {
|
||||
const stateObj = this.hass!.states[this._config!.entity] as ClimateEntity;
|
||||
|
||||
if (!stateObj) {
|
||||
// Card will require refresh to work again
|
||||
return;
|
||||
}
|
||||
|
||||
this._loaded = true;
|
||||
|
||||
await this.updateComplete;
|
||||
@ -233,15 +241,13 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
||||
|
||||
(this.shadowRoot!.querySelector(
|
||||
"#thermostat"
|
||||
)! as HTMLElement).style.height = radius * 2 + "px";
|
||||
) as HTMLElement)!.style.height = radius * 2 + "px";
|
||||
|
||||
const loaded = await loadRoundslider();
|
||||
|
||||
this._roundSliderStyle = loaded.roundSliderStyle;
|
||||
this._jQuery = loaded.jQuery;
|
||||
|
||||
const stateObj = this.hass!.states[this._config!.entity] as ClimateEntity;
|
||||
|
||||
const _sliderType =
|
||||
stateObj.attributes.target_temp_low &&
|
||||
stateObj.attributes.target_temp_high
|
||||
|
Loading…
x
Reference in New Issue
Block a user