mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Fix warnings raised when migrating incomplete automation configuration (#25898)
This commit is contained in:
parent
edcca81acc
commit
caa60e4e8c
@ -415,7 +415,7 @@ export const migrateAutomationAction = (
|
|||||||
return action.map(migrateAutomationAction) as Action[];
|
return action.map(migrateAutomationAction) as Action[];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("service" in action) {
|
if (typeof action === "object" && action !== null && "service" in action) {
|
||||||
if (!("action" in action)) {
|
if (!("action" in action)) {
|
||||||
action.action = action.service;
|
action.action = action.service;
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ export const migrateAutomationAction = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// legacy scene (scene: scene_name)
|
// legacy scene (scene: scene_name)
|
||||||
if ("scene" in action) {
|
if (typeof action === "object" && action !== null && "scene" in action) {
|
||||||
action.action = "scene.turn_on";
|
action.action = "scene.turn_on";
|
||||||
action.target = {
|
action.target = {
|
||||||
entity_id: action.scene,
|
entity_id: action.scene,
|
||||||
@ -431,7 +431,7 @@ export const migrateAutomationAction = (
|
|||||||
delete action.scene;
|
delete action.scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("sequence" in action) {
|
if (typeof action === "object" && action !== null && "sequence" in action) {
|
||||||
for (const sequenceAction of (action as SequenceAction).sequence) {
|
for (const sequenceAction of (action as SequenceAction).sequence) {
|
||||||
migrateAutomationAction(sequenceAction);
|
migrateAutomationAction(sequenceAction);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user