多協議接入 產品介紹 快速入門 用戶指南 開發指南
EDP TCP透傳 MQTT Modbus HTTP
常見問題

新增觸發器

請求方式:POST

URL: http://api.onenet.hk.chinamobile.com/triggers

http body參數

參數名稱 格式 是否必須 說明
title string 觸發器名稱
ds_id string 數據流名稱
dev_ids array-string 設備ID,缺省時預設為全部設備
url string 告警通知地址
type string 觸發條件,見type說明列表
threshold 觸發條件門限值,與type配合使用,見type說明列表

type說明列表

type 說明
> threshold必須為數值
\< threshold必須為數值
>= threshold必須為數值
\<= threshold必須為數值
inout threshold設置為{“lolmt”:40,”uplmt”:52},表示數據值進入或離開閉區間[40,52]時觸發
in threshold設置為{“lolmt”:40,”uplmt”:52},表示數據值進入閉區間[40,52]時觸發
out threshold設置為{“lolmt”:40,”uplmt”:52},表示數據值離開閉區間[40,52]時觸發
change threshold 參數不用傳遞;當上載的值有改變時觸發告警
frozen threshold 為數值,指定多少秒內未上報數據觸發告警,同時被監控物件進入frozen狀態
live threshold為數值,指定多少秒後上報數據觸發告警

返回參數

參數名稱 格式 說明
errno int 調用錯誤碼,為0表示調用成功
error string 錯誤描述,為“succ”表示調用成功
data json 介面調用成功之後返回的設備相關信息,見data描述表

data描述表

參數名稱 格式 說明
trigger_id int 觸發器ID

請求頭部示例

P0ST http://api.onenet.hk.chinamobile.com/triggers HTTP/1.1

請求參數示例

{
    "title": "trigger",
    "ds_id": "gps",
    "url": "http://aoic.choqf.com",
    "type": ">",
    "threshold": 100
}

返回示例

{
    "errno":0,
    "data": {
        "trigger_id":123809
    },
    "error":"succ"
}

觸發數據示例

{
    "trigger": {
        "id": 123809,
        "threshold": 9.0,
        "type": ">"
    },
    "current_data": [{
            "dev_id": "2656",
            "ds_id": "gps",
            "ds_uuid": "FWEF-ZFW-ZFW-ZFWW",
            "at": "2009-09-07T12:16:02.001403Z",
            "value": 100
        }
    ]
}

个搜索结果,搜索内容 “

    0 个搜索结果,搜索内容 “