指令碼

說明

頂層指令碼。

欄位

索引鍵 類型 說明
metadata 中繼資料

提供指令碼的中繼資料,例如名稱和說明。

必要

automations [自動化]

指定自動化動作清單。

必要

示例

使用開關控制燈具的簡單指令碼

metadata:
  name: Turn on light with switch
  description: Basic example of turning on a light with another switch.

automations:
  starters:
    type: device.state.OnOff
    device: Office Switch - Office
    state: on
    is: true
  actions:
  - type: device.command.OnOff
    devices:
    - Christmas lights - Living Room
    on: true