Automation

protocol Automation : BaseAutomation

The main representation of an automation, containing Metadata fields as well as the Automation Graph containing Automation nodes, including Starter instances, Condition instances, Action instances, and more.

  • Indicates whether or not the automation is valid. Users are able to save incomplete automations with non-blocking errors.

    Declaration

    Swift

    var isValid: Bool { get }
  • Indicates whether or not the automation is currently running.

    Declaration

    Swift

    var isRunning: Bool { get }
  • List of Validation Issues.

    Declaration

    Swift

    var validationIssues: [AutomationValidationIssue] { get }
  • Whether the automation can be manually executed. Set to true if both of the following conditions are true:

    • The [Automation] is valid.
    • automationGraph contains a ManualStarter node.
      • In some cases, the platform determines the automation can be implicitly manually executed without a ManualStarter node.

    Declaration

    Swift

    var manuallyExecutable: Bool { get }
  • Executes the automation.

    Throws

    HomeError if execution fails.

    Declaration

    Swift

    func execute() async throws
  • Stops the automation.

    Throws

    HomeError if execution stop fails.

    Declaration

    Swift

    func stop() async throws
  • Performs an update on the automation.

    Declaration

    Swift

    func update(_ block: (MutableAutomationData) -> Void) async throws -> any Automation

    Parameters

    block

    - A closure that receives an instance of MutableAutomationData to make desired updates.

    Return Value

    An automation with the applied updates.