DS-501 LoRaWAN 智能插座用户手册
设备信息:型号 DS-501,devEui ffffff1000048920,网关 IP 192.168.31.205,Modbus Slave ID 3,BACnet Device ID 102
1 协议概览
DS-501 在 Fport 210 上报开关状态、锁定状态、电压、电流、有功功率、能量消耗及信号质量。
1.1 上行数据协议(Fport 210)
载荷格式(Fport 210):
| 字节位置 | 字段 | 说明 |
|---|---|---|
| 0 | 保留 | 固定 0x00(协议版本) |
| 1 … N | TLV 对 | [Type(1 B)][Value(N B)] … 循环至结束 |
每个 Type 字节决定字段名称和后续 value 字节数:
| Type | Value字节数 | 字段名称 | 编码方式 | 换算 | 单位 | 说明 |
|---|---|---|---|---|---|---|
0x01 |
1 | model |
uint8 | — | — | 型号码 = 0x48 |
0x22 |
1 | switch |
uint8 | — | — | 0=断开 1=闭合(继电器状态) |
0x96 |
1 | lockState |
uint8 | — | — | 0=解锁 1=锁定 |
0x79 |
4 | timestamp |
uint32 BE | — | s | 设备本地 Unix 时间戳(无 RTC 时为 0) |
0x80 |
4 | timerStatus |
bitfield32 BE | — | — | Bit 0=定时关开关 Bit 1=定时开开关 Bit 30=定时锁定 Bit 31=定时解锁 |
0x97 |
2 | voltage |
uint16 BE | ÷10 | V | 如 0x09C4=2500 → 250.0 V |
0x98 |
2 | current |
uint16 BE | ÷100 | A | 如 0x0064=100 → 1.00 A |
0x99 |
2 | activePower |
int16 BE | ÷100 | W | 有符号;如 0x00C8=200 → 2.00 W |
0x9A |
4 | energy |
uint32 BE | ÷100 | kWh | 累计能量;如 100 → 1.00 kWh |
JavaScript 解码示例:
// DS-501 Smart Plug — Fport 210 uplink decoder
function decodeUplink(bytes) {
var i = 1, r = {};
function u16(b,o){ return (b[o]<<8)|b[o+1]; }
function i16(b,o){ var v=u16(b,o); return v>32767?v-65536:v; }
function u32(b,o){ return ((b[o]<<24)|(b[o+1]<<16)|(b[o+2]<<8)|b[o+3])>>>0; }
while (i < bytes.length) {
var t = bytes[i++];
switch (t) {
case 0x01: r.model = bytes[i++]; break;
case 0x22: r.switch = bytes[i++]; break; // 0=OFF 1=ON
case 0x79: r.timestamp = u32(bytes,i); i+=4; break;
case 0x80: {
var bits = u32(bytes,i); i+=4;
r.timerCloseEnabled = (bits&0x01)!==0;
r.timerOpenEnabled = (bits&0x02)!==0;
r.timerLockEnabled = (bits&0x40000000)!==0;
r.timerUnlockEnabled= (bits&0x80000000)!==0;
break;
}
case 0x96: r.lockState = bytes[i++]; break;
case 0x97: r.voltage = u16(bytes,i)/10; i+=2; break; // V
case 0x98: r.current = u16(bytes,i)/100; i+=2; break; // A
case 0x99: r.activePower = i16(bytes,i)/100; i+=2; break; // W
case 0x9A: r.energy = u32(bytes,i)/100; i+=4; break; // kWh
default: i++; break;
}
}
return r;
}
// Example payload (hex): 00 01 48 22 01 96 00 97 09 C4 98 00 64 99 00 C8 9A 00 00 00 64
// → { model:72, switch:1, lockState:0, voltage:250.0, current:1.00, activePower:2.00, energy:1.00 }
脚本下载:LPP.zip
版本说明: LPP.js 基于 ChirpStack v4.17.0 开发和测试。不同版本的 ChirpStack JavaScript 编解码器 API 可能存在差异——如果您使用的是其他版本,请在部署前检查并根据需要调整脚本。
1.2 下行控制协议
DS-501 支持立即/延时/定时开关及锁定指令,以及取消定时器,下行使用 Fport 2。
Fport:2 — 0x09 0x48(设备型号标识头)
载荷格式:09 48 [CmdCode] [Params...] 所有多字节值均为大端字节序(高位在前)。 T = 延时/定时时间(uint32 BE,延时为秒数,定时为 Unix 时间戳)。 R = 重复标志:0x00=仅一次,0x01=每天重复。
| 命令码 | 载荷字节 | 说明 |
|---|---|---|
0x00 |
09 48 00 01 |
立即断开插座 |
0x01 |
09 48 01 01 |
立即闭合插座 |
0x02 |
09 48 02 |
解锁 |
0x03 |
09 48 03 |
锁定 |
0x04 |
09 48 04 FF T3 T2 T1 T0 |
延时 T 秒后断开插座 |
0x05 |
09 48 05 FF T3 T2 T1 T0 |
延时 T 秒后闭合插座 |
0x06 |
09 48 06 FF T3 T2 T1 T0 R |
定时断开插座(Unix时间 T,R=重复) |
0x07 |
09 48 07 FF T3 T2 T1 T0 R |
定时闭合插座(Unix时间 T,R=重复) |
0x08 |
09 48 08 T3 T2 T1 T0 |
延时 T 秒后解锁 |
0x09 |
09 48 09 T3 T2 T1 T0 |
延时 T 秒后锁定 |
0x0A |
09 48 0A T3 T2 T1 T0 R |
定时解锁 |
0x0B |
09 48 0B T3 T2 T1 T0 R |
定时锁定 |
0x0C |
09 48 0C 01 |
取消插座定时 |
0x0D |
09 48 0D |
取消锁定定时 |
0x0E |
09 48 0E |
查询当前状态 |
JavaScript 编码器示例:
// DS-501 Smart Plug — Fport 2 downlink encoder
// Returns a byte array to send via LoRaWAN Fport 2.
function encodeDownlink(data) {
// data.command: 'socketOff'|'socketOn'|'unlock'|'lock'|'query'|'cancelTimer'|'cancelLockTimer'
// data.delaySeconds (optional) : uint32, for delayed commands
// data.scheduleAt (optional) : Unix timestamp uint32, for scheduled commands
// data.repeatDaily (optional) : bool
var H = [0x09, 0x48];
var u32 = function(n){ return [(n>>>24)&0xFF,(n>>>16)&0xFF,(n>>>8)&0xFF,n&0xFF]; };
var T = (data.delaySeconds !== undefined) ? data.delaySeconds : (data.scheduleAt || 0);
var R = data.repeatDaily ? 0x01 : 0x00;
var cmd = String(data.command||'').trim().toLowerCase();
switch(cmd) {
case 'socketoff': case 'off': return H.concat([0x00, 0x01]);
case 'socketon': case 'on': return H.concat([0x01, 0x01]);
case 'unlock': return H.concat([0x02]);
case 'lock': return H.concat([0x03]);
case 'delayoff': return H.concat([0x04, 0xFF].concat(u32(T)));
case 'delayon': return H.concat([0x05, 0xFF].concat(u32(T)));
case 'scheduleoff':return H.concat([0x06, 0xFF].concat(u32(T)).concat([R]));
case 'scheduleon': return H.concat([0x07, 0xFF].concat(u32(T)).concat([R]));
case 'delayunlock':return H.concat([0x08].concat(u32(T)));
case 'delaylock': return H.concat([0x09].concat(u32(T)));
case 'scheduleunlock': return H.concat([0x0A].concat(u32(T)).concat([R]));
case 'schedulelock': return H.concat([0x0B].concat(u32(T)).concat([R]));
case 'canceltimer': case 'cancelsocket': return H.concat([0x0C, 0x01]);
case 'cancellocktimer': case 'cancellock': return H.concat([0x0D]);
case 'query': return H.concat([0x0E]);
default: return [];
}
}
// Examples:
// encodeDownlink({command:'socketOn'}) → [0x09,0x48,0x01,0x01]
// encodeDownlink({command:'delayOff', delaySeconds:30}) → [0x09,0x48,0x04,0xFF,0x00,0x00,0x00,0x1E]
// encodeDownlink({command:'scheduleOn', scheduleAt:1761177600, repeatDaily:true})
// → [0x09,0x48,0x07,0xFF,0x69,0x0E,0x2E,0x00,0x01]
2 获取上行数据
⚠️ 以下示例中的 IP 地址(192.168.31.205/192.168.31.193)、ChirpStack API token、Slave ID、BACnet Device ID 及 devEui 均为演示示例,请替换为实际网关 IP、ChirpStack API token 及设备参数。
2.1 ChirpStack MQTT 订阅
订阅 MQTT topic 以接收实时上行数据:
应用 ID —3ef9e6b9-ec54-4eda-86b8-a5fb46899f39是网关内置的出厂默认 ChirpStack 应用。
如果您创建了其他应用,请替换为实际的应用 ID。
网关 IP —192.168.31.205为示例网关 WAN 口 IP,
请替换为您实际的网关 IP 地址。
设备 EUI —ffffff1000048920为示例设备 EUI,
请替换为网关设备列表中显示的实际 EUI;
也可用+通配符一次订阅所有设备的数据。
# 订阅指定设备
mosquitto_sub -h 192.168.31.205 -p 1883 \
-u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/event/up"
# 订阅所有应用下所有设备(通配符)
mosquitto_sub -h 192.168.31.205 -p 1883 \
-u gateway -P mqtt88888888 \
-t "application/+/device/+/event/up"
上行数据载荷示例(JSON):
{
"devEui": "ffffff1000048920",
"fPort": 210,
"object": {
... (已解码的 LPP 字段)
}
}
2.2 IoT Hub HTTP API
发送 GET 请求获取设备最新状态:
curl -s "http://192.168.31.205:8070/api/getStatus?devEui=ffffff1000048920"
{
"success": true,
"result": {
"ds501ControlState": false,
"ds501RepeatDaily": false,
"switch": true,
"lockState": 1,
"voltage": 241.8,
"current": 0,
"activePower": 0,
"energy": 16.97,
"timestamp": 1775029074,
"timerCloseEnabled": false,
"timerOpenEnabled": false,
"timerLockEnabled": false,
"timerUnlockEnabled": false,
"model": "DS-501"
}
}
2.3 IoT Hub Modbus TCP — Python 脚本
脚本下载:modbus_tcp_read.py
使用 modbus_tcp_read.py 一次性读取所有寄存器:
python3 modbus_tcp_read.py --ip 192.168.31.205 --port 502 \
--slaveId 3 --sensorType DS-501
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
================================================================================================================================================================
Attribute | Addr | FC | Format | Order | Cnt | Scale | Raw(Hex) | Value | Unit
----------------------------------------------------------------------------------------------------------------------------------------------------------------
online | 6 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0001 | true | none
lastOnlineTime | 7 | 03 | UnixTime | Big(ABCD) | 2 | x1 | 69CC CB40 | 1775029056 | second
ds501ControlTarget | 9 | 03 | Int16 | Big(ABCD) | 1 | x1 | 0000 | 0.0 | none
ds501ControlState | 10 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0000 | false | none
ds501ControlMode | 11 | 03 | Int16 | Big(ABCD) | 1 | x1 | 0000 | 0.0 | none
ds501DelaySeconds | 12 | 03 | Int32 | Big(ABCD) | 2 | x1 | 0000 0000 | 0.0 | seconds
ds501ScheduleTimestamp | 14 | 03 | UnixTime | Big(ABCD) | 2 | x1 | 0000 0000 | 0 | seconds
ds501RepeatDaily | 16 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0000 | false | none
switch | 17 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0001 | true | none
lockState | 18 | 03 | Int16 | Big(ABCD) | 1 | x1 | 0001 | 1.0 | none
voltage | 19 | 03 | Int16(S) | Big(ABCD) | 1 | /10 | 0972 | 241.8 | volt
current | 20 | 03 | Int16(S) | Big(ABCD) | 1 | /100 | 0000 | 0.00 | ampere
... (22 fields total)
2.4 IoT Hub Modbus TCP — Modbus Poll
工具下载:Modbus Poll 9.5.0.1507.zip
- 打开 Modbus Poll,连接
192.168.31.205:502,Slave ID3 - 菜单 Setup → Read/Write Definition,功能码选 FC03,起始地址
6,长度62 - 点击 OK — 数值实时刷新
2.5 IoT Hub BACnet BIP — Python 脚本
脚本下载:bacnet_read.py
使用 bacnet_read.py 读取所有 BACnet 对象:
python3 bacnet_read.py --ip 192.168.31.205 --port 47808 --id 102
Target: 192.168.31.205:47808 | BACnet ID: 102 | Scan: 10200-10299
------------------------------------------------------------
Type | Instance | Offset | Value | Object Name
------------------------------------------------------------
BI | 10202 | 2 | active | ffffff1000048920.online
AI | 10203 | 3 | 1775028992.00 | ffffff1000048920.lastOnlineTime
AV | 10204 | 4 | 0.00 | ffffff1000048920.ds501ControlTarget
BV | 10205 | 5 | inactive | ffffff1000048920.ds501ControlState
AV | 10206 | 6 | 0.00 | ffffff1000048920.ds501ControlMode
AV | 10207 | 7 | 0.00 | ffffff1000048920.ds501DelaySeconds
AV | 10208 | 8 | 0.00 | ffffff1000048920.ds501ScheduleTimestamp
BV | 10209 | 9 | inactive | ffffff1000048920.ds501RepeatDaily
BV | 10210 | 10 | active | ffffff1000048920.switch
BV | 10211 | 11 | active | ffffff1000048920.lockState
AI | 10212 | 12 | 241.80 | ffffff1000048920.voltage
AI | 10213 | 13 | 0.00 | ffffff1000048920.current
... (25 objects total)
2.6 IoT Hub BACnet BIP — YABE
工具下载:SetupYabe_v2.1.0.exe
- 打开 YABE,连接
192.168.31.205:47808 - 在设备树中展开设备 102
- 浏览 AI/BI/AV/BV/CV 对象,查看实时数值
3 发送控制指令
DS-501 支持立即/延时/定时开关及锁定指令,以及取消定时器,下行使用 Fport 2。
⚠️ 以下示例中的 IP 地址(192.168.31.205/192.168.31.193)、ChirpStack API token、Slave ID、BACnet Device ID 及 devEui 均为演示示例,请替换为实际网关 IP、ChirpStack API token 及设备参数。
脚本下载:modbus_tcp_write.py · bacnet_write.py
示例 1a:立即闭合 / 断开插座(闭合 / 上电(ON))
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 switch --value 1
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 1
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
switch: 1
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=1 signed=1
ds501ControlState -> register 10 (4x40011) raw=1 signed=1
ds501ControlMode -> register 11 (4x40012) raw=0 signed=0
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
Observed values:
switch: 1
Link confirmation time: 0.133s
Control completed in: 0.144s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 switch --value 1
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 1
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
switch: 1
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=1
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=active
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=0
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
Observed values:
switch: 1
Link confirmation time: 0.010s
Control completed in: 0.085s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":true,"ds501ControlState":true,"ds501ControlMode":false,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":true,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": true,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":true,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": true,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 1b:立即闭合 / 断开插座(断开 / 断电(OFF))
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 switch --value 0
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
switch: 0
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=1 signed=1
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=0 signed=0
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
Observed values:
switch: 0
Link confirmation time: 0.133s
Control completed in: 0.144s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 switch --value 0
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
switch: 0
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=1
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=0
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
Observed values:
switch: 0
Link confirmation time: 0.010s
Control completed in: 0.085s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":true,"ds501ControlState":false,"ds501ControlMode":false,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 2a:立即锁定 / 解锁插座(锁定)
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 lock --value 1
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 1
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
lockState: 1
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=254 signed=254
ds501ControlState -> register 10 (4x40011) raw=1 signed=1
ds501ControlMode -> register 11 (4x40012) raw=0 signed=0
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
Observed values:
lockState: 1
Link confirmation time: 0.133s
Control completed in: 0.144s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 lock --value 1
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 1
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
lockState: 1
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=254
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=active
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=0
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
Observed values:
lockState: 1
Link confirmation time: 0.010s
Control completed in: 0.085s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":false,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": true,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": true,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 2b:立即锁定 / 解锁插座(解锁)
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 lock --value 0
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
lockState: 0
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=254 signed=254
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=0 signed=0
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
Observed values:
lockState: 0
Link confirmation time: 0.133s
Control completed in: 0.144s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 lock --value 0
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 0
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
lockState: 0
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=254
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=0
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
Observed values:
lockState: 0
Link confirmation time: 0.010s
Control completed in: 0.085s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":false,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":0,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 0,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 3a:延时 5 秒后闭合 / 断开插座(闭合 / 上电(ON))
设备收到指令后,延迟 5 秒再执行开关动作。
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 switchDelay --value 1 --delaySeconds 5
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 1
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=1 signed=1
ds501ControlState -> register 10 (4x40011) raw=1 signed=1
ds501ControlMode -> register 11 (4x40012) raw=1 signed=1
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=5 signed=5
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 switchDelay --value 1 --delaySeconds 5
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 1
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=1
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=active
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=1
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=5
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":true,"ds501ControlState":true,"ds501ControlMode":true,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":true,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": true,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":true,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": true,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 3b:延时 5 秒后闭合 / 断开插座(断开 / 断电(OFF))
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 switchDelay --value 0 --delaySeconds 5
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=1 signed=1
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=1 signed=1
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=5 signed=5
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 switchDelay --value 0 --delaySeconds 5
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=1
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=1
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=5
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":true,"ds501ControlState":false,"ds501ControlMode":true,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 4a:定时闭合 / 断开插座(2026-04-01 10:30,每天重复)(闭合 / 上电(ON))
定时时间为 2026-04-01 10:30:00(CST)对应 Unix 时间戳 1775010600。可通过 date -d '2026-04-01 10:30:00 +0800' +%s 获取。
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 switchSchedule --value 1 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 1
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=1 signed=1
ds501ControlState -> register 10 (4x40011) raw=1 signed=1
ds501ControlMode -> register 11 (4x40012) raw=2 signed=2
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=27084 signed=27084
ds501ScheduleTimestamp -> register 15 (4x40016) raw=33576 signed=-31960
ds501RepeatDaily -> register 16 (4x40017) raw=1 signed=1
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 switchSchedule --value 1 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 1
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=1
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=active
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=2
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=1775010600
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=active
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":true,"ds501ControlState":true,"ds501ControlMode":2,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":true,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": true,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":true,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": true,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
示例 4b:定时闭合 / 断开插座(2026-04-01 10:30,每天重复)(断开 / 断电(OFF))
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 switchSchedule --value 0 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=1 signed=1
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=2 signed=2
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=27084 signed=27084
ds501ScheduleTimestamp -> register 15 (4x40016) raw=33576 signed=-31960
ds501RepeatDaily -> register 16 (4x40017) raw=1 signed=1
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 switchSchedule --value 0 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=1
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=2
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=1775010600
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=active
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":true,"ds501ControlState":false,"ds501ControlMode":2,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
示例 5a:延时 5 秒后锁定 / 解锁(锁定)
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 lockDelay --value 1 --delaySeconds 5
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 1
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=254 signed=254
ds501ControlState -> register 10 (4x40011) raw=1 signed=1
ds501ControlMode -> register 11 (4x40012) raw=1 signed=1
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=5 signed=5
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 lockDelay --value 1 --delaySeconds 5
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 1
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=254
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=active
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=1
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=5
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":true,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": true,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": true,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 5b:延时 5 秒后锁定 / 解锁(解锁)
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 lockDelay --value 0 --delaySeconds 5
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=254 signed=254
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=1 signed=1
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=5 signed=5
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 lockDelay --value 0 --delaySeconds 5
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 1
ds501DelaySeconds: 5
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=254
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=1
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=5
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":true,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":false,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":1,"ds501DelaySeconds":5,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 1,
"ds501DelaySeconds": 5,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 6a:定时锁定 / 解锁(2026-04-01 10:30,每天重复)(锁定)
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 lockSchedule --value 1 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 1
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=254 signed=254
ds501ControlState -> register 10 (4x40011) raw=1 signed=1
ds501ControlMode -> register 11 (4x40012) raw=2 signed=2
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=27084 signed=27084
ds501ScheduleTimestamp -> register 15 (4x40016) raw=33576 signed=-31960
ds501RepeatDaily -> register 16 (4x40017) raw=1 signed=1
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 lockSchedule --value 1 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 1
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=254
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=active
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=2
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=1775010600
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=active
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":2,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": true,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":true,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": true,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
示例 6b:定时锁定 / 解锁(2026-04-01 10:30,每天重复)(解锁)
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 lockSchedule --value 0 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=254 signed=254
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=2 signed=2
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=27084 signed=27084
ds501ScheduleTimestamp -> register 15 (4x40016) raw=33576 signed=-31960
ds501RepeatDaily -> register 16 (4x40017) raw=1 signed=1
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 lockSchedule --value 0 --scheduleTimestamp 1775010600 --repeatDaily
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 2
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 1775010600
ds501RepeatDaily: 1
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=254
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=2
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=1775010600
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=active
No immediate read-back confirmation defined for this command.
Control completed in: 0.011s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":2,"ds501DelaySeconds":false,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":2,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":1775010600,"ds501RepeatDaily":true}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 2,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 1775010600,
"ds501RepeatDaily": true
}
}
示例 7:取消延时/定时 闭合或断开指令
取消插座的延时/定时 闭合或断开指令。
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 cancelSwitchTimer
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 3
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
switch: (unchanged)
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=1 signed=1
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=3 signed=3
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
Observed values:
switch: (unchanged)
Link confirmation time: 0.133s
Control completed in: 0.144s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 cancelSwitchTimer
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 1
ds501ControlState: 0
ds501ControlMode: 3
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
switch: (unchanged)
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=1
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=3
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
Observed values:
switch: (unchanged)
Link confirmation time: 0.010s
Control completed in: 0.085s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":3,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":3,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 3,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":1,"ds501ControlState":false,"ds501ControlMode":3,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 1,
"ds501ControlState": false,
"ds501ControlMode": 3,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
示例 8:取消延时/定时 锁定指令
取消锁定/解锁的延时/定时指令。
Modbus TCP:
python3 modbus_tcp_write.py --ip 192.168.31.205 --port 502 --slaveId 3 --sensorType DS-501 cancelLockTimer
Target: 192.168.31.205:502 | Slave ID: 3 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 3
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
lockState: (unchanged)
Attempt 1/1: writing control values (default)...
Modbus Poll write guide:
Batch 1: FC16 Write Multiple Registers | Start register: 9 (4x40010) | Count: 8
ds501ControlTarget -> register 9 (4x40010) raw=254 signed=254
ds501ControlState -> register 10 (4x40011) raw=0 signed=0
ds501ControlMode -> register 11 (4x40012) raw=3 signed=3
ds501DelaySeconds -> register 12 (4x40013) raw=0 signed=0
ds501DelaySeconds -> register 13 (4x40014) raw=0 signed=0
ds501ScheduleTimestamp -> register 14 (4x40015) raw=0 signed=0
ds501ScheduleTimestamp -> register 15 (4x40016) raw=0 signed=0
ds501RepeatDaily -> register 16 (4x40017) raw=0 signed=0
Observed values:
lockState: (unchanged)
Link confirmation time: 0.133s
Control completed in: 0.144s
脚本自动写入寄存器并回读验证。输出中的 Modbus Poll write guide 部分可直接用于 Modbus Poll 手动写入的参考。
Modbus Poll:
- 连接网关(IP
192.168.31.205,端口502,Slave ID3) - 菜单 Functions → 16 Write Multiple Registers
- 参照上方脚本输出中的 Modbus Poll write guide,填写寄存器地址和数值
- 点击 Send 发送写入指令
BACnet BIP:
python3 bacnet_write.py --ip 192.168.31.205 --port 47808 --id 102 --sensorType DS-501 cancelLockTimer
Target: 192.168.31.205:47808 | BACnet ID: 102 | Sensor: DS-501
Expected values:
ds501ControlTarget: 254
ds501ControlState: 0
ds501ControlMode: 3
ds501DelaySeconds: 0
ds501ScheduleTimestamp: 0
ds501RepeatDaily: 0
Expected confirmed state:
lockState: (unchanged)
Attempt 1/1: writing control values (default)...
YABE write guide:
ds501ControlTarget -> object analog-value,10204 | property present-value | type=analog-value | write=254
ds501ControlState -> object binary-value,10205 | property present-value | type=binary-value | write=inactive
ds501ControlMode -> object analog-value,10206 | property present-value | type=analog-value | write=3
ds501DelaySeconds -> object analog-value,10207 | property present-value | type=analog-value | write=0
ds501ScheduleTimestamp -> object analog-value,10208 | property present-value | type=analog-value | write=0
ds501RepeatDaily -> object binary-value,10209 | property present-value | type=binary-value | write=inactive
Observed values:
lockState: (unchanged)
Link confirmation time: 0.010s
Control completed in: 0.085s
脚本自动写入并回读验证。输出中的 YABE write guide 部分可直接用于 YABE 手动写入的参考。
YABE:
- 连接网关(IP
192.168.31.205,端口47808),展开设备 102 - 参照上方脚本输出中的 YABE write guide,找到对应对象
- 右键该对象 → Write Property,属性选
present-value,填入目标值后点击 Write
IoT Hub HTTP:
接口路径:POST http://192.168.31.205:8070/api/sendCommand
curl -s -X POST "http://192.168.31.205:8070/api/sendCommand" \
-H "Content-Type: application/json" \
-d '{"devEui":"ffffff1000048920","params":{"ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":3,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
{
"success": true,
"result": {
"devEui": "ffffff1000048920",
"status": "buffered"
}
}
ChirpStack REST API:
接口路径:POST http://192.168.31.205:8090/api/devices/ffffff1000048920/queue
curl -s -X POST 'http://192.168.31.205:8090/api/devices/ffffff1000048920/queue' \
-H 'accept: application/json' \
-H 'Grpc-Metadata-Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{"flushQueue":true,"queueItem":{"confirmed":false,"isPending":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":3,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}}'
{
"id": "4e8b2c17-5f93-4a01-b8d0-2c91ef345678"
}
格式化后的 JSON 内容:
{
"flushQueue": true,
"queueItem": {
"confirmed": false,
"isPending": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 3,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}
}
ChirpStack MQTT:
mosquitto_pub -h 192.168.31.205 -p 1883 -u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff1000048920/command/down" \
-m '{"flushQueue":true,"devEui":"ffffff1000048920","confirmed":false,"object":{"model":"DS-501","ds501ControlTarget":254,"ds501ControlState":false,"ds501ControlMode":3,"ds501DelaySeconds":0,"ds501ScheduleTimestamp":0,"ds501RepeatDaily":false}}'
格式化后的 JSON 内容:
{
"flushQueue": true,
"devEui": "ffffff1000048920",
"confirmed": false,
"object": {
"model": "DS-501",
"ds501ControlTarget": 254,
"ds501ControlState": false,
"ds501ControlMode": 3,
"ds501DelaySeconds": 0,
"ds501ScheduleTimestamp": 0,
"ds501RepeatDaily": false
}
}