Skip to content

Commit 3889949

Browse files
authored
Merge pull request #521 from hxy7yx/2.10
[v2.10]update mqtt configuration
2 parents ac5b273 + 2e53b2a commit 3889949

File tree

4 files changed

+91
-7
lines changed

4 files changed

+91
-7
lines changed

en_US/configuration/north-apps/mqtt/api.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Tag value is returned only when the tag is read successfully. If something goes
135135
You could write a tag by sending requests in JSON to the MQTT topic designated by the **Write Request Topic** parameter.
136136

137137
::: tip
138-
Before Neuron version 2.4.5, the write request topic was hard-coded to **/neuron/{node_name}/write/req**.
138+
Before Neuron version 2.4.5, the write request topic was hard-coded to **/neuron/{random_str}/write/req**.
139139
:::
140140

141141
#### Body
@@ -197,7 +197,7 @@ Below is an example write request:
197197
Write response will be published to the MQTT topic designated by the **Write Response Topic** parameter.
198198

199199
::: tip
200-
Before Neuron version 2.4.5, the write response topic was hard-coded to **/neuron/{node_name}/write/resp**.
200+
Before Neuron version 2.4.5, the write response topic was hard-coded to **/neuron/{random_str}//write/resp**.
201201
:::
202202

203203
#### Body
@@ -214,3 +214,41 @@ Below is an example of write response:
214214
"error": 0
215215
}
216216
```
217+
218+
## Driver Status Report
219+
220+
Reports status of all the southbound nodes to the specified topic.
221+
222+
### Status Report Topic
223+
224+
The status report topic is specified in the northbound node configuration. Its default value is **/neuron/{random_str}/state/update**.
225+
226+
### Status Report Interval
227+
228+
The status report interval is specified in the northbound node configuration, indicating the number of seconds between each message. The default value is 1, with an allowed range of 1-3600.
229+
230+
### Reporting Message Format
231+
232+
The reported data consists of the following fields:
233+
* `timestamp`: The UNIX timestamp when the data was collected.
234+
* `states`: An array of node status information.
235+
236+
Below is an example of a driver status reporting message.
237+
238+
```json
239+
{
240+
"timestamp": 1658134132237,
241+
"states": [
242+
{
243+
"node": "modbus-tcp",
244+
"link": 2,
245+
"running": 3
246+
},
247+
{
248+
"node": "modbus-rtu",
249+
"link": 2,
250+
"running": 3
251+
}
252+
]
253+
}
254+
```

en_US/configuration/north-apps/mqtt/overview.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ See the table below for the configuration parameters.
2323

2424
| Parameter | Description |
2525
| ------------------------------- | ------------------------------------------------------------ |
26+
| **MQTT Version** | The version of MQTT protocol. The default is v3.1.1. |
2627
| **Client ID** | MQTT client id for communication, a required field. |
2728
| **QoS Level** | MQTT QoS level for message delivery, optional, default QoS 0. (since 2.4.0) |
2829
| **Upload Format** | JSON format of reported data, a required field: <br /><br /> - *values-format*, data are split into `values` and `errors` sub-objects. <br />- *tags-format*, tag data are put in a single array. <br /><br />For data communication format, see [Upstream/Downstream Data Format](./api.md#write-tag) |
29-
| **Write Request Topic** | MQTT topic to which the plugin subscribes for write requests. For data communication format, see [Upstream/Downstream Data Format](./api.md#write-tag) (since 2.4.5) |
30+
| **Write Request Topic** | MQTT topic to which the plugin subscribes for write requests. For data communication format, see [Upstream/Downstream Data Format](./api.md#write-tag) (since 2.4.5). If tracing is enabled, configure the user properties `traceparent` and `tracestate` according to the W3C standard. |
3031
| **Write Response Topic** | MQTT topic to which the plugin sends write responses. (since 2.4.5) |
32+
| **Driver Status Report** | Reports status of all the southbound nodes to the specified topic. |
33+
| **Status Report Topic** | The topic for status reporting. |
34+
| **Status Report Interval** | The time interval for reporting the status of the southbound node, in seconds. The range is 1-3600, with a default of 1. |
3135
| **Offline Data Caching** | Offline data caching switch. Cache MQTT messages when offline, and sync cached messages when back online. (Since 2.4.3) |
3236
| **Cache Memory Size** | In-memory cache limit (MB) in case of communication failure, a required field. Range in [0, 1024]. Should not be larger than *Cache Disk Size*. For details about the cache feature, see [Offline Data Caching](#offline-data-caching) |
3337
| **Cache Disk Size** | In-disk cache limit (MB) in case of communication failure, a required field. Range in [0, 10240]. If nonzero, *cache-mem-size* should also be nonzero. |

zh_CN/configuration/north-apps/mqtt/api.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Neuron MQTT 插件将采集到的数据以 JSON 形式发布到指定的主题
135135

136136
### 请求
137137

138-
通过发送 JSON 形式的请求到**写请求主题**参数指定的 MQTT 主题,您可以写一个点位数据。可在 MQTT 参数配置中配置写请求的主题,默认为为 **/neuron/{node_name}/write/req**
138+
通过发送 JSON 形式的请求到**写请求主题**参数指定的 MQTT 主题,您可以写一个点位数据。可在 MQTT 参数配置中配置写请求的主题,默认为为 **/neuron/{random_str}/write/req**
139139

140140

141141
#### 请求体
@@ -191,7 +191,7 @@ Neuron 提供了对多点位写入的支持。要在一次请求中可以写入
191191

192192
### 响应
193193

194-
写响应会发布到**写响应主题**参数指定的 MQTT 主题。默认**写响应主题**参数为 **/neuron/{node_name}/write/resp**
194+
写响应会发布到**写响应主题**参数指定的 MQTT 主题。默认**写响应主题**参数为 **/neuron/{random_str}//write/resp**
195195

196196
#### 响应体
197197

@@ -206,3 +206,41 @@ Neuron 提供了对多点位写入的支持。要在一次请求中可以写入
206206
"error": 0
207207
}
208208
```
209+
210+
## 驱动状态上报
211+
212+
上报所有南向驱动状态到指定的 MQTT 主题。
213+
214+
### 状态上报主题
215+
216+
上报主题在北向节点配置中指定,其默认值为 **/neuron/{random_str}/state/update**
217+
218+
### 状态上报间隔
219+
220+
状态上报间隔在北向节点配置中指定,指每条消息之间间隔的秒数,其默认值为 1,允许的范围为 1-3600。
221+
222+
### 上报消息格式
223+
224+
上报的数据由以下字段构成:
225+
* `timestamp` : 数据采集时的 UNIX 时间戳。
226+
* `states` : 节点状态信息的数组。
227+
228+
以下是一个驱动状态上报消息样例。
229+
230+
```json
231+
{
232+
"timestamp": 1658134132237,
233+
"states": [
234+
{
235+
"node": "modbus-tcp",
236+
"link": 2,
237+
"running": 3
238+
},
239+
{
240+
"node": "modbus-rtu",
241+
"link": 2,
242+
"running": 3
243+
}
244+
]
245+
}
246+
```

zh_CN/configuration/north-apps/mqtt/overview.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ Neuron 支持 MQTT 插件作为其数据汇聚上报的方式之一,Neuron MQT
2020

2121
| 字段 | 说明 |
2222
| ------------------ | ------------------------------------------------------------ |
23+
| **MQTT 版本** | MQTT 协议的版本,默认为 v3.1.1。 |
2324
| **客户端 ID** | MQTT 通信的客户端 id,必填。 |
2425
| **QoS 等级** | MQTT 通信的服务质量等级,可选,默认为 QoS 0 。 |
2526
| **上报数据格式** | 上报数据的 JSON 格式:<br />· *values-format*:数据被分成 `values``errors` 的子对象。<br />· *tags-format*:数据被放在一个数组中。关于通信数据格式,见 [数据上下行格式](./api.md#数据上报) |
26-
| **写请求主题** | 接收点位写入请求的 MQTT 主题。关于通信数据格式,见 [数据上下行格式](./api.md#写-tag) |
27-
| **写响应主题** | 发送点位写入响应的 MQTT 主题。 |
27+
| **写请求主题** | 接收点位写入请求的 MQTT 主题。关于通信数据格式,见 [数据上下行格式](./api.md#写-tag)。如开启链路追踪,请按 W3C 标准配置用户属性 `traceparent``tracestate`|
28+
| **写响应主题** | 发送点位写入响应的 MQTT 主题。 |
29+
| **驱动状态上报** | 上报所有南向驱动状态到指定的 MQTT 主题。 |
30+
| **状态上报主题** | 状态上报的主题。 |
31+
| **状态上报间隔** | 上报南向节点状态的时间间隔,单位为秒,可填范围为 1-3600,默认1 |
2832
| **离线缓存** | 离线缓存开关。连接断开时缓存 MQTT 消息,连接重建时同步缓存的消息到MQTT服务器。(2.4.3 版新增),关于离线缓存功能的详细介绍,见[离线数据缓存](#离线数据缓存) |
2933
| **缓存内存大小** | 通信失败时内存消息缓存大小 (MB) 限制,必填;范围:[0, 1024],不能大于缓存磁盘大小。 |
3034
| **缓存磁盘大小** | 通信失败时磁盘消息缓存大小 (MB) 限制,必填,范围:[0, 10240]。<br />设为非零值时,缓存内存大小 也须为非零值。 |

0 commit comments

Comments
 (0)