← 返回
未分类 Key 中文

Closeli Open Device Event Query

Closeli Device Event Query API. Supports natural language queries for device events and returns an AI summary and event list, including event types, time ran...
Closeli设备事件查询API,支持自然语言查询设备事件,返回AI摘要和事件列表,包含事件类型、时间范围等信息。
closeli-open closeli-open 来源
未分类 clawhub v1.0.3 2 版本 100000 Key: 需要
★ 0
Stars
📥 487
下载
💾 0
安装
2
版本
#latest

概述

Event Query API

POST /api/event/query is an AI-powered event query API that supports natural language queries and returns an AI summary and event list.

⚠️ Display Rules (MUST be strictly followed)

The script outputs structured data in JSON format, which is the expected behavior. The display rules below are formatting instructions for the agent: the agent MUST parse the JSON output from the script, convert it into a user-friendly format according to the following rules before displaying it, and MUST NOT display the raw JSON directly.

  1. When code == 0 and data.events is not empty:

📋 AI Summary: {summary}

TimeEvent TagsScene Description
--------------------------
{time}{ai_events joined by commas}{ai_scene}

After the table, display the thumbnail link for each event one by one:

📷 {time} - {ai_events}

View Screenshot

Key rules:

  • device_id MUST be displayed after removing the xxxxS_ prefix
  • pic_url MUST be output using Markdown link format View Screenshot
  • MUST NOT use image syntax ![](url) (some clients do not support inline image rendering)
  • MUST NOT output bare URL text
  • If there are more than 10 items, only display the first 10 and indicate the total count
  1. When events is an empty array, reply: "No matching events were found within the query time range."
  2. When code != 0, reply: "API call failed, error code {code}, reason: {message}"

Prerequisites

The script depends on httpx. If it is not installed, the script will prompt python3 -m pip install httpx.

Configuration Declaration

This skill depends on the following configuration items. The agent and user MUST confirm that they are correctly configured before running.

Required Configuration

Configuration ItemDelivery MethodDescription
------------------------
AI_GATEWAY_API_KEY~/.openclaw/.env (persistent, written by OpenClaw clients), command line --api-key (temporary override)API key used for API authentication. CLI flag takes precedence over the file when both present

Optional Configuration

Configuration ItemDelivery MethodDefault ValueDescription
--------------------------------
AI_GATEWAY_HOST~/.openclaw/.envhttps://ai-open.icloseli.comGateway address
AI_GATEWAY_VERIFY_SSL~/.openclaw/.envtrueSet to false to disable TLS certificate verification (development environments only)

Configuration Source

The script reads ~/.openclaw/.env as the single persistent configuration source. This file is shared by all skills and uses the format KEY=VALUE (one entry per line). OpenClaw clients write to this file when the user updates settings. The script does NOT read any AI_GATEWAY_* environment variables — env variables are intentionally ignored to avoid stale Gateway-process snapshots overriding the user's latest config.

Security Notes

  • The shared credential file ~/.openclaw/.env is readable by all skills under the same user. Ensure file permissions are restricted (e.g. chmod 600 ~/.openclaw/.env) and that only the OpenClaw service user has access. The IM clients write to this file under that user's home directory.
  • TLS certificate verification is enabled by default. You MUST NOT disable it in production environments (disabling it introduces man-in-the-middle attack risks, and attackers may intercept API_KEY and device data)
  • Before use, you MUST confirm that AI_GATEWAY_HOST points to a trusted domain
  • You MUST use a least-privilege API_KEY to avoid reusing high-privilege credentials. This skill only requires event query permission

Network Access Declaration

This skill only accesses the following endpoints (all under AI_GATEWAY_HOST):

EndpointMethodPurpose
------------------
/api/event/queryPOSTQuery device events in natural language

The script does not access any other network resources.

Quick Start

python3 query_events.py \
  --device-ids "xxxxS_aabbccddeeff" \
  --start-date "2026-03-16" \
  --end-date "2026-03-18" \
  --query "Was there anyone here today?"

Request Format

Request Body

Parameter NameTypeRequiredDefault ValueDescription
----------------------------------
device_idsstring[]Yes-Device ID list, cannot be empty. Format: xxxxS_
start_datestringYes-Query start date, format yyyy-MM-dd
end_datestringYes-Query end date, format yyyy-MM-dd
querystringYes-Natural language query content
localestringNo"zh_CN"Locale, affects the language of the AI summary

Response Format

{
  "code": 0,
  "message": "success",
  "request_id": "<32-character request trace ID>",
  "data": {
    "summary": "A total of 3 person-detected events were identified today.",
    "events": [...],
    "_total_count": 15
  }
}

data Field

Parameter NameTypeDescription
--------------------
summarystringAI-generated event summary text
eventsarrayEvent list (the script has already trimmed it to the first 3 items)
_total_countintegerTotal number of events (additional field added by the script)

Elements of the events Array

Parameter NameTypeDescription
--------------------
device_idstringDevice ID
event_idstringEvent ID
timestringFormatted time string
ai_eventsstring[]List of AI-recognized event tags
ai_scenestringAI-described scene text
pic_urlstringShort link to the event thumbnail (may be empty)

Error Codes

Error CodeHTTP Status CodeDescription
--------------------------
1001401api_key not provided
1002401api_key is invalid or disabled
2001400Missing required parameter
3001502Internal gateway service call failed
5000500Internal error

Notes

  • device_ids cannot be an empty array, otherwise error code 2001 is returned
  • IMPORTANT: device_id is case-sensitive. The prefix MUST be lowercase xxxxS_, NOT uppercase XXXXS_. The script will auto-correct the case, but the agent SHOULD always pass the correct lowercase format
  • start_date and end_date use the yyyy-MM-dd format
  • query supports natural language
  • Global request timeout is 120 seconds

版本历史

共 2 个版本

  • v1.0.3 当前
    2026-05-07 04:03 安全 安全
  • v1.0.2
    2026-05-03 09:49 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,396 📥 322,513
dev-programming

Closeli Open Device Live Query

closeli-open
克洛斯利设备实时查询API。用于获取指定设备的Web实时播放链接,支持实时查看设备画面。使用场景:
★ 0 📥 608
ai-agent

Find Skills

guipi888
场景驱动+关键词双模式技能发现工具。当用户用自然语言描述场景/需求(如"我想做一个海报""帮我分析股票"),或明确说"安装技能/find skills/找个skill"时,自动从官方内置、本地已安装、SkillHub、虾评、GitHub、C
★ 1,460 📥 517,911