説明
Automation Struct は、すべての自動化動作を提供します。複数の子自動化を含み、連携して動作する場合があります。
フィールド
| キー | 型 | 説明 |
|---|---|---|
name
|
文字列 |
デベロッパーが参照するための、この自動化の内部名。 省略可 |
starters
|
[スターター] |
自動化スターター。 必須 |
condition
|
条件 |
適用するグローバル条件。 省略可 |
actions
|
[アクション] |
自動化アクション。 必須 |
例
単一の自動化を使用する: 午後 6 時に照明をオンにする。
automations:
starters:
type: time.schedule
at: 6:00 pm
actions:
type: device.command.OnOff
devices: Light A - Living Room
on: true
スクリプトで複数の自動化を使用する: * 午後 6 時に照明をオンにする。* 午後 11 時にテレビをオフにし、「就寝時間です」とブロードキャストする。
automations:
- name: At 6pm, turn on light.
starters:
type: time.schedule
at: 6:00 pm
actions:
type: device.command.OnOff
devices: Light A - Living Room
on: true
- name: At 11pm, turn off TV and broadcast "time to sleep"
starters:
type: time.schedule
at: 6:00 pm
actions:
- type: device.command.OnOff
devices: TV - Living Room
on: false
- type: assistant.command.Broadcast
message: time to sleep