diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index 6cc42b9b295d..f03d059530cf 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -861,15 +861,15 @@ export class HaAutomationEditor extends PreventUnsavedMixin( (entity: EntityRegistryEntry) => entity.unique_id === id ); entityId = automation?.entity_id; + } - if (entityId) { - await updateEntityRegistryEntry(this.hass, entityId, { - categories: { - automation: this._entityRegistryUpdate.category || "", - }, - labels: this._entityRegistryUpdate.labels || [], - }); - } + if (entityId) { + await updateEntityRegistryEntry(this.hass, entityId, { + categories: { + automation: this._entityRegistryUpdate.category || "", + }, + labels: this._entityRegistryUpdate.labels || [], + }); } }