mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 04:06:35 +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;
|
const stateObj = this.hass!.states[this._config!.entity] as LightEntity;
|
||||||
|
|
||||||
if (!stateObj) {
|
if (!stateObj) {
|
||||||
|
// Card will require refresh to work again
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +213,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
private get _stepSize(): number {
|
private get _stepSize(): number {
|
||||||
const stateObj = this.hass!.states[this._config!.entity];
|
const stateObj = this.hass!.states[this._config!.entity];
|
||||||
|
|
||||||
if (stateObj.attributes.target_temp_step) {
|
if (stateObj.attributes.target_temp_step) {
|
||||||
return 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> {
|
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;
|
this._loaded = true;
|
||||||
|
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
@ -233,15 +241,13 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
(this.shadowRoot!.querySelector(
|
(this.shadowRoot!.querySelector(
|
||||||
"#thermostat"
|
"#thermostat"
|
||||||
)! as HTMLElement).style.height = radius * 2 + "px";
|
) as HTMLElement)!.style.height = radius * 2 + "px";
|
||||||
|
|
||||||
const loaded = await loadRoundslider();
|
const loaded = await loadRoundslider();
|
||||||
|
|
||||||
this._roundSliderStyle = loaded.roundSliderStyle;
|
this._roundSliderStyle = loaded.roundSliderStyle;
|
||||||
this._jQuery = loaded.jQuery;
|
this._jQuery = loaded.jQuery;
|
||||||
|
|
||||||
const stateObj = this.hass!.states[this._config!.entity] as ClimateEntity;
|
|
||||||
|
|
||||||
const _sliderType =
|
const _sliderType =
|
||||||
stateObj.attributes.target_temp_low &&
|
stateObj.attributes.target_temp_low &&
|
||||||
stateObj.attributes.target_temp_high
|
stateObj.attributes.target_temp_high
|
||||||
|
Loading…
x
Reference in New Issue
Block a user