الأتمتة

الوصف

يوفّر عنصر Automation Struct جميع سلوكيات التشغيل الآلي. وقد يحتوي على عدة عمليات تشغيل آلي فرعية تعمل معًا.

الحقول

المفتاح النوع الوصف
name String

اسم داخلي لعملية التشغيل الآلي هذه كمرجع للمطوّرين

اختياري

starters [Starter]

مُشغّلات التشغيل الآلي

مطلوب

condition الشرط

الشرط العام الذي يجب تطبيقه

اختياري

actions [Action]

إجراءات التشغيل الآلي

مطلوب

أمثلة

استخدام عملية تشغيل آلي واحدة: في الساعة 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