目录

openvela Smart Home AI Agent

This repository is a competition deliverable for the CCF/GitLink openvela AI Agent smart home track. It adds a deterministic smart home simulator to the openvela AI Agent package and verifies it on the goldfish emulator.

What It Adds

  • smart_light_control: controls simulated room lights.
  • smart_env_query: queries room temperature, humidity, illumination, light state, and air conditioner state.
  • smart_ac_control: controls simulated air conditioners.
  • tools: AI Agent CLI command to print registered tool schemas.
  • tool_call <name> [json]: AI Agent CLI command to invoke a tool directly for offline demos without an LLM API key.
  • smarthome_nl <text>: deterministic offline natural-language demo command that maps a small set of smart home utterances to registered tools and prints the full intent -> tool -> feedback chain.

The smart home tools use in-memory simulated state. They do not require real hardware, cloud services, MQTT, MCP, Feishu, or WeChat.

For a real LLM demo, configure the upstream AI Agent with set_llm and use the existing ask <text> command. For reproducible competition judging without API keys, use smarthome_nl so the same natural-language control flow can be verified offline.

Repository Layout

  • patches/packages_ai_agent.patch: changes for packages/ai_agent.
  • patches/vendor_openvela_goldfish_ai_agent.patch: goldfish defconfig change.
  • scripts/apply_patches.sh: applies both patches to an openvela repo workspace.
  • scripts/build_goldfish.sh: builds the goldfish target.
  • scripts/run_smarthome_demo.sh: runs a headless emulator demo and captures logs.
  • demo/logs/: verified build and emulator logs from AutoDL.
  • docs/design.md: implementation notes and demo evidence.

The patch script is idempotent: it applies missing patches and reports patches that are already present, which makes repeated verification runs easier on an existing openvela workspace.

Apply To openvela

Run these commands from an openvela repo workspace root:

REPO=/path/to/openvela
cd /path/to/openvela-smarthome-agent
./scripts/apply_patches.sh "$REPO"
./scripts/build_goldfish.sh "$REPO"
./scripts/run_smarthome_demo.sh "$REPO"

Expected target:

vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/

Verified Result

The implementation was built and smoke-tested on an AutoDL CPU cloud machine. Key evidence:

  • demo/logs/build_goldfish_ai_agent.log: build completed successfully.
  • demo/logs/emulator_ai_agent_cli.log: NSH starts and ai_agent CLI enters vela>.
  • demo/logs/emulator_smarthome_demo.log: smart home tools execute and return JSON.

Demo output excerpt:

smarthome_nl turn on living room light
{"stage":"intent_understanding","text":"turn on living room light"}
{"stage":"tool_selection","tool":"smart_light_control","input":{"room":"living_room","power":"on","brightness":78,"color_temp_k":4200}}
{"ok":true,"tool":"smart_light_control","room":"living_room","power":"on","brightness":78,"color_temp_k":4200}
{"stage":"result_feedback","message":"light command applied"}

tool_call smart_light_control {"room":"living_room","power":"on","brightness":78,"color_temp_k":4200}
{"ok":true,"tool":"smart_light_control","room":"living_room","power":"on","brightness":78,"color_temp_k":4200}

tool_call smart_ac_control {"room":"bedroom","power":"on","mode":"cool","target_temp_c":24,"fan_speed":"auto"}
{"ok":true,"tool":"smart_ac_control","room":"bedroom","power":"on","mode":"cool","target_temp_c":24,"fan_speed":"auto"}

Chinese keywords such as 客厅, 卧室, , 空调, and 温度 are also recognized by smarthome_nl. The captured demo log uses English commands to avoid serial-console encoding issues in headless emulator output.

关于
57.0 KB
邀请码