คำอธิบาย
Automation Struct จะระบุลักษณะการทำงานของการทำงานอัตโนมัติทั้งหมด โดยอาจมีการทำงานอัตโนมัติย่อยหลายรายการที่ทำงานร่วมกัน
ช่อง
คีย์ | ประเภท | คำอธิบาย |
---|---|---|
name
|
String |
ชื่อภายในของการทำงานอัตโนมัตินี้เพื่อใช้อ้างอิงสำหรับนักพัฒนาแอป ไม่บังคับ |
starters
|
[Starter] |
เงื่อนไขเริ่มต้นสำหรับการทำงานอัตโนมัติ ต้องระบุ |
condition
|
Condition |
เงื่อนไขทั่วโลกที่จะใช้ ไม่บังคับ |
actions
|
[การดำเนินการ] |
การดำเนินการอัตโนมัติ ต้องระบุ |
ตัวอย่าง
ใช้การทำงานอัตโนมัติเดียว: เปิดไฟตอน 18:00 น.
automations:
starters:
type: time.schedule
at: 6:00 pm
actions:
type: device.command.OnOff
devices: Light A - Living Room
on: true
ใช้การทำงานอัตโนมัติหลายรายการในสคริปต์ * เปิดไฟตอน 18:00 น. * เวลา 23:00 น. ให้ปิดทีวีและประกาศว่า "ได้เวลานอนแล้ว"
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