ST200TH 温湿度变送器

v1.0.2

立控 ST200TH 温湿度变送器全功能管理技能——查询温湿度/气压/海拔、查看设备信息(IP/型号/固件)、修改配置、补偿校准、重启设备、OTA升级。支持多设备管理,首次使用记住 MAC 后续免输入。

0· 80·0 current·0 all-time
Security Scan
VirusTotalVirusTotal
Pending
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description, required binaries (python3), dependency (paho-mqtt), and the provided script all match the stated purpose of full MQTT-based management of ST200TH devices. The MQTT broker, topics, and commands in the code correspond to device management/OTA/configuration operations described in SKILL.md.
Instruction Scope
SKILL.md instructs the agent to run the provided Python script with device MACs and manage devices; the instructions do not ask for unrelated files/credentials. Important runtime behaviors to note: the skill will connect to an external MQTT broker (mqtt.likong-iot.com) and publish/subscribe device commands/responses, and it persists device entries (MACs/names) to a local devices.json file in the skill directory.
Install Mechanism
Installation pulls paho-mqtt via the package manager (PyPI). No arbitrary remote download URLs or extracted archives are used; this is a standard Python dependency installation.
Credentials
The skill declares no required environment variables and requests no user secrets. However, the script contains hardcoded MQTT connection parameters (broker host, port, username 'public', password 'Aa123456'), which means the skill will communicate using those built-in credentials rather than asking the user for keys. This is coherent with its purpose but is a privacy/operational consideration (all device traffic goes through that broker with those credentials).
Persistence & Privilege
The skill is not always-enabled and does not require elevated privileges. It persists a local devices.json (in the skill directory) to remember MACs/names—expected for the 'remember MAC' feature and limited in scope.
Assessment
This skill appears to do what it says: manage ST200TH devices over MQTT. Before installing, consider: - Network/privacy: the script connects to mqtt.likong-iot.com using embedded credentials (username 'public', password 'Aa123456'). Device commands and returned device info (IP, MAC, firmware, sensor readings) will pass through that broker. If you require privacy or control, run the script on an isolated network or modify it to use your own broker/credentials. - Local persistence: MAC addresses and device names are stored in devices.json in the skill directory. If you share the agent workspace, this file could reveal device identifiers. - OTA safety: OTA URIs are HTTP-only and provided by the user; ensure the URI is trustworthy and reachable on your network. HTTP firmware downloads are unencrypted—avoid using public HTTP URLs for sensitive firmware updates. - If you don't trust the vendor broker or want stricter control, consider editing the script to accept broker/credentials via environment variables or to point to a broker you control. Overall, the skill is internally consistent with its description; weigh the privacy/network implications before use.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

🌡️ Clawdis
Binspython3

Install

uvuv tool install paho-mqtt
humidityvk97fq77gg3qc2cw2tfnd1x3rax83ycpziotvk97fq77gg3qc2cw2tfnd1x3rax83ycpzlatestvk97fq77gg3qc2cw2tfnd1x3rax83ycpzlikongvk97fq77gg3qc2cw2tfnd1x3rax83ycpzmqttvk97fq77gg3qc2cw2tfnd1x3rax83ycpzsensorvk97fq77gg3qc2cw2tfnd1x3rax83ycpztemperaturevk97fq77gg3qc2cw2tfnd1x3rax83ycpz
80downloads
0stars
3versions
Updated 2w ago
v1.0.2
MIT-0

ST200TH 温湿度变送器全功能管理

通过 MQTT 协议管理立控(LIKONG)ST200TH 系列温湿度变送器。支持查询传感器数据、查看/修改设备配置、补偿校准、重启、恢复出厂、OTA升级等全部功能。

协议文档:https://docv2.likong-iot.com/products/transmitters/ST200TH/mqtt

核心规则

  1. 必须有设备 MAC 地址。 首次使用时询问用户并用 add 保存,后续自动使用。
  2. 每次收到用户请求时先 list,有设备则直接操作,无设备则引导添加。
  3. 多设备时根据用户意图选择:指定名称/MAC → --mac;全部 → --all;不明确 → 列出让用户选。
  4. 危险操作(reset 恢复出厂、ota 升级)必须先让用户确认。
  5. 回复精炼,用户问温湿度就只答温湿度,追问时再补充其他。

脚本路径

{{SKILL_DIR}}/st200th_mqtt.py

完整命令参考

1. 查询传感器数据与系统信息 — query

查询温度、湿度、气压、海拔,以及设备IP、型号、固件版本、运行时间、MAC地址、网络连接方式、协议启用状态等。

# 单设备(已保存仅一个时自动选择)
python3 {{SKILL_DIR}}/st200th_mqtt.py query

# 指定设备
python3 {{SKILL_DIR}}/st200th_mqtt.py query --mac <MAC>

# 查询所有已保存设备
python3 {{SKILL_DIR}}/st200th_mqtt.py query --all

# JSON 输出(适合程序解析)
python3 {{SKILL_DIR}}/st200th_mqtt.py query --json
python3 {{SKILL_DIR}}/st200th_mqtt.py query --all --json

返回数据包含:

分组字段含义单位
datatemperature温度°C
datahumidity湿度%
datapressure大气压力hPa
dataaltitude海拔高度m
sysversion固件版本(如 HW:1.0.0_SDK:2.0.0)-
sysruntime运行时间
syseth_mac以太网 MAC 地址-
syssta_macWiFi MAC 地址-
netconnmethed连接方式(eth=以太网, wifi=无线)-
netip设备 IP 地址-
netdhcpDHCP 状态(1=启用, 0=静态)-
netssidWiFi SSID-
type-设备型号(如 ST200THPE)-
protocolmqtt/http/tcpserver/tcpclient各协议启用状态(1=启用)-
compensatet/h/p_compensate当前补偿值°C/%/hPa
setmqtt/tcp/http_timed_report各协议定时上报状态-
setmqtt/tcp/http_interval_time上报间隔

用户意图 → 回复策略:

用户说回复内容
"查一下温湿度"温度 XX°C,湿度 XX%
"气压多少"气压 XX hPa
"海拔呢"海拔 XX m
"设备IP是什么"IP 地址 XXX.XXX.XXX.XXX
"设备什么型号"型号 ST200THPE
"固件版本"HW:1.0.0_SDK:2.0.0
"设备运行多久了"运行时间 Xh Xm
"设备详细信息"输出全部字段

2. 查询设备配置 — customize

查看设备当前的 MQTT、TCP、HTTP 协议配置参数。

python3 {{SKILL_DIR}}/st200th_mqtt.py customize --mac <MAC>
python3 {{SKILL_DIR}}/st200th_mqtt.py customize --json

返回数据包含:

分组字段含义
mqtt_infoenable, mqtt_server, mqtt_port, client_id, username, password, publish, subcribe, qos, retain, timed_report, interval_timeMQTT 完整配置
tcp_infoenable, tcp_server, tcp_port, timed_report, interval_timeTCP 配置
http_infoenable, http_uri, timed_report, interval_timeHTTP 配置
compensatet/h/p_compensate补偿参数

3. 设置传感器补偿 — compensate

校准传感器读数偏差。立即生效,无响应返回。

# 设置温度补偿 +2°C
python3 {{SKILL_DIR}}/st200th_mqtt.py compensate --mac <MAC> -t 2

# 设置湿度补偿 -5%
python3 {{SKILL_DIR}}/st200th_mqtt.py compensate --mac <MAC> -hu -5

# 设置气压补偿 +10hPa
python3 {{SKILL_DIR}}/st200th_mqtt.py compensate --mac <MAC> -p 10

# 同时设置多个
python3 {{SKILL_DIR}}/st200th_mqtt.py compensate --mac <MAC> -t 1.5 -hu -3 -p 20

# 对所有设备设置
python3 {{SKILL_DIR}}/st200th_mqtt.py compensate --all -t 2

参数范围:

  • -t:温度补偿 -20 ~ +20 °C
  • -hu:湿度补偿 -20 ~ +20 %
  • -p:气压补偿 -500 ~ +500 hPa

4. 重启设备 — restart

立即生效,无响应返回。 修改协议配置(custom)后需重启才生效。

python3 {{SKILL_DIR}}/st200th_mqtt.py restart --mac <MAC>

5. 恢复出厂设置 — reset

立即生效,无响应返回。⚠️ 危险操作,必须让用户确认!

python3 {{SKILL_DIR}}/st200th_mqtt.py reset --mac <MAC>

执行前应提示用户:

恢复出厂设置将清除所有配置(包括 MQTT/TCP/HTTP 设置),确定要继续吗?

6. OTA 固件升级 — ota

立即生效,无响应返回。⚠️ 需用户确认!

python3 {{SKILL_DIR}}/st200th_mqtt.py ota --mac <MAC> --uri "http://10.0.0.50/likong-iot/module_v1.bin"

限制:

  • URI 仅支持 HTTP(不支持 HTTPS)
  • URI 最长 128 字符

7. 修改设备协议配置 — custom

修改 MQTT/TCP/HTTP 协议参数。重启后生效。

# 修改 MQTT 配置
python3 {{SKILL_DIR}}/st200th_mqtt.py custom --mac <MAC> --protocol mqtt \
  --server "mqtt.example.com" --port 1883 \
  --client-id "mydevice" --username "user" --password "pass" \
  --publish-topic "/my/publish" --subscribe-topic "/my/subscribe" \
  --qos 1 --timed-report 1 --interval 10

# 修改 TCP 配置
python3 {{SKILL_DIR}}/st200th_mqtt.py custom --mac <MAC> --protocol tcp \
  --enable 1 --server "tcp.example.com" --port 8888 \
  --timed-report 1 --interval 5

# 修改 HTTP 配置
python3 {{SKILL_DIR}}/st200th_mqtt.py custom --mac <MAC> --protocol http \
  --enable 1 --http-uri "http://api.example.com" \
  --timed-report 1 --interval 5

# 启用/禁用协议
python3 {{SKILL_DIR}}/st200th_mqtt.py custom --mac <MAC> --protocol tcp --enable 0

注意事项:

  • 修改后需执行 restart 才能生效
  • HTTP URI 最长 32 字符,不支持 HTTPS
  • 定时上报间隔建议 ≥5 秒,最低 2 秒
  • client_id、publish、subcribe 不能与其他设备重复

设备列表管理

# 添加设备(首次使用)
python3 {{SKILL_DIR}}/st200th_mqtt.py add <MAC> --name "办公室"

# 列出已保存设备
python3 {{SKILL_DIR}}/st200th_mqtt.py list

# 删除设备
python3 {{SKILL_DIR}}/st200th_mqtt.py remove <MAC>

首次使用流程

用户: "查一下温湿度"
  ↓
Agent: 执行 list → 无设备
  ↓
Agent: "首次使用,请提供设备的 WiFi MAC 地址(12位十六进制,如 ece334a7e044),
       可在设备管理页面「基本信息」中查看。也可以给设备起个名字,方便后续识别。"
  ↓
用户: "ece334a7e044,就叫办公室吧"
  ↓
Agent: 执行 add ece334a7e044 --name "办公室"
       执行 query
  ↓
Agent: "当前办公室温度 26.9°C,湿度 49.8%。"

错误处理

错误原因建议
查询超时设备离线或 MAC 错误确认设备已上电、MAC 正确
MAC 地址格式无效非12位十六进制检查 MAC 格式
缺少依赖 paho-mqttPython 库未安装pip3 install paho-mqtt
MQTT 连接失败网络或凭据问题检查网络连接
补偿超出范围参数超限温度±20、湿度±20、气压±500
URI 长度超限OTA URI > 128字符缩短 URI
存在多个设备未指定 MAC使用 --mac 或 --all

Comments

Loading comments...