diff --git a/src/panels/developer-tools/state/developer-tools-state.ts b/src/panels/developer-tools/state/developer-tools-state.ts index d46074b7af..7d8a9a275d 100644 --- a/src/panels/developer-tools/state/developer-tools-state.ts +++ b/src/panels/developer-tools/state/developer-tools-state.ts @@ -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;