You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`<host>` is the host name or IP address of the M-Bus slave
47
-
-`<port>` is the optional TCP port number used to access the M-Bus slave. Default is 805
48
-
-`<unitid>` is the M-Bus unit id of the M-Bus slave; same as [mbus:unitID](#mbus:unitID)
49
-
-`<offset>` is the id of the data; see [mbus:offset](#mbus:offset)
50
-
-`<timeout>` is the optional timeout in milliseconds of the request. Default is 1000; see [mbus:timeout](#mbus:timeout)
46
+
-`<host>` is the host name or IP address of the M-Bus slave
47
+
-`<port>` is the optional TCP port number used to access the M-Bus slave. Default is 805
48
+
-`<unitid>` is the M-Bus unit id of the M-Bus slave; same as [mbus:unitID](#mbus:unitID)
49
+
-`<offset>` is the id of the data; see [mbus:offset](#mbus:offset)
50
+
-`<timeout>` is the optional timeout in milliseconds of the request. Default is 1000; see [mbus:timeout](#mbus:timeout)
51
51
52
52
When specified URL values override the corresponding `form` parameter.
53
53
@@ -78,8 +78,8 @@ The protocol does not support security.
78
78
79
79
This implementation handles multiple requests to the same slave by combining them if possible. In the following, the terms **request** and **transaction** are used as follows to describe this:
80
80
81
-
-A **request** is a read request to a resource as issued by a user of the node-wot API.
82
-
-A **transaction** is a M-Bus operation and may cover the data of multiple **requests**.
81
+
- A **request** is a read request to a resource as issued by a user of the node-wot API.
82
+
- A **transaction** is a M-Bus operation and may cover the data of multiple **requests**.
83
83
84
84
## Combination
85
85
@@ -108,8 +108,8 @@ Reads the data with the id of 1 of the unit 2
-`<host>` is the hostname or IP address of the MODBUS slave
108
-
-`<port>` is the optional TCP port number used to access the MODBUS slave. Default is 502
109
-
-`<unitid>` is the MODBUS unit id of the MODBUS slave; same as [modv:unitID](#modv:unitID)
110
-
-`<address>` is the starting address register number; see [modv:address](#modv:address)
111
-
-`<quantity>` is the optional number of registers to access. Default is 1; see [modv:quantity](#modv:quantity)
107
+
-`<host>` is the hostname or IP address of the MODBUS slave
108
+
-`<port>` is the optional TCP port number used to access the MODBUS slave. Default is 502
109
+
-`<unitid>` is the MODBUS unit id of the MODBUS slave; same as [modv:unitID](#modv:unitID)
110
+
-`<address>` is the starting address register number; see [modv:address](#modv:address)
111
+
-`<quantity>` is the optional number of registers to access. Default is 1; see [modv:quantity](#modv:quantity)
112
112
113
113
When specified URL values override the corresponding `form` parameter.
114
114
@@ -118,19 +118,19 @@ The MODBUS binding uses and provides plain binary data for reading and writing.
118
118
119
119
Along with content type `application/octet-stream`, this protocol binding accepts also an optional `byteSeq` parameter. `byteSeq` specifies the endian-ness of the raw byte data being read/written by the MODBUS binding. It follows the notation `application/octet-stream;byteSeq=value`, where its value can be one of the following:
120
120
121
-
-`BIG_ENDIAN`, which is the default value
122
-
-`LITTLE_ENDIAN`
123
-
-`BIG_ENDIAN_BYTE_SWAP`
124
-
-`LITTLE_ENDIAN_BYTE_SWAP`
121
+
-`BIG_ENDIAN`, which is the default value
122
+
-`LITTLE_ENDIAN`
123
+
-`BIG_ENDIAN_BYTE_SWAP`
124
+
-`LITTLE_ENDIAN_BYTE_SWAP`
125
125
126
126
**Note**: the list above may be extended in the future.
127
127
128
128
In particular, the decimal numbers `9545` and `22880` will be encoded as follows:
129
129
130
-
-`BIG_ENDIAN`: `25 49 59 60`
131
-
-`LITTLE_ENDIAN`: `60 59 49 25`
132
-
-`BIG_ENDIAN_BYTE_SWAP`: `49 25 60 59`
133
-
-`LITTLE_ENDIAN_BYTE_SWAP`: `59 60 25 49`
130
+
-`BIG_ENDIAN`: `25 49 59 60`
131
+
-`LITTLE_ENDIAN`: `60 59 49 25`
132
+
-`BIG_ENDIAN_BYTE_SWAP`: `49 25 60 59`
133
+
-`LITTLE_ENDIAN_BYTE_SWAP`: `59 60 25 49`
134
134
135
135
For register resources, the payload is just the plain sequence of bytes read from or written to the registers. For coils and discrete inputs, the payload is a sequence of bytes, each corresponding to a single coil or discrete input. Each byte contains the value `0` or `1`. So the encoder and decoder should work on this series of bytes and does not have to take care about handling the individual bits. Mapping each coil or discrete input to a single property of type `boolean` works just fine.
136
136
@@ -145,8 +145,8 @@ The protocol does not support security.
145
145
146
146
This implementation handles multiple requests to the same slave by serializing and combining them if possible. In the following, the terms **request** and **transaction** are used as follows to describe this:
147
147
148
-
-A **request** is a read or write request to a resource as issued by a user of the node-wot API.
149
-
-A **transaction** is a Modbus operation and may cover the data of multiple **requests**.
148
+
- A **request** is a read or write request to a resource as issued by a user of the node-wot API.
149
+
- A **transaction** is a Modbus operation and may cover the data of multiple **requests**.
150
150
151
151
### Combination
152
152
@@ -221,14 +221,14 @@ Polls the 8th holding register of the unit 1 every second.
221
221
222
222
## TODOs
223
223
224
-
-[x] TEST
225
-
-[ ] (Modbus Server Protocol Binding)
226
-
-[x] Connection pooling
227
-
-[ ] More sophisticated algorithm for combining requests. Some ideas
228
-
-Not only append or prepend requests to transactions, but also combine transactions which become neighboured later on
229
-
-Impose some limit to the overall number of registers. The MODBUS protocol has such a limit and devices may define even lower values
230
-
-[ ] When a connection times out, re-connection does not work (see `connectionTimeout` in modbus-client.ts)
231
-
-[x] When a Modbus device is not reachable, scripts using binding-modbus stop working - corresponding error handling is necessary
224
+
-[x] TEST
225
+
-[ ] (Modbus Server Protocol Binding)
226
+
-[x] Connection pooling
227
+
-[ ] More sophisticated algorithm for combining requests. Some ideas
228
+
- Not only append or prepend requests to transactions, but also combine transactions which become neighboured later on
229
+
- Impose some limit to the overall number of registers. The MODBUS protocol has such a limit and devices may define even lower values
230
+
-[ ] When a connection times out, re-connection does not work (see `connectionTimeout` in modbus-client.ts)
231
+
-[x] When a Modbus device is not reachable, scripts using binding-modbus stop working - corresponding error handling is necessary
Copy file name to clipboardExpand all lines: packages/binding-mqtt/README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,8 @@ In the following examples it is shown how to use the MQTT binding of node-wot.
16
16
17
17
### Prerequisites
18
18
19
-
-`npm install @node-wot/core`
20
-
-`npm install @node-wot/binding-mqtt`
19
+
-`npm install @node-wot/core`
20
+
-`npm install @node-wot/binding-mqtt`
21
21
22
22
### MQTT Thing Example I
23
23
@@ -182,10 +182,10 @@ There are example implementations provided in the [example/scripting folder](htt
182
182
183
183
Please setup node-wot as described at the [node-wot main page](https://github.com/eclipse-thingweb/node-wot#as-a-standalone-application).
184
184
185
-
-example-mqtt-publish.js: Shows when node-wot acts as a MQTT Client that publishes data (latest counter value) to a broker.
186
-
At the same time, another client can invoke an action, such as `resetCounter`, by sending a publication message to the topic of this action.
187
-
This other client does not have to be node-wot, any MQTT client can interact with this Thing.
188
-
For node-wot clients, make sure to provide MQTT broker details (`host`, `port`, `username`, `password`, `clientId`) in the wot-servient.conf.json:
185
+
- example-mqtt-publish.js: Shows when node-wot acts as a MQTT Client that publishes data (latest counter value) to a broker.
186
+
At the same time, another client can invoke an action, such as `resetCounter`, by sending a publication message to the topic of this action.
187
+
This other client does not have to be node-wot, any MQTT client can interact with this Thing.
188
+
For node-wot clients, make sure to provide MQTT broker details (`host`, `port`, `username`, `password`, `clientId`) in the wot-servient.conf.json:
189
189
190
190
```js
191
191
{
@@ -202,7 +202,7 @@ Please setup node-wot as described at the [node-wot main page](https://github.co
202
202
203
203
Start the script by the command `wot-servient mqtt-publish.js` or `node ../../packages/cli/dist/cli.js mqtt-publish.js`.
204
204
205
-
-example-mqtt-subscription.js: Shows how node-wot consumes a Thing Description to do MQTT subscription on the provided event (=latest counter value) as well as initiate the action (reset counter).
205
+
- example-mqtt-subscription.js: Shows how node-wot consumes a Thing Description to do MQTT subscription on the provided event (=latest counter value) as well as initiate the action (reset counter).
206
206
207
207
Start the script by the command `wot-servient -c mqtt-subscribe.js` or `node ../../packages/cli/dist/cli.js -c mqtt-subscribe.js`.
0 commit comments