การทำงานอัตโนมัติ

คำอธิบาย

Automation Struct มีลักษณะการทำงานอัตโนมัติทั้งหมด ซึ่งอาจมีการทำงานอัตโนมัติย่อยหลายรายการที่ทำงานร่วมกัน

ช่อง

คีย์ ประเภท คำอธิบาย
name String

ชื่อภายในของการทำงานอัตโนมัตินี้สำหรับใช้อ้างอิงของนักพัฒนาแอป

ไม่บังคับ

starters [Starter]

ตัวเริ่มการทำงานอัตโนมัติ

ต้องระบุ

condition Condition

เงื่อนไขส่วนกลางที่จะใช้

ไม่บังคับ

actions [Action]

การทำงานอัตโนมัติ

ต้องระบุ

ตัวอย่าง

ใช้การทำงานอัตโนมัติรายการเดียว: เปิดไฟตอน 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