1. Sensor Overview
Model catalog
Search for these models in ThinkLink by name or ID.
| Model type | Name | id_name | Platform model ID |
|---|---|---|---|
| RPC | [ZW SZWB1] switch | szwb1_22103_switch | 95906553915248645 |
| RPC | [SZWB1 GET] para | szwb1_get_22103 | 95843156968345605 |
| RPC | [SZWB1 SET] para | szwb1_set_para_22103 | 95842872615505925 |
| Template | ZW-SZWB1 | 95843645487321093 | |
| Thing Model | ZW-SZWB1 | szwb1_22103 | 95840195655503877 |
| Thing Model | [ZW-22103-SZWB1L资产] 区域聚合 | szwb1_asset_22103 | 119677174411063315 |
| Parameter Thing Model | [SZWB1-PARA] | szwb1_para_22103 | 95842342686167045 |
SZWB1L is a micro circuit breaker device from ZhuoWen Technology. It can be connected to the KC11 collector through the RS-485 interface, then converted by EdgeBus and reported to the ThinkLink platform through LoRaWAN.
This solution supports periodic reporting of measurement data, and also supports triggered reporting of alarm information and switch status.
2. Product Features
- Supports acquisition of multiple types of data, including micro circuit breaker operating status, electrical parameters, temperature, and energy.
- Supports acquisition of alarm and warning states, including undervoltage, overvoltage, overcurrent, overtemperature, leakage current, short circuit, load imbalance, and more.
- Supports switch status acquisition and remote open/close control.
- Upload period and acquisition period are configured separately, using APP parameter addresses 70 and 74 respectively.
- The uplink payload is relatively long. In actual projects, measurement points can be trimmed according to business needs.
3. Application Senario
Suitable for smart power distribution, distribution box monitoring, electrical safety management, building power distribution monitoring, campus power distribution monitoring, industrial power consumption monitoring, and similar scenarios.
4. Collector Information
4.1 Hardware Information
- Collector model: KC11
- Communication interface: RS-485
- Power supply: 220V / 12V
4.2 Wiring Information
Power and Communication Interface
- KC11 is connected to SZWB1L through RS-485.
- KC11 can be powered by 220V or 12V.
- SZWB1L is connected as a Modbus slave, with the default address set to
0x01in the EB configuration of this document. In actual deployment, the address can be modified through parameters.
Sensor Interface
- RS-485 A/B communication lines.
- If remote control and status acquisition are required on site, the circuit breaker itself must support the corresponding functions and be correctly wired.
5. Data Acquisition
In this solution, the following Modbus registers are read:
0x04: Read measurement data (full reporting)0x02: Read discrete input status (alarm/warning change reporting)0x01: Read / cooperate with coil status (switch-related status)
Among them:
- Measurement data is recommended to be acquired and reported at a relatively long interval.
- Alarm information and switch status are recommended to use a shorter interval or triggered reporting.
- The acquisition period must be shorter than the upload period.
5.1 Register Definitions
5.1.1 0x04 Read-Only Registers (Input Registers)
| Name | Address (Decimal) | Address (Hex) | Register Count | Unit | Field Name | Description |
|---|---|---|---|---|---|---|
| Panel DIP switch | 3000 | 0BB8 | 1 | - | DIP | 0 = Open/Locked, remote control invalid, leakage protection enabled; 1 = Closed/Unlocked, remote control valid, leakage protection disabled |
| Single-phase two-wire current | 3003 | 0BBB | 2 | 0.001A | I | 32-bit, high word first |
| Single-phase voltage | 3005 | 0BBD | 1 | 0.01V | U | |
| Single-phase two-wire active power / total three-phase active power | 3006 | 0BBE | 2 | 0.001mW / 0.001W | P | 32-bit, high word first |
| Single-phase two-wire reactive power / total three-phase reactive power | 3008 | 0BC0 | 2 | 0.001mVar / 0.001Var | Q | |
| Single-phase two-wire apparent power / total three-phase apparent power | 3010 | 0BC2 | 2 | 0.001mVA / 0.001VA | S | |
| Single-phase active energy / total three-phase apparent energy | 3012 | 0BC4 | 4 | Wh | E | 64-bit, high word first |
| Single-phase L-line temperature | 3016 | 0BC8 | 1 | 0.1℃ | Ts | |
| Residual current | 3017 | 0BC9 | 1 | mA | Ires | Unsigned |
| Phase A current | 3019 | 0BCB | 2 | 0.001mA | Ia | 32-bit, high word first |
| Phase B current | 3021 | 0BCD | 2 | 0.001mA | Ib | |
| Phase C current | 3023 | 0BCF | 2 | 0.001mA | Ic | |
| Neutral current | 3025 | 0BD1 | 2 | 0.001mA | In | |
| Rated current | 3027 | 0BD3 | 1 | A | Ir | |
| Phase A voltage | 3029 | 0BD5 | 1 | 0.01V | Ua | |
| Phase B voltage | 3030 | 0BD6 | 1 | 0.01V | Ub | |
| Phase C voltage | 3031 | 0BD7 | 1 | 0.01V | Uc | |
| Active power A | 3033 | 0BD9 | 2 | 0.001mW / 0.001W | Pa | 32-bit |
| Active power B | 3035 | 0BDB | 2 | 0.001mW / 0.001W | Pb | |
| Active power C | 3037 | 0BDD | 2 | 0.001mW / 0.001W | Pc | |
| Reactive power A | 3039 | 0BDF | 2 | 0.001mVar / 0.001Var | Qa | |
| Reactive power B | 3041 | 0BE1 | 2 | 0.001mVar / 0.001Var | Qb | |
| Reactive power C | 3043 | 0BE3 | 2 | 0.001mVar / 0.001Var | Qc | |
| Apparent power A | 3045 | 0BE5 | 2 | 0.001mVA / 0.001VA | Sa | |
| Apparent power B | 3047 | 0BE7 | 2 | 0.001mVA / 0.001VA | Sb | |
| Apparent power C | 3049 | 0BE9 | 2 | 0.001mVA / 0.001VA | Sc | |
| Apparent energy A | 3051 | 0BEB | 4 | mVAh | Esa | 64-bit |
| Apparent energy B | 3055 | 0BEF | 4 | mVAh | Esb | |
| Apparent energy C | 3059 | 0BF3 | 4 | mVAh | Esc | |
| Total three-phase apparent energy | 3063 | 0BF7 | 4 | mVAh | Es | |
| Phase A line temperature | 3067 | 0BFB | 1 | 0.1℃ | Ta | |
| Phase B line temperature | 3068 | 0BFC | 1 | 0.1℃ | Tb | |
| Phase C line temperature | 3069 | 0BFD | 1 | 0.1℃ | Tc | |
| Neutral line temperature | 3070 | 0BFE | 1 | 0.1℃ | Tn | |
| Single-phase apparent energy / total three-phase active energy | 3075 | 0C03 | 4 | mWh | Ep | 64-bit |
| Phase A active energy | 3079 | 0C07 | 4 | mWh | Epa | |
| Phase B active energy | 3083 | 0C0B | 4 | mWh | Epb | |
| Phase C active energy | 3087 | 0C0F | 4 | mWh | Epc | |
| Single-phase reactive energy / total three-phase reactive energy | 3091 | 0C13 | 4 | mVarh | Eq | |
| Phase A reactive energy | 3095 | 0C17 | 4 | mVarh | Eqa | |
| Phase B reactive energy | 3099 | 0C1B | 4 | mVarh | Eqb | |
| Phase C reactive energy | 3103 | 0C1F | 4 | mVarh | Eqc | |
| Grid frequency | 3107 | 0C23 | 1 | 0.1Hz | Freq |
5.1.2 0x02 Status Bits (Discrete Inputs)
Read range: 2000 ~ 2054
In EB, this range is read as a whole segment and converted into an alarm bitmap.
5.1.3 0x01 / 0x05 Control Coils
| Name | Address | Field Name | Description |
|---|---|---|---|
| Open/Close | 0 | switch | Write 1 to trigger one close action; write 0 to trigger one open action |
| Leakage test | 1 | test | Write 1 to trigger one test action |
| Energy clear | 2 | clear | Write 1 to trigger one reset action |
5.1.4 0x03 / 0x06 Setting Registers (Holding Registers)
| Name | Address | Field Name | Description |
|---|---|---|---|
| MODBUS address | 4053 | address | Factory default is 1 |
| Baud rate | 4054 | baud | 0 = 9600, 1 = 19200, 2 = 38400; recommended to use 0 |
| Parity | 4055 | parity | 0 = NONE, 1 = ODD, 2 = EVEN |
| Stop bits | 4056 | stop | 0 = 1, 1 = 1.2, 2 = 2 |
5.2 Status Bit Definitions
| Address | Name | Field Name |
|---|---|---|
| 2000 | Single-phase undervoltage (alarm) | UV_S_ALM |
| 2001 | Single-phase undervoltage (warning) | UV_S_WRN |
| 2002 | Single-phase overvoltage (alarm) | OV_S_ALM |
| 2003 | Single-phase overvoltage (warning) | OV_S_WRN |
| 2004 | Single-phase overcurrent (alarm) | OC_S_ALM |
| 2005 | Single-phase overcurrent (warning) | OC_S_WRN |
| 2006 | Single-phase line temperature (alarm) | OT_S_ALM |
| 2007 | Single-phase line temperature (warning) | OT_S_WRN |
| 2008 | Leakage current (alarm) | RCD_ALM |
| 2009 | Leakage current (warning) | RCD_WRN |
| 2012 | Overpower alarm (alarm) | OP_ALM |
| 2013 | Overpower alarm (warning) | OP_WRN |
| 2014 | Short circuit alarm (alarm) | SC_ALM |
| 2015 | Short circuit alarm (warning) | SC_WRN |
| 2016 | Ground fault alarm | GND_ALM |
| 2020 | Phase sequence error alarm | PH_SEQ_ERR |
| 2021 | Undervoltage (alarm) A | UV_A_ALM |
| 2022 | Undervoltage (warning) A | UV_A_WRN |
| 2023 | Undervoltage (alarm) B | UV_B_ALM |
| 2024 | Undervoltage (warning) B | UV_B_WRN |
| 2025 | Undervoltage (alarm) C | UV_C_ALM |
| 2026 | Undervoltage (warning) C | UV_C_WRN |
| 2027 | Overvoltage (alarm) A | OV_A_ALM |
| 2028 | Overvoltage (warning) A | OV_A_WRN |
| 2029 | Overvoltage (alarm) B | OV_B_ALM |
| 2030 | Overvoltage (warning) B | OV_B_WRN |
| 2031 | Overvoltage (alarm) C | OV_C_ALM |
| 2032 | Overvoltage (warning) C | OV_C_WRN |
| 2033 | Overcurrent (alarm) A | OC_A_ALM |
| 2034 | Overcurrent (warning) A | OC_A_WRN |
| 2035 | Overcurrent (alarm) B | OC_B_ALM |
| 2036 | Overcurrent (warning) B | OC_B_WRN |
| 2037 | Overcurrent (alarm) C | OC_C_ALM |
| 2038 | Overcurrent (warning) C | OC_C_WRN |
| 2039 | Temperature (alarm) A | OT_A_ALM |
| 2040 | Temperature (warning) A | OT_A_WRN |
| 2041 | Temperature (alarm) B | OT_B_ALM |
| 2042 | Temperature (warning) B | OT_B_WRN |
| 2043 | Temperature (alarm) C | OT_C_ALM |
| 2044 | Temperature (warning) C | OT_C_WRN |
| 2045 | Temperature (alarm) N | OT_N_ALM |
| 2046 | Temperature (warning) N | OT_N_WRN |
| 2047 | Phase loss (alarm) A | PH_LOSS_A |
| 2048 | Phase A leakage identification | RCD_A_FLG |
| 2049 | Phase loss (alarm) B | PH_LOSS_B |
| 2050 | Phase B leakage identification | RCD_B_FLG |
| 2051 | Phase loss (alarm) C | PH_LOSS_C |
| 2052 | Phase C leakage identification | RCD_C_FLG |
| 2053 | Load imbalance (alarm) | UNB_ALM |
| 2054 | Load imbalance (warning) | UNB_WRN |
| 2064 | Maintenance mode | MAINT_MODE |
| 2073 | Harmonic alarm | HARM_ALM |
| 2074 | Special harmonic alarm | SP_HARM_ALM |
| 2075 | Neutral current warning | IN_N_WRN |
| 2076 | Neutral current alarm | IN_N_ALM |
| 2077 | Neutral voltage | UN |
6. EdgeBus Model
6.1 EB Configuration Parameters
- Collector: KC21
- Serial parameters: 9600 / 8N1 / no parity
- Battery: false
- ConfirmDuty: 60
- BzType: 22103
- BzVersion: 13
- LoRaWAN uplink port: 22
- Data type:
0x86 - Version:
0x03 - Upload period parameter address: 70
- Acquisition period parameter address: 74
- Modbus address parameter mapping: 150
6.2 EB Code
import { Buffer } from "buffer";
import { buildOtaFile } from "@EBSDK/run";
import {
ActionAfertExpr, CalcData,
CrcMode,
CvtRule,
EBBuffer,
EBModel,
ExprCondition,
LoraUpEvent,
QueryEvent, SetUpCovDataType,QuItemBase,
UserConfUPItem, EventInfoItem, QuItemModBus, UserConfQueryItem, EventConfig, Utils
} from "@EBSDK/EBCompiler/all_variable";
import { CheckbitEnum, getOtaConfig, HwTypeEnum, UpgrdTypeEnum } from "@EBSDK/otaConfig";
////////////////////////////////////////////////////////////////////////////////////////
//ZHUOWEN mcb SZWB1L
const eventInfo:UserConfUPItem[]=[
{
name:"mcb",dataType:"0x86", port:22, version:"0x03",upPeriodIndex:70,//upPeriod:"300s",
quInfo:[
{
protocol:"modbus",addr:"0x01",code:"0x04", periodIndex:70,//period:"300s",
indexAPP:150, indexCMD:0, copySize:1,isLast:false,
listVal:[
{ start: "3000", end: "3000"},
{ start: "3003", end: "3017"},
{ start: "3019", end: "3027"},
{ start: "3029", end: "3031"},
{ start: "3033", end: "3070"},
{ start: "3075", end: "3107"},
]
},
{
protocol:"modbus", code:"0x02",periodIndex:74, //period:"30s",
indexAPP:150, indexCMD:0, copySize:1,isLast:false,
listVal:[
{ start: "0x07D0", end: "0x0806",covType:"HEX"}
]
},
{
protocol:"modbus", code:"0x01",periodIndex:74, //period:"30s",
indexAPP:150, indexCMD:0, copySize:1,isLast:false,
listVal:[
{ start: "0", end: "0",covType:"HEX"}
]
}
]
}
]
let otaConfig = getOtaConfig({
SwVersion:31,
BaudRate: 9600,
StopBits: 1,
DataBits: 8,
Checkbit: CheckbitEnum.NONE,
Battery: false,
ConfirmDuty: 60,
BzType: 22103,
BzVersion: 13
})
const MODBUS_TT = (ebModel: EBModel) => {
for (let i=0; i<eventInfo.length; i++){
let event=new EventInfoItem(eventInfo[i]);
event.upEventSetup()
event.eventInstall()
}
return JSON.stringify(ebModel, null, 2)
}
buildOtaFile(import.meta.url, otaConfig, MODBUS_TT)6.3 Notes
Current EB logic:
- Use
0x04to read full measurement data as the main uplink content. - Use
0x02to read alarm/warning status bits as the trigger basis for change reporting. - Use
0x01to read switch status. - Upload period and acquisition period are separated:
70is used for upload period,74is used for acquisition period. indexAPP:150corresponds to Modbus address parameter mapping, making it convenient to modify the slave address through parameters.- Since SZWB1L has many measurement points, the full uplink payload is long. In projects, it is recommended to trim points based on application scenarios to avoid wasting airtime resources.
- Alarm information is eventually encoded into
warnCode, and then further parsed into readablewarningtext in the Thing Model script. - Transparent transmission port
51is used together with remote switch control result feedback, converting transparent data intoswitchstatus.
7. Thing Model
7.1 Basic Thing Model Information
Data Thing Model
- Name:
[ZW-SZWB1] - id Name:
zw_szwb1_22103 - Uplink port: 22
- Tags:
0x86 0x03
Parameter Thing Model
- Name:
[SZWB1-PARA] - id Name:
szwb1_para_22103
7.2 Uplink Frame Structure
- port: 22
- dataLen: -1
- rssi: true
- battery: true
- tagList:
- index: 0, tag:
0x86 - index: 1, tag:
0x03
- index: 0, tag:
Main fields include:
- DIP
- I / U / P / Q / S / E
- Ts / Ires
- Ia / Ib / Ic / In / Ir
- Ua / Ub / Uc
- Pa / Pb / Pc
- Qa / Qb / Qc
- Sa / Sb / Sc
- Esa / Esb / Esc / Es
- Ta / Tb / Tc / Tn
- Ep / Epa / Epb / Epc
- Eq / Eqa / Eqb / Eqc
- Freq
- warnCode
- switch
- Derived field: warning
7.3 Thing Model Script
let frameInfo={
port:22, dataLen:-1,rssi:true,battery:true,
tagList:[{ index:0, tag:0x86}, { index:1, tag:0x03}]
}
const ALARM_MAP = {
// 单相告警
2000: "单相欠压(报警)",
2001: "单相欠压(预警)",
2002: "单相过压(报警)",
2003: "单相过压(预警)",
2004: "单相过流(报警)",
2005: "单相过流(预警)",
2006: "单相线温(报警)",
2007: "单相线温(预警)",
2008: "漏电(报警)",
2009: "漏电(预警)",
// 功率和短路告警
2012: "过功率报警(报警)",
2013: "过功率报警(预警)",
2014: "短路报警(报警)",
2015: "短路报警(预警)",
2016: "接地报警",
// 相序和分相告警
2020: "相序错误报警",
2021: "欠压(报警)A",
2022: "欠压(预警)A",
2023: "欠压(报警)B",
2024: "欠压(预警)B",
2025: "欠压(报警)C",
2026: "欠压(预警)C",
2027: "过压(报警)A",
2028: "过压(预警)A",
2029: "过压(报警)B",
2030: "过压(预警)B",
2031: "过压(报警)C",
2032: "过压(预警)C",
2033: "过流(报警)A",
2034: "过流(预警)A",
2035: "过流(报警)B",
2036: "过流(预警)B",
2037: "过流(报警)C",
2038: "过流(预警)C",
2039: "温度(报警)A",
2040: "温度(预警)A",
2041: "温度(报警)B",
2042: "温度(预警)B",
2043: "温度(报警)C",
2044: "温度(预警)C",
2045: "温度(报警)N",
2046: "温度(预警)N",
2047: "缺相(报警)A",
2048: "A相漏电识别",
2049: "缺相(报警)B",
2050: "B相漏电识别",
2051: "缺相(报警)C",
2052: "C相漏电识别",
2053: "负载不均衡(报警)",
2054: "负载不均衡(预警)"
};
let appInfo = [
{ name: "面板拨码开关", field_name: "DIP", unit: "", index: 6, type: "uint8", coefficient: 1, options: {0: "断开/锁定, 远控无效, 漏保有效", 1: "闭合/解锁, 远控有效, 漏保无效"} },
{ name: "单相两线电流", field_name: "I", unit: "A", index: 8, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "单相电压", field_name: "U", unit: "V", index: 12, type: "int16be", coefficient: 0.01, decimal: 2 },
{ name: "单相两线有功功率/三相合有功功率", field_name: "P", unit: "W", index: 14, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "单相两线无功功率/三相合无功功率", field_name: "Q", unit: "Var", index: 18, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "单相两线视在功率/三相合视在功率", field_name: "S", unit: "VA", index: 22, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "单相有功电能/三相合视在电能", field_name: "E", unit: "kWh", index: 26, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "单相L线温", field_name: "Ts", unit: "℃", index: 34, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "剩余电流", field_name: "Ires", unit: "mA", index: 36, type: "uint16be", coefficient: 0.001, decimal: 3 },
{ name: "A相电流", field_name: "Ia", unit: "A", index: 38, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "B相电流", field_name: "Ib", unit: "A", index: 42, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "C相电流", field_name: "Ic", unit: "A", index: 46, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "N相电流", field_name: "In", unit: "A", index: 50, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "额定电流", field_name: "Ir", unit: "A", index: 54, type: "int16be", coefficient: 1, decimal: 0 },
{ name: "A相电压", field_name: "Ua", unit: "V", index: 56, type: "int16be", coefficient: 0.01, decimal: 2 },
{ name: "B相电压", field_name: "Ub", unit: "V", index: 58, type: "int16be", coefficient: 0.01, decimal: 2 },
{ name: "C相电压", field_name: "Uc", unit: "V", index: 60, type: "int16be", coefficient: 0.01, decimal: 2 },
{ name: "有功功率A", field_name: "Pa", unit: "W", index: 62, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "有功功率B", field_name: "Pb", unit: "W", index: 66, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "有功功率C", field_name: "Pc", unit: "W", index: 70, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "无功功率A", field_name: "Qa", unit: "Var", index: 74, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "无功功率B", field_name: "Qb", unit: "Var", index: 78, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "无功功率C", field_name: "Qc", unit: "Var", index: 82, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "视在功率A", field_name: "Sa", unit: "VA", index: 86, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "视在功率B", field_name: "Sb", unit: "VA", index: 90, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "视在功率C", field_name: "Sc", unit: "VA", index: 94, type: "int32be", coefficient: 0.001, decimal: 3 },
{ name: "视在能量A", field_name: "Esa", unit: "VAh", index: 98, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "视在能量B", field_name: "Esb", unit: "VAh", index: 106, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "视在能量C", field_name: "Esc", unit: "VAh", index: 114, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "三相合视在能量", field_name: "Es", unit: "VAh", index: 122, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "A线温度", field_name: "Ta", unit: "℃", index: 130, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "B线温度", field_name: "Tb", unit: "℃", index: 132, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "C线温度", field_name: "Tc", unit: "℃", index: 134, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "N线温度", field_name: "Tn", unit: "℃", index: 136, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "单相视在能量/三相合有功电能", field_name: "Ep", unit: "kWh", index: 138, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "A相有功能量", field_name: "Epa", unit: "kWh", index: 146, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "B相有功能量", field_name: "Epb", unit: "kWh", index: 154, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "C相有功能量", field_name: "Epc", unit: "kWh", index: 162, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "单相无功能量/三相合无功电能", field_name: "Eq", unit: "kVarh", index: 170, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "A相无功能量", field_name: "Eqa", unit: "kVarh", index: 178, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "B相无功能量", field_name: "Eqb", unit: "kVarh", index: 186, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "C相无功能量", field_name: "Eqc", unit: "kVarh", index: 194, type: "int64be", coefficient: 1, decimal: 0 },
{ name: "电网频率", field_name: "Freq", unit: "Hz", index: 202, type: "int16be", coefficient: 0.1, decimal: 1 },
{ name: "告警", field_name: "warnCode", unit: "", index: 204, type: "hexbe7" },
{ name: "开关状态", field_name: "switch", unit: "", index: 211, type: "bitle0-0" },
]
let transFrameInfo={ port:51}
let transAppInfo = [
{name: "code", field_name: "code", index: 1, type: "uint8"}
]
let tdata=null
if( port===51) {
let rpcSwitch=device.server_attrs.szwb1_22103_switch
if (rpcSwitch?.ms==undefined) return null
let diff=Date.now()-rpcSwitch.ms
if (diff>5000) return null
let transParser=new PayloadParser({
device:device, msg:msg, frameInfo:transFrameInfo, appInfo:transAppInfo}
)
let transData=transParser.telemetry()
if (transData==undefined) return null
tdata={}
if (transData.code===0x05) {
if (rpcSwitch?.params?.switch===true) {tdata.switch=1
}else { tdata.switch=0 }
}
}else {
let payParser=new PayloadParser({
device:device, msg:msg, frameInfo:frameInfo, appInfo:appInfo}
)
tdata= payParser.telemetry();
if (tdata.warnCode!=undefined) {
let alarmBuffer=new BufferTKL(Buffer.from(tdata.warnCode,"hex"))
let warnInfo="warning: "
let alarmcount=0
for(let i=0;i<55;i++) {
let content=ALARM_MAP[2000 + i]
if (content==undefined) continue
let val =alarmBuffer.read(0,"bitLE"+i.toString(10)+"-"+i.toString(10))
if (val===0) continue
if (alarmcount!==0) {warnInfo+=","}
warnInfo+=content
alarmcount++
}
if (alarmcount===0) { warnInfo="normal"}
tdata.warning=warnInfo;
}
}
return {
telemetry_data: tdata,
server_attrs: null,
shared_attrs: null,
};8. Third-Party Platform Data Subscription
8.1 MQTT Topic
/v32/{Organization Account}/tkl/up/telemetry/{eui}8.2 Example Reported Data
{
"eui": "6353012af10a9331",
"active_time": "2026-02-05T08:35:48.000Z",
"thingModelId": "zw_szwb1_22103",
"thingModelIdName": "ZW-SZWB1",
"telemetry_data": {
"DIP": 1,
"I": 12.345,
"U": 220.15,
"P": 2500.123,
"Q": 120.456,
"S": 2520.789,
"Ts": 36.5,
"Ires": 0.012,
"Ia": 12.111,
"Ib": 11.982,
"Ic": 12.204,
"Ua": 220.13,
"Ub": 219.98,
"Uc": 220.42,
"Freq": 50.0,
"warnCode": "00000000000000",
"warning": "normal",
"switch": 1
}
}9. RPC
9.1 RPC Names
[SZWB1 SET] para- id Name:
szwb1_set_para_22103
- id Name:
[SZWB1 GET] para- id Name:
szwb1_get_22103
- id Name:
9.2 Parameter Definitions
| Parameter Address | Parameter Name | Field Name | Type | Description |
|---|---|---|---|---|
| app_70 | period_up | period_up | uint32le | Upload period, unit: seconds |
| app_74 | period_read | period_read | uint32le | Acquisition period, unit: seconds |
| app_150 | addr_modbus | addr_modbus | uint8 | Modbus slave address |
9.3 RPC Code
Set Parameters
let classMode = (device && device.shared_attrs && device.shared_attrs.class_mode) || "ClassA";
const rpcName="szwb1_set_para_22103"
let paraDef = {
app_70:{name: "period_up", field_name: "period_up", unit:"S", type: "uint32le"},
app_74:{name: "period_read", field_name: "period_read", unit:"S", type: "uint32le"},
app_150:{name: "addr_modbus", field_name: "addr_modbus", unit:"", type: "uint8"}
}
let frames=RPCHelper.buildFrame({
paraDef:paraDef,
params:params});
let redoBuffer=RPCHelper.redo()
let dnBuffer=Buffer.alloc(frames.writeBuffer.length+frames.readBuffer.length);
frames.writeBuffer.copy(dnBuffer,0)
frames.readBuffer.copy(dnBuffer,frames.writeBuffer.length)
logger.info("set para")
let msgQue=Utils.makeParaSetMSG({
device:device,
classMode:classMode,
rpcName:rpcName,
params:params,
paraDownBuffer:dnBuffer,
extraAppBuffer:redoBuffer
})
if (msgQue.length==0) return null
return msgQueRead Parameters
let paraDef = {
app_70:{name: "period_up", field_name: "period_up", unit:"S", type: "uint32le"},
app_74:{name: "period_read", field_name: "period_read", unit:"S", type: "uint32le"},
app_150:{name: "addr_modbus", field_name: "addr_modbus", unit:"", type: "uint8"}
}
let frames=RPCHelper.buildFrame({
paraDef:paraDef,
params:params});
let msg=RPCHelper.makeMSG({
msgType:Utils.msgType.paras,
device:device,
dnBuffer:frames.readBuffer,
sleepTime:0,
})
return [msg]10. Template Selection
In the ThinkLink platform, search for the template:
SZWB1- 22103