diff --git a/Sources/App/Settings/ActionConfigurator.swift b/Sources/App/Settings/ActionConfigurator.swift index 6f68743ca..b57b72f16 100644 --- a/Sources/App/Settings/ActionConfigurator.swift +++ b/Sources/App/Settings/ActionConfigurator.swift @@ -305,7 +305,9 @@ class ActionConfigurator: HAFormViewController, TypedRowControllerType { private func saveAndAutomate() { if form.validate().count == 0 { Current.Log.verbose("Category form is valid, calling dismiss callback!") - shouldSave = true + if !action.isServerControlled { + shouldSave = true + } shouldOpenAutomationEditor = true onDismissCallback?(self) } diff --git a/Sources/App/Settings/SettingsDetailViewController.swift b/Sources/App/Settings/SettingsDetailViewController.swift index 30d228e97..92f7cf995 100644 --- a/Sources/App/Settings/SettingsDetailViewController.swift +++ b/Sources/App/Settings/SettingsDetailViewController.swift @@ -716,6 +716,17 @@ class SettingsDetailViewController: HAFormViewController, TypedRowControllerType _ = vc.navigationController?.popViewController(animated: true) if let vc = vc as? ActionConfigurator { + defer { + if vc.shouldOpenAutomationEditor { + vc.navigationController?.dismiss(animated: true, completion: { + Current.sceneManager.webViewWindowControllerPromise.then(\.webViewControllerPromise) + .done { controller in + controller.openActionAutomationEditor(actionId: vc.action.ID) + } + }) + } + } + if vc.shouldSave == false { Current.Log.verbose("Not saving action to DB and returning early!") return @@ -734,15 +745,6 @@ class SettingsDetailViewController: HAFormViewController, TypedRowControllerType }.done { self?.updatePositions() }.cauterize() - - if vc.shouldOpenAutomationEditor { - vc.navigationController?.dismiss(animated: true, completion: { - Current.sceneManager.webViewWindowControllerPromise.then(\.webViewControllerPromise) - .done { controller in - controller.openActionAutomationEditor(actionId: vc.action.ID) - } - }) - } } }) }