node-red-contrib-wznhjc-collector
v1.1.0
Published
Node-RED nodes and library for NetDAU485 collector: edge parse, TCP handshake, archives_ack, report, auto-reconnect
Maintainers
Readme
node-red-contrib-wznhjc-collector
采集器客户端协议库(NetDAU485)+ Node-RED 节点:edge-parse、collector-client。
支持边缘测点解析、TCP 握手、archives_ack 全量建档、仅有效读数 report、自动重连。
环境要求
| 项 | 版本 | |----|------| | Node.js | >= 12(如 EG628 上 Node 12.22) | | Node-RED | >= 2.0 |
| 版本 | Node | 说明 |
|------|------|------|
| 1.1.0+ | >= 12 | 现场推荐;NR 专用加载链、5 个依赖、无写盘 |
| 1.0.5 | >= 12 | 去掉 config/log4js |
| 1.0.1 | >= 12(声明) | 依赖 config@4 仍会在 Node 12 安装失败 |
| 1.0.0 | >= 14 | 旧版 engines |
在 Node-RED 里安装(推荐)
- 菜单 设置 → 节点管理(Manage palette)→ 安装
- 搜索并安装:
node-red-contrib-wznhjc-collector - 重启或部署后,在 palette 分类 collector 下可见两个节点
首次公开发布前,也可在 ~/.node-red 执行:
npm install node-red-contrib-wznhjc-collector详细说明见 docs/NODE-RED.md。
发布维护见 docs/PUBLISH.md。
作为 npm 库使用
const {
validateCollectorOptions,
parseEdgeGetNodesPayload,
buildElectricMetersFromEdgeParsed,
connectCollectorUntilOnline,
startCollectorAutoReconnect,
} = require('node-red-contrib-wznhjc-collector');推荐流程
[edge get nodes] → [edge-parse] → [collector-client]- 建档:edge-parse 配置的全部 NodeID(无读数也建档)
- 上报:仅有有效数值的测点
开发 / 本地测试
npm install
npm test
npm run run:collector:local # 改 scripts/run-collector-local.js 里的 LOCAL_CONFIG
npm run simulate:edge
npm run pack:install # 模拟 tgz 安装到 examples/test-collector-consumer连接必填参数
| 参数 | 说明 |
|------|------|
| host | 采集器地址 |
| port | 端口 |
| buildName | 建筑名称 |
| buildNo | 建筑编号 / building_id |
| gatewayId | 网关号 |
可选:sn、mac、ip;edgeGetNodesParsed / edgeNodeIds 用于档案与 report。
常用默认值
| 项 | 默认 | |----|------| | 握手超时 | 120 s | | notify 心跳 | 30 s | | 首次 report | online 后 5 s | | 周期 report | 5 min | | 自动重连 | 3 min | | 协议日志保留 | 10 天 |
包内容
发布包含:src/、NetDAU_CLIENT/(含内置 collectorRuntimeConfig)、libs/log.js+util.js、nodes/。
不写磁盘日志、不依赖 npm config 包,适合无法 SSH 的嵌入式网关。
