跳至內容

AI Task Integration

2026年6月2日
AI Task Integration
渥屋科技股份有限公司, 系統管理者
AI Task

AI Task

AI Task is one of WoowTech's foundational, behind-the-scenes integrations. You won't find it in the list of integrations you can add yourself — instead, it acts as plumbing that other integrations plug into. When an integration wants to expose large-language-model or image-generation capabilities to your automations, scripts, and dashboards, it does so by registering AI Task entities. From there you call a couple of generic actions and let whichever AI provider you configured do the heavy lifting.

This design keeps your automations provider-agnostic: the same ai_task.generate_data call works whether the underlying entity is backed by a local model or a cloud service.

What the entity state tells you

Each AI Task entity reports a single timestamp as its state. That value is simply the moment the entity last ran a task. It's handy when you want an automation to react to "an AI task just finished" or to display how recently a model was queried.

Actions you can call

There are two actions. One returns text or structured fields, the other returns an image.

ai_task.generate_data

Use this to ask a model for text — anything from a one-line summary to a fully structured object with named fields. The action hands back the generated data along with a conversation_id you can reference in follow-up calls.

Field Mandatory What it does
task_name Yes A short label naming this particular job.
instructions Yes The prompt — what you actually want the model to produce.
entity_id No Which AI Task entity (i.e. which model/provider) should handle it.
structure No A schema describing the named fields you want returned.
attachments No Media to feed in, such as a still image from a camera.

ai_task.generate_image

Use this to turn a text description into a picture. The response carries the image's media-source identifier, a temporary URL (valid for roughly an hour), the prompt the model actually used after any internal revision, the model name, the pixel dimensions, and the MIME type.

Field Mandatory What it does
task_name Yes A label for this image job.
instructions Yes The description the image should be generated from.
entity_id No The AI Task entity to route the request to.
attachments No Reference media to guide the generation.

Generated images are filed under a predictable name pattern — {date}_{time}_{cleaned_task_name}.{extension} — so a job named "Garden snapshot" might land as 2026-03-08_071530_garden-snapshot.png.

Worked examples

Returning a plain text answer

This script action asks a model to draft a friendly good-morning line and stuffs the result into a response variable.

script:
  morning_greeting:
    sequence:
      - action: ai_task.generate_data
        data:
          task_name: "Daily greeting"
          instructions: >-
            Write one upbeat sentence wishing the household a good morning.
            Mention that the coffee maker is ready.
        response_variable: greeting_result
      - action: notify.kitchen_display
        data:
          message: "{{ greeting_result.data }}"

Asking for structured fields

Supply a structure and the model returns each field by name, ready to use as template values. Here we ask for a short weather brief broken into separate pieces.

script:
  weather_brief:
    sequence:
      - action: ai_task.generate_data
        data:
          task_name: "Weather brief"
          entity_id: ai_task.local_llm
          instructions: >-
            Summarize today's forecast for a family planning outdoor chores.
          structure:
            headline:
              description: "A one-line summary of the day"
              selector:
                text:
            chore_advice:
              description: "Whether outdoor work is a good idea today"
              selector:
                text:
            high_temp_c:
              description: "Expected high in Celsius"
              selector:
                number:
        response_variable: brief
      - action: notify.family_group
        data:
          title: "{{ brief.data.headline }}"
          message: >-
            {{ brief.data.chore_advice }}
            High around {{ brief.data.high_temp_c }} degrees.

Counting things in a camera image

You can pass a snapshot in via attachments and ask the model to analyze it. This automation grabs a frame from the driveway camera, then asks how many vehicles are parked.

automation:
  - alias: "Report driveway occupancy"
    triggers:
      - trigger: state
        entity_id: binary_sensor.driveway_motion
        to: "on"
    actions:
      - action: camera.snapshot
        target:
          entity_id: camera.driveway
        data:
          filename: "/config/www/driveway_latest.jpg"
      - action: ai_task.generate_data
        data:
          task_name: "Driveway vehicle count"
          instructions: "How many cars are visible in this photo? Reply with just a number."
          attachments:
            media_content_id: "media-source://media_source/local/driveway_latest.jpg"
            media_content_type: "image/jpeg"
        response_variable: count_result
      - action: notify.mobile_app_phone
        data:
          message: "Driveway shows {{ count_result.data }} vehicle(s)."

Generating an image on a schedule

This automation refreshes a stylized weather illustration every morning and saves the result somewhere your dashboard can pick it up.

automation:
  - alias: "Refresh daily weather art"
    triggers:
      - trigger: time
        at: "06:15:00"
    actions:
      - action: ai_task.generate_image
        data:
          task_name: "Weather illustration"
          entity_id: ai_task.image_studio
          instructions: >-
            A flat-style illustration of {{ states('weather.home') }} weather
            over a quiet suburban street at dawn.
        response_variable: art
      - action: notify.persistent_notification
        data:
          title: "Today's weather art"
          message: "![weather]({{ art.url }})"

Where it's useful

A few directions people take this: tallying objects seen by a camera, turning raw sensor readings into readable summaries, writing playful or context-aware notification text, building multi-field reports, and producing fresh artwork for dashboards.

Notes

AI Task arrived in the WoowTech 2025.7 release and ships as an internal building-block integration. Because it relies on another integration to supply the actual model, make sure at least one AI provider that exposes AI Task entities is set up before you call these actions.

Start writing here...

網誌: Help center
分享這個貼文