Fix developer tools set state for unexisting entity (#18827)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Simon Lamon 2023-11-30 11:59:51 +01:00 committed by GitHub
parent 79f5ec0cd5
commit f1692038f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -360,17 +360,16 @@ class HaPanelDevState extends LitElement {
}
private _updateEntity() {
if (!this._entityId) {
const entityState = this._entityId
? this.hass.states[this._entityId]
: undefined;
if (!entityState) {
this._entity = undefined;
this._state = "";
this._stateAttributes = {};
this._updateEditor();
return;
}
const entityState = this.hass.states[this._entityId];
if (!entityState) {
return;
}
this._entity = entityState;
this._state = entityState.state;
this._stateAttributes = entityState.attributes;