From caa60e4e8c3ac430d53ff615e341ab08d03daeb8 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 24 Jun 2025 18:02:45 +0200 Subject: [PATCH] Fix warnings raised when migrating incomplete automation configuration (#25898) --- src/data/script.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/script.ts b/src/data/script.ts index 9faf0b4127..6128014dfc 100644 --- a/src/data/script.ts +++ b/src/data/script.ts @@ -415,7 +415,7 @@ export const migrateAutomationAction = ( return action.map(migrateAutomationAction) as Action[]; } - if ("service" in action) { + if (typeof action === "object" && action !== null && "service" in action) { if (!("action" in action)) { action.action = action.service; } @@ -423,7 +423,7 @@ export const migrateAutomationAction = ( } // legacy scene (scene: scene_name) - if ("scene" in action) { + if (typeof action === "object" && action !== null && "scene" in action) { action.action = "scene.turn_on"; action.target = { entity_id: action.scene, @@ -431,7 +431,7 @@ export const migrateAutomationAction = ( delete action.scene; } - if ("sequence" in action) { + if (typeof action === "object" && action !== null && "sequence" in action) { for (const sequenceAction of (action as SequenceAction).sequence) { migrateAutomationAction(sequenceAction); }