Skip to content

90001-wecom-alarm-90001 Integration Guide

Capability Overview

wecom-alarm-90001 is integrated with ThinkLink through Source file does not provide it in Source file does not provide it mode. This guide documents the current deployable artifacts and their source-traceable versions.

ItemValue
Projectwecom-alarm-90001
VendorSource file does not provide it
Modelwecom-alarm-90001
Business Code90001
Integration ModeSource file does not provide it
ProtocolSource file does not provide it

Model catalog

Search for these models in ThinkLink by name or ID.

Model typeNameid_namePlatform model ID
ThinkLink Model[WECOM NOTIFY] 90001wecom_notify_90001109185132828454912

Features and Application Scope

This project covers wecom-alarm-90001 through Source file does not provide it. Its capability boundary, fields, and deployable models follow the current descriptor, requirements, and model sources.

Deployment and Data Acquisition

| DTU | Not applicable | | Power | Source file does not provide it | | LoRaWAN Class | Source file does not provide it | | Interface | Source file does not provide it | | Baud Rate | Not applicable |

Telemetry and Register Definitions

The source does not provide a standalone telemetry table; use the current thing models listed in the model inventory.

Parameter Definitions

No project-specific parameters are defined.

Requirements Evidence

The following key facts were extracted from the requirements source; line references support verification.

CategorySource FactSource
Protocol/Data- Webhook URL → → Key = wecom_webhook_url Value = webhook key=requirement/requirements.md:43
Protocol/Data- " webhook " valuerequirement/requirements.md:47
Protocol/Datatype action thing modelrequirement/requirements.md:59

Thing Model and RPC Code

id_name: wecom_notify_90001 · ID: 109185132828454912

javascript
// wecom_notify_90001 — 企业微信群机器人告警推送 RPC
//
// 与平台内置 ALARM RPC 同构入参 (name/action/title/level/desc),
// 触发模型可一份 params 同时喂给 alarm 与 wecom_notify。
//
// webhook URL 由平台 "系统管理 → 服务器配置 → 组织参数" 中的
// wecom_webhook_url 提供,仅组织管理员可见。脚本本身不持密钥。
//
// 参考: $THINKLINK_DOCS_ROOT/docs/zh/AN/WeComAlertIntegration.md §3.4 (= tkl-docs/claude/docs/zh/AN/...)

function rpc_script({ device, params, alarms, logger, org_params }) {
    let webhook = org_params?.wecom_webhook_url;
    if (!webhook) {
        logger.error("wecom_webhook_url not configured in org_params");
        return null;
    }

    let name   = params.name;
    let action = params.action;
    let title  = params.title || name || "";
    let level  = params.level || "mid";
    let desc   = params.desc  || "";

    if (action === "clear") {
        // 仅当该 alarm_name 当前处于活跃状态时才推送恢复通知,
        // 避免条件持续正常的情况下,每次上行都触发一条 clear 消息
        if (!alarms || alarms[name] === undefined) {
            return null;
        }
    } else if (action !== "new") {
        return null;
    }

    let levelColor = {
        urgent: "warning",
        high:   "warning",
        mid:    "comment",
        low:    "info"
    }[level] || "info";

    let header = action === "new" ? "### 设备告警" : "### 告警恢复";

    let content = [
        header,
        "> **设备名称**:" + device.name,
        "> **设备 EUI**:`" + device.eui + "`",
        "> **告警事件**:`" + name + "`",
        "> **告警标题**:" + title,
        "> **告警等级**:<font color=\"" + levelColor + "\">" + level.toUpperCase() + "</font>",
        "> **" + (action === "new" ? "告警内容" : "恢复说明") + "**:" + (desc || "无"),
        "> **时间**:" + new Date().toLocaleString("zh-CN", { timeZone: "Asia/Shanghai" })
    ].join("\n");

    return [
        {
            sleepTimeMs: 0,
            type: "axios",
            dnMsg: {
                method: "POST",
                url: webhook,
                headers: { "Content-Type": "application/json" },
                data: {
                    msgtype: "markdown",
                    markdown: { content: content }
                },
                timeout: 5000
            }
        }
    ];
}

// === 本地调试 ===
// 模拟一次 "new" 告警调用 (运行 node wecom_notify_90001.js 查看输出结构)
const testResult = rpc_script({
    device: { name: "测试温度计-01", eui: "0011223344556677" },
    params: {
        name:   "overheat_alarm",
        action: "new",
        title:  "过热告警: [测试温度计-01]",
        level:  "high",
        desc:   "温度 78℃,超过阈值 60℃"
    },
    alarms: {},
    org_params: { wecom_webhook_url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test-key" },
    logger: console
});
console.log(JSON.stringify(testResult, null, 2));

Thing Model Field Definitions

The models do not provide a telemetry_config field table.

RPC Parameter Definitions

No RPC input templates are defined.

Trigger Definitions

No project-specific triggers are defined.

Third-Party Platform Subscription

MQTT Topic: /v32/{Organization Account}/tkl/up/telemetry/{eui}

json
{
  "eui": "6353012af10a9331",
  "active_time": "2026-07-13T08:35:48.000Z",
  "thingModelId": "Use the platform model ID from the model inventory",
  "thingModelIdName": "Use the current telemetry model id_name",
  "telemetry_data": {
    "snr": 13.5,
    "rssi": -51,
    "battery": 3.37
  }
}

Template Selection and Verification

Search ThinkLink by project name, business code, or the id_name and ID values in the model inventory. After deployment, use real uplinks to verify fields, units, RPCs, and trigger behavior.

Supplementary Notes

Requirements and decisions: requirement/requirements.md.