← 返回
未分类 Key 中文

Closeli Open Device status Query

Closeli Device Status Query API. Used to query the current status of specified devices and supports determining whether a device is online, offline, or sleep...
Closeli 设备状态查询 API,用于查询指定设备的当前状态,支持判断设备在线、离线或休眠。
closeli-open closeli-open 来源
未分类 clawhub v1.0.3 2 版本 100000 Key: 需要
★ 0
Stars
📥 475
下载
💾 0
安装
2
版本
#latest

概述

Device Status Query API

POST /api/device/status is used to batch query the online/offline status of devices.

⚠️ 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.

The script output includes the _device_names field (device_id → device_name mapping), which is used to display device names.

  1. When code == 0 and data is not empty, display it as a table:
Device NameMAC AddressStatus
--------------------------
Living Room Cameraaabbccddeeff🟢 Online
Front Door Camera112233445566🔴 Offline

Key rules:

  • Look up the device name corresponding to device_id from _device_names; if not found, display "Unknown Device"
  • device_id MUST be displayed as the MAC address after removing the xxxxS_ prefix
  • Status mapping: "online"🟢 Online, "offline"🔴 Offline
  1. When data is an empty {}, reply: "None of the requested devices belong to the current user. No queryable devices are available."
  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 device status query permission

Network Access Declaration

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

EndpointMethodPurpose
------------------
/api/device/listPOSTObtain device name mapping
/api/device/statusPOSTQuery device online/offline status

The script does not access any other network resources.

Quick Start

python3 check_status.py --device-ids "xxxxS_aabbccddeeff"

Query multiple devices (comma-separated):

python3 check_status.py --device-ids "xxxxS_aabbccddeeff,xxxxS_112233445566"

Request Format

Request Body

Parameter NameTypeRequiredDescription
--------------------------
device_idsstring[]YesDevice ID list, cannot be an empty array. Format: xxxxS_

Response Format

{
  "code": 0,
  "message": "success",
  "request_id": "<32-character request trace ID>",
  "data": {
    "xxxxS_aabbccddeeff": { "status": "online" },
    "xxxxS_112233445566": { "status": "offline" }
  },
  "_device_names": {
    "xxxxS_aabbccddeeff": "Living Room Camera",
    "xxxxS_112233445566": "Front Door Camera"
  }
}

data Field (Map Structure)

The key is device_id, and the value is the status object:

Parameter NameTypeDescription
--------------------
statusstringDevice status, value is "online" or "offline"

Error Codes

Error CodeHTTP Status CodeDescription
--------------------------
1001401api_key not provided
1002401api_key is invalid or disabled
2001400Missing required parameter (device_ids is an empty array)
3001502Internal gateway service call failed
3002502Internal gateway service call failed
3004502Internal 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
  • Devices that do not belong to the current user are silently filtered and do not return an error
  • Global request timeout is 120 seconds

版本历史

共 2 个版本

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

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Closeli Open Device Live Query

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

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,554
it-ops-security

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 90 📥 30,868