Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计提醒

mqttmqtt 命令行

Agent Skill

mqtt 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

416

周安装

17

GitHub Stars

4

下载量

133
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:mqtt(mqtt 命令行)
来源仓库:https://github.com/alphaonedev/openclaw-graph
仓库路径:skills/mqtt
安装命令:
npx skills add https://github.com/alphaonedev/openclaw-graph --skill mqtt
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/alphaonedev/openclaw-graph --skill mqtt

简介

该技能用于 MQTT 协议发布订阅通信,支持 IoT 设备遥测与控制消息传输。

  • 适用于传感器数据整理、远程设备管理及低带宽环境通信。
  • 通过 GitHub 仓库安装,适用于 Codex、Claude、Cursor、Gemini CLI。
  • 需配置 QoS 等级与保留消息策略保障消息可靠性。
  • 不适合高吞吐文件传输,推荐 HTTP 或 gRPC 替代方案。

SKILL.md

mqtt

Purpose

This skill allows the AI to interact with MQTT, a lightweight pub/sub protocol, for efficient IoT communication. Use it to publish telemetry data or subscribe to device updates, enabling real-time interactions in constrained environments.

When to Use

Use this skill for scenarios requiring low-bandwidth, real-time messaging, such as sending sensor data from IoT devices, remote device control, or telemetry monitoring. Avoid it for high-throughput needs like file transfers, where HTTP is more suitable.

Key Capabilities

  • Publish messages to topics with configurable Quality of Service (QoS) levels (0, 1, or 2).
  • Subscribe to topics and handle incoming messages asynchronously.
  • Support for retained messages, last will and testament, and wildcard subscriptions (e.g., "#" for all subtopics).
  • Secure connections via TLS and authentication methods like username/password.

Usage Patterns

To use MQTT, first connect to a broker using a client library. Establish a connection with credentials, then publish or subscribe. For example, in a loop: connect, subscribe, process messages, and disconnect. Use environment variables for sensitive data, like $MQTT_BROKER_URL for the broker address. Always handle reconnections for unstable networks.

Common Commands/API

Use the Paho MQTT library for Python interactions. Import it as follows:

import paho.mqtt.client as mqtt

To connect to a broker:

  • Command: client.connect(broker_address, port=1883)
  • Example with auth: client.username_pw_set(username='$MQTT_USERNAME', password='$MQTT_PASSWORD')

To publish a message:

  • API: client.publish(topic, payload, qos=1)
  • Example: client.publish('sensors/temp', '22.5', qos=1)

To subscribe:

  • API: client.subscribe(topic, qos=1)
  • Example: client.subscribe('commands/device1', qos=1)

Config format: Use a JSON file for settings, e.g., {"broker": "$MQTT_BROKER_URL", "topic": "sensors/temp"}. CLI tools like mosquitto_pub can be invoked via subprocess: subprocess.run(['mosquitto_pub', '-h', '$MQTT_BROKER_URL', '-t', 'sensors/temp', '-m', '22.5']).

Integration Notes

Integrate MQTT by wrapping it in your AI agent's code. Set environment variables for keys, e.g., export $MQTT_API_KEY for token-based auth. For multi-service setups, use a broker like HiveMQ or Mosquitto; connect via client.connect('$MQTT_BROKER_URL'). Ensure TLS for secure endpoints (e.g., client.tls_set()). If combining with other skills, like a database, publish data on success: e.g., after inserting into a DB, run client.publish('db/updates', json.dumps(data)).

Error Handling

Handle common errors explicitly. For connection issues, catch ConnectionRefusedError and retry with exponential backoff: e.g., time.sleep(5). For publish failures, check return codes (e.g., if client.publish() returns >0, log and retry). Subscription errors might involve invalid topics; validate with if '/' not in topic: raise ValueError('Invalid topic'). Use callbacks for message errors, like in on_message handler: if error: print('Error: ', error). Always clean up with client.disconnect() in a finally block.

Concrete Usage Examples

Example 1: Publish sensor data To publish a temperature reading to an MQTT topic, first set env vars: export MQTT_BROKER_URL='broker.example.com'. Then, in code:

client = mqtt.Client()
client.connect(os.environ['MQTT_BROKER_URL'])
client.publish('sensors/temperature', '25.0', qos=1)
client.disconnect()

This sends a message to the broker for IoT dashboard updates.

Example 2: Subscribe to device commands To subscribe and react to commands, use:

def on_message(client, userdata, message):
    print(f"Received: {message.payload.decode()}")
client = mqtt.Client()
client.on_message = on_message
client.connect(os.environ['MQTT_BROKER_URL'])
client.subscribe('commands/device1', qos=1)
client.loop_forever()

This keeps the client listening for commands to control an IoT device.

Graph Relationships

  • Related to cluster: iot
  • Related to tags: iot, mqtt
  • Connections: Can integrate with other iot skills, such as for data processing or device management.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.27%
按下载量换算52

Claude

27.48%
按下载量换算37

Cursor

18.93%
按下载量换算25

Gemini CLI

9.44%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills