# Automation

    protocol Automation : https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/BaseAutomation.html, https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/CustomAppDataSupporting.html

The main representation of an automation, containing metadata fields as well as the automation
graph containing automation nodes, including `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Starter.html`, `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/Condition.html`, and `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/Action.html`
instances, and more.
- `


  ### [isValid](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP7isValidSbvp)


  ` 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 }

- `


  ### [isRunning](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP9isRunningSbvp)


  ` Indicates whether or not the automation is currently running.

  #### Declaration

  Swift

      var isRunning: Bool { get }

- `


  ### [validationIssues](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP16validationIssuesSayAA0D15ValidationIssueVGvp)


  ` List of Validation Issues.

  #### Declaration

  Swift

      var validationIssues: [https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/AutomationValidationIssue.html] { get }

- `


  ### [manuallyExecutable](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP18manuallyExecutableSbvp)


  ` 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 `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/ManualStarter.html` node.
    - In some cases, the platform determines the automation can be implicitly manually executed without a `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/ManualStarter.html` node.

  #### Declaration

  Swift

      var manuallyExecutable: Bool { get }

- `


  ### [compatibleWithSdk](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP17compatibleWithSdkSbvp)


  ` Whether the underlying automation data is compatible with the current SDK.
  Set to `true` if the automationGraph doesn't contain any fields
  that are unknown to the current SDK.

  #### Declaration

  Swift

      var compatibleWithSdk: Bool { get }

- `


  ### [execute()](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP7executeyyYaKF)


  ` Executes the automation.
  Throws
  `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/HomeError.html` if execution fails.

  #### Declaration

  Swift

      func execute() async throws

- `


  ### [stop()](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP4stopyyYaKF)


  ` Stops the automation.
  Throws
  `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Structs/HomeError.html` if execution stop fails.

  #### Declaration

  Swift

      func stop() async throws

- `


  ### [update(_:)](https://developers.home.google.com/reference/swift/GoogleHomeSDK/Protocols/Automation#/s:13GoogleHomeSDK10AutomationP6updateyAaB_pyAA07MutableD4DataCXEYaKF)


  ` Performs an update on the automation.

  #### Declaration

  Swift

      func update(_ block: (https://developers.home.google.com/reference/swift/GoogleHomeSDK/Classes/MutableAutomationData.html) -> Void) async throws -> any Automation

  #### Parameters

  |---|---|
  | ` block ` | - A closure that receives an instance of `https://developers.home.google.com/reference/swift/GoogleHomeSDK/Classes/MutableAutomationData.html` to make desired updates. |

  #### Return Value

  An automation with the applied updates.