api-device-status

Closeli Device Status Query API. Used to query the current status of specified devices and supports determining whether a device is online, offline, or sleeping. Use when: You need to confirm whether a device is currently available, or check device status before live streaming or event queries. ⚠ Security requirement: You must set the AI_GATEWAY_API_KEY environment variable and use a least-privilege credential. Please obtain the environment variable from the AI settings page in the app.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "api-device-status" with this command: npx skills add closeli-open/api-device-status

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_KEYEnvironment variable (recommended), ~/.openclaw/.env (fallback), command line --api-keyAPI key used for API authentication. The script automatically retrieves it according to this priority order

Optional Configuration

Configuration ItemDelivery MethodDefault ValueDescription
AI_GATEWAY_HOSTEnvironment variable, ~/.openclaw/.envhttps://ai-open.icloseli.comGateway address
AI_GATEWAY_VERIFY_SSLEnvironment variabletrueSet to false to disable TLS certificate verification (development environments only)
AI_GATEWAY_NO_ENV_FILEEnvironment variablefalseSet to true to disable fallback reading from ~/.openclaw/.env (recommended for production environments)

Fallback Configuration Path

By default, the script reads the ~/.openclaw/.env file as the fallback configuration source. This file is shared by all skills and uses the format KEY=VALUE (one per line). In production environments, you MUST set AI_GATEWAY_NO_ENV_FILE=true to disable this fallback and instead pass all configuration directly through environment variables.

Security Notes

  • The shared credential file ~/.openclaw/.env can be read by all skills under the same user. In production environments, you MUST pass API_KEY through environment variables and MUST NOT rely on the shared credential file
  • 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_<mac>

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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Spicy Ai Video

Turn a 60-second talking head clip into 1080p high-energy edited videos just by typing what you need. Whether it's turning bland footage into visually intens...

Registry SourceRecently Updated
Coding

Video Maker Fast

Get polished MP4 videos ready to post, without touching a single slider. Upload your video clips (MP4, MOV, AVI, WebM, up to 500MB), say something like "trim...

Registry SourceRecently Updated
Coding

Generation Generator

generate text prompts or clips into AI generated videos with this skill. Works with MP4, MOV, PNG, JPG files up to 500MB. marketers, content creators, social...

Registry SourceRecently Updated
Coding

Editor On Android

Get edited MP4 clips ready to post, without touching a single slider. Upload your video clips (MP4, MOV, AVI, WebM, up to 500MB), say something like "trim th...

Registry SourceRecently Updated