Node.js 8 DLT645 Smart Meter WebSocket Protocol Driver for Alibaba Cloud Edge Computing Gateway

Node.js 8 DLT645 Smart Meter WebSocket Protocol Driver for Alibaba Cloud Edge Computing Gateway
Node.js 8 DLT645 Smart Meter WebSocket Protocol Driver for Alibaba Cloud Edge Computing Gateway
Project repository: here. This project is an Alibaba Cloud IoT Edge gateway driver for Chinese DLT645 smart meters. It currently supports only the Alibaba Cloud IoT Platform and complies with the Alibaba Cloud Edge Gateway WebSocket protocol. It can connect through a serial port, collect data from multiple DLT meters (multiple meters on the same serial port are supported; multiple serial ports are not yet supported), and convert the data into the Alibaba Cloud Edge Gateway WebSocket protocol. Before use, make sure the DLT meters are properly connected to the serial port. (A local debugging tool is under development.)
Alibaba Cloud IoT Platform Guide
For the detailed WebSocket protocol of the edge computing gateway, see the Alibaba Cloud official SDK: linkedge-thing-access-websocket_client_sdk.
Currently, only the onlineDevice, reportProperty, and getProperty methods are supported. More methods are planned.
Before use, you need to create a product and device on the Alibaba Cloud IoT Platform. For the product reference model, see the model.json file in the project.
You also need to install the Alibaba Cloud Edge Computing Gateway program and deploy the WebSocket driver. The driver has currently been tested only on Ubuntu 18.04.
Usage Guide
- Set the serial port and corresponding DLT meter parameters in
config.json. If the gateway environment is Linux, theportNamefield only needsttyS1orttyUSB1, and the driver will automatically resolve it to/dev/ttyS1. On Windows, useCOM1,COM2, etc. directly (not yet tested). - If you have changed the default Alibaba Cloud Edge Gateway driver settings (such as IP address or port), update the corresponding values in
server.json. - If you want to add more DLT645 meter parameters supported by the protocol, update
model.jsonand modify thedltparserparameters to ensure variables are parsed correctly. Block data read/write is not supported yet. - Download and run the
install.shscript for automatic installation, or copy its contents locally and create your own installation script. If you want to install Node globally (not recommended), you can comment out the nvm installation section in the script and install Node globally instead. Note that thecnpmtool is intended only for users in mainland China. Outside China, you can comment out thecnpminstallation section and usenpmdirectly.
Development
Built with Node.js v8.16.2. The project mainly depends on the serialport and websocket packages, and uses log4js for logging. Development dependencies include sinon, mocha, and chai for testing, and jsdoc for generating documentation.
Pull requests are welcome to improve the project and add more features.
The development documentation contains more detailed information.
TODO
- Support for more DLT645 property parameters
- Support for block reading
- Support for writing parameters and modifying variables
- Support for automatic event reporting in Alibaba Cloud Edge Gateway
- Support for Alibaba Cloud Edge Gateway services
- Virtual serial port test program
- WebSocket protocol test program
- Local DLT driver debugging assistant
- Local web-based service interface for driver debugging and monitoring


