DL/T645 Driver
dc3-driver-dlt645 reads electricity meters speaking the Chinese DL/T645-2007 protocol over RS485. It builds the meter request frame (68H ... 16H), verifies the response checksum, and parses the data identifier (DI0-DI3) value; writes use the DL/T645 operator codes for meter programming.
Protocol background
DL/T645-2007 is the Chinese national standard for multi-function electricity meters. Frames are delimited by 68H, carry a 6-byte BCD meter address, and end with a cumulative checksum. Each measured quantity (voltage, current, power, energy) is addressed by a 4-byte data identifier DI0-DI3.
- Driver name / code:
DL/T645 Driver/Dlt645Driver - Type:
DRIVER_CLIENT (opens the serial port and polls the meter) - Underlying library: jSerialComm (self-built DL/T645-2007 frame encode/decode)
Attribute configuration
Driver attributes (device-level driver-attribute)
| Attribute | code | Type | Default | Description |
|---|---|---|---|---|
| Serial Port | port | STRING | /dev/ttyUSB0 | Serial port device path |
| Baud Rate | baudRate | INT | 2400 | Baud rate (DL/T645 default 2400) |
| Data Bits | dataBits | INT | 8 | Data bits |
| Stop Bits | stopBits | INT | 1 | Stop bits |
| Parity | parity | INT | 2 | Parity (2=Even, DL/T645 default) |
| Timeout | timeout | INT | 1000 | Read timeout in milliseconds |
| Meter Address | meterAddress | STRING | 000000000000 | 12-digit BCD meter address |
| Password | password | STRING | 00000000 | Meter password for writes |
| Operator Code | operatorCode | STRING | 00000000 | Operator code for writes |
Point attributes (point-attribute)
| Attribute | code | Type | Default | Description |
|---|---|---|---|---|
| Data Identifier | di | STRING | (empty) | 4-byte data identifier as 8 hex chars (DI0-DI3) |
| Data Format | dataFormat | STRING | FLOAT | Data format: FLOAT, HEX, ASCII, BINARY |
Collection and health
- Collection cycle: default cron
0/30 * * * * ?(one polling round over all points every 30 seconds). - Health/online: device health defaults to cron
0/15 * * * * ?, lease timeout45 seconds.
Capability matrix
| Capability | Supported | Notes |
|---|---|---|
| Read | ✓ | |
| Write | ✓ | |
| Subscribe | — |
Implementation status: available ::
The frame encoder/decoder (Dlt645Frame) and serial connection (Dlt645SerialPortConnection) are fully implemented, including address BCD encoding, checksum verification, and read/write frame building.
Minimal onboarding example
- Create a Device using
DL/T645 Driver, setport=/dev/ttyUSB0,baudRate=2400,parity=2,meterAddress=<your 12-digit address>. - Add a Point (
READ_ONLY) withdi=02010100(phase A voltage) anddataFormat=FLOAT. - Start the driver; within 30 seconds the value appears in PointValue.
Further reading
- Driver overview — entry point to all protocol drivers and selection
- Driver capability matrix — quick reference of read/write/subscribe capabilities
- Device onboarding — a complete onboarding walkthrough