Cawood‑AI Developer Guide – All Tools & How to Talk to the Assistant

This guide explains every tool that the Cawood‑AI integration exposes in your Home Assistant instance, and shows how you can converse with the built‑in conversation entity (conversation.cloud_api_gemma_4_31b) to make the assistant perform those actions.

Table of Contents

  1. Intro – Who is Cawood‑AI?
  2. Talking to the Assistant
  3. Full Tool Cheat‑Sheet
  4. Camera (Hikvision) Tools
  5. Home Assistant Core Tools
  6. File‑System Tools
  7. Terminal & Browser Tools
  8. Project & Email Tools
  9. Custom Integration Calls
  10. Meta & Helper Tools
  11. Full Conversation Example
  12. FAQ

1. Intro – Who is Cawood‑AI?

Cawood‑AI is a private AI assistant running inside your Home Assistant CSHv4 installation. It is backed by the OpenAI Cloud (the conversation.cloud_api_gemma_4_31b entity) and is equipped with a set of tool functions that let it read files, run commands, control devices, query cameras, and more. When you ask a question, the assistant decides which tool to call, executes it, and returns a concise answer.

2. Talking to the Assistant

The easiest way to interact is via the Conversation integration. You can type or speak a request, and Home Assistant will route it to the Gemma LLM.

service: conversation.process
entity_id: conversation.cloud_api_gemma_4_31b
data:
  text: "Turn on the living‑room lights"
  agent_id: conversation.cloud_api_gemma_4_31b
  # Optional – capture the response in a variable
  response_variable: talk_reply

When response_variable is provided, the full JSON response is stored in a temporary variable that you can use in subsequent actions (e.g. a notify or input_text.set_value service).

resp = await hass.services.async_call(
    "conversation",
    "process",
    {"text": "Give me the list of cameras", "agent_id": "conversation.cloud_api_gemma_4_31b"},
    blocking=True,
    return_response=True,
)
# resp will contain a dict with the LLM answer and any tool output

3. Full Tool Cheat‑Sheet

Below is a quick reference for every tool the assistant can use. Each entry shows the tool name, required parameters, and a tiny example.

ToolCategoryParameters (required)Example
camera_listCameraNone (optional dvr)list all cameras
camera_analyzeCamerachannel, frames (1‑5)Analyze front‑door: {"channel":101,"frames":3}
camera_eventsCamerachannel (optional), limit, since_hoursShow last hour of activity
camera_snapshotCamerachannelGet a still image
camera_knownCameraNoneList known people/objects
camera_teachCameraevent_id, summary, threat_levelTeach a name
camera_questionsCamerastatus, channelList open questions
camera_answerCameraquestion_id, answerAnswer “Who is the child?”
camera_rulesCameraNoneShow threat rules
camera_set_ruleCamerawho, kind, levelSet unknown‑person‑night = high
ha_list_entitiesHA Coredomain, area, queryFind all lights
ha_get_stateHA Coreentity_idGet state of sensor.temp
ha_call_serviceHA Coredomain, service, entity_id, dataTurn on light
integration_listHA CoreNoneList custom integrations
integration_callHA Coredomain, service, dataCall artificial_intelligence.cai_hikvision_get_events
fs_listFilespathList config folder
fs_readFilespath, offsetRead a file
fs_writeFilespath, content, modeCreate script
fs_mkdirFilespathCreate folder
fs_moveFilespath, toRename file
fs_deleteFilespath, recursiveDelete folder
list_machinesTerminalNoneShow agents
run_commandTerminalcommand, machine, cwd, timeoutPing 8.8.8.8 on ha
python_runTerminalcode, cwd, timeout, stdinSimple script
python_hassTerminalcode, timeoutRead all lights
browserTerminalaction, url, selector, text, key, script, machineGoto a page
project_listProjectsNoneList all projects
project_searchProjectsfolder, query, budgetSearch notes for “router”
project_share_emailProjectsfolder, to, linkHoursShare project
email_sendEmailto, subject, bodySend alert
describe_capabilitiesMetatopicExplain how browser works

Every tool can be called directly by the assistant when you phrase a request that matches its intent. For example, saying “Show me the last hour of activity on camera 101” will cause the assistant to invoke camera_events with channel=101 and since_hours=1.

4. Camera (Hikvision) Tools

The CCTV subsystem provides a full AI pipeline. Use the tools to get live analysis, historical events, and to teach the AI.

service: artificial_intelligence.cai_hikvision_analyze
entity_id: camera.front_door
# In a script you would call ha_call_service with:
 data:
   channel: 101
   frames: 3
   question: "Is anyone at the gate?"
   notify: true

5. Home Assistant Core Tools

These tools interact with the normal HA entity model (only exposed entities are visible to the voice assistant).

When a tool is not exposed via ha_* (e.g. device registry or hidden entities), use python_hass for direct hass object access.

6. File‑System Tools

All paths are relative to one of the base locations:

Typical workflow:

# 1️⃣ List the config folder
service: artificial_intelligence.fs_list
entity_id: ''
data:
  path: "config"

# 2️⃣ Read a file (offset 0 for start)
service: artificial_intelligence.fs_read
entity_id: ''
data:
  path: "config/configuration.yaml"
  offset: 0

# 3️⃣ Write a new helper script
service: artificial_intelligence.fs_write
entity_id: ''
data:
  path: "_workspace/hello.py"
  content: "print('Hello from Home Assistant')"
  mode: "create"

7. Terminal & Browser Tools

service: artificial_intelligence.run_command
entity_id: ''
data:
  command: "df -h"
  machine: "ha"
  cwd: "/"
  timeout: 30
service: artificial_intelligence.python_hass
entity_id: ''
data:
  code: "return {e.entity_id: e.state for e in hass.states.async_all('light')}"

8. Project & Email Tools

9. Custom Integration Calls

The integration_list service enumerates all custom integrations you have installed (e.g., alarmo, alexa_media, browser_mod, gonzales, hikconnect, powercalc). After you know the domain and service name, call it with integration_call.

Example – arm the Alarmo alarm panel:

service: artificial_intelligence.integration_call
entity_id: ''
data:
  domain: alarmo
  service: arm
  data:
    entity_id: alarm_control_panel.alarm
    mode: "away"
    code: "1234"

10. Meta & Helper Tools

11. Full Conversation Example (5‑step chat)

Below is a complete script that asks the assistant to start a 2‑minute discussion about the universe, capture each answer, and finally dump the entire log into _workspace/universe_chat_log.txt.

# 1️⃣ Prompt the LLM – start the chat
- service: conversation.process
  entity_id: conversation.cloud_api_gemma_4_31b
  data:
    text: "Let's have a short conversation about how the universe was created. Ask me follow‑up questions as needed."
    response_variable: step1

# 2️⃣ Store the first reply
- service: input_text.set_value
  target:
    entity_id: input_text.chat_step_1
  data:
    value: "{{ step1.response.speech.plain.speech }}"

# 3️⃣ Ask the next question (use the previous answer as context)
- service: conversation.process
  entity_id: conversation.cloud_api_gemma_4_31b
  data:
    text: "{{ step1.response.speech.plain.speech }} What role did quantum fluctuations play?"
    response_variable: step2

- service: input_text.set_value
  target:
    entity_id: input_text.chat_step_2
  data:
    value: "{{ step2.response.speech.plain.speech }}"

# 4️⃣ Continue with three more prompts (dark matter, inflation, open questions)...
# (repeat the pattern above, changing the text each time)

# 5️⃣ Consolidate everything into a single text file
- service: artificial_intelligence.fs_write
  entity_id: ''
  data:
    path: "_workspace/universe_chat_log.txt"
    content: >-
      {{ states('input_text.chat_step_1') }}\n\n{{ states('input_text.chat_step_2') }}\n\n{{ states('input_text.chat_step_3') }}\n\n{{ states('input_text.chat_step_4') }}\n\n{{ states('input_text.chat_step_5') }}
    mode: "overwrite"

After the script runs, open https://cawood94.co.za/local/universe_chat_log.txt (once you move it to www as shown in step 5) to see the full transcript.

12. FAQ


Save this file as cawood_ai_guide.html in /config/www/ and open it at https://cawood94.co.za/local/cawood_ai_guide.html.