加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cmd.txt 2.70 KB
一键复制 编辑 原始数据 按行查看 历史
PPOV_NUC 提交于 2022-03-16 12:25 . 实验需要的配置文件
$ curl http://localhost:59881/api/v2/device -H "Content-Type:application/json" -X POST \
-d '[
{
"apiVersion": "v2",
"device": {
"name" :"Modbus-TCP-Temperature-Sensor",
"description":"This device is a product for monitoring the temperature via the ethernet",
"labels":[
"Temperature",
"Modbus TCP"
],
"serviceName": "device-modbus",
"profileName": "Ethernet-Temperature-Sensor",
"protocols":{
"modbus-tcp":{
"Address" : "172.17.0.1",
"Port" : "502",
"UnitID" : "1",
"Timeout" : "5",
"IdleTimeout" : "5"
}
},
"autoEvents":[
{
"Interval":"30s",
"onChange":false,
"SourceName":"Temperature"
}
],
"adminState":"UNLOCKED",
"operatingState":"UP"
}
}
]'
$ curl http://192.168.3.45:59882/api/v2/device/name/Modbus-TCP-Temperature-Sensor/AlarmThreshold \
-H "Content-Type:application/json" -X PUT \
-d '{"ThermostatL":"15","ThermostatH":"100"}'
$ curl http://localhost:59882/api/v2/device/name/Modbus-TCP-Temperature-Sensor/AlarmThreshold | json_pp
{
"statusCode" : 200,
"apiVersion" : "v2",
"event" : {
"origin" : 1624324686964377495,
"deviceName" : "Modbus-TCP-Temperature-Sensor",
"id" : "f3d44a0f-d2c3-4ef6-9441-ad6b1bfb8a9e",
"sourceName" : "AlarmThreshold",
"readings" : [
{
"resourceName" : "ThermostatL",
"value" : "1.500000e+01",
"deviceName" : "Modbus-TCP-Temperature-Sensor",
"id" : "9aa879a0-c184-476b-8124-34d35a2a51f3",
"valueType" : "Float32",
"mediaType" : "",
"binaryValue" : null,
"origin" : 1624324686963970614,
"profileName" : "Ethernet-Temperature-Sensor"
},
{
"value" : "1.000000e+02",
"resourceName" : "ThermostatH",
"deviceName" : "Modbus-TCP-Temperature-Sensor",
"id" : "bf7df23b-4338-4b93-a8bd-7abd5e848379",
"valueType" : "Float32",
"mediaType" : "",
"binaryValue" : null,
"origin" : 1624324686964343768,
"profileName" : "Ethernet-Temperature-Sensor"
}
],
"apiVersion" : "v2",
"profileName" : "Ethernet-Temperature-Sensor"
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化