mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-04 01:10:33 -06:00
Fix hui-select-entity-row restoring old state (#28918)
This commit is contained in:
parent
65d046132d
commit
f37241c84c
@ -112,7 +112,20 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
|
||||
|
||||
forwardHaptic(this, "light");
|
||||
|
||||
setSelectOption(this.hass!, stateObj.entity_id, option);
|
||||
setSelectOption(this.hass!, stateObj.entity_id, option)
|
||||
.catch((_err) => {
|
||||
// silently swallow exception
|
||||
})
|
||||
.finally(() =>
|
||||
setTimeout(() => {
|
||||
const newStateObj = this.hass!.states[this._config!.entity];
|
||||
if (newStateObj === stateObj) {
|
||||
const select = this.shadowRoot?.querySelector("ha-select");
|
||||
const index = select?.options.indexOf(stateObj.state) ?? -1;
|
||||
select?.select(index);
|
||||
}
|
||||
}, 2000)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user