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
Copy file name to clipboardExpand all lines: README.md
+69Lines changed: 69 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ Plugin for polling Modbus devices and publishing the data to thin-edge.io. If us
19
19
-[Log file access](#log-file-access)
20
20
-[Config management](#config-management)
21
21
-[Cloud Fieldbus](#cloud-fieldbus)
22
+
-[Writing operations](#writing-operations)
22
23
23
24
-[Testing](#testing)
24
25
-[Build](#build)
@@ -169,6 +170,74 @@ After creating the protocol, you can add a new Cloud Fieldbus Device. Select the
169
170
170
171
For adding a modbus RTU device you need to use unit-ID of the slave device in the configuration.
171
172
173
+
### Write operations
174
+
175
+
The plugin supports writing to Modbus registers and coils through Cumulocity IoT operations.
176
+
177
+
#### Write to Register (c8y_SetRegister)
178
+
179
+
Write values to Modbus registers requires the following json to be included in the operation:
180
+
181
+
```json
182
+
{
183
+
"c8y_SetRegister": {
184
+
"input": false,
185
+
"address": 1,
186
+
"register": 3,
187
+
"startBit": 0,
188
+
"noBits": 16,
189
+
"value": 23,
190
+
"ipAddress": "192.168.1.100"
191
+
}
192
+
}
193
+
```
194
+
195
+
To create an operation to write a value to a Modbus register using Cumulocity, you can use the [go-c8y-cli](https://goc8ycli.netlify.app/docs/cli/c8y/operations/c8y_operations_create/) tool:
Or use [REST API](https://cumulocity.com/api/core/#operation/postOperationCollectionResource).
202
+
203
+
In the Cumulocity UI, the widget '[Asset table](https://cumulocity.com/docs/cockpit/widgets-collection/#asset-table)' can be used to create operations for the device.
204
+
205
+

206
+
207
+
208
+
#### Write to Coil (c8y_SetCoil)
209
+
210
+
Write values to Modbus coils requires the following json to be included in the operation:
211
+
:
212
+
213
+
```json
214
+
{
215
+
"c8y_SetCoil": {
216
+
"input": false,
217
+
"address": 1,
218
+
"coil": 48,
219
+
"value": 1,
220
+
"ipAddress": "192.168.1.100"
221
+
}
222
+
}
223
+
```
224
+
225
+
To create an operation to write a value to a Modbus coil using Cumulocity, you can use the [go-c8y-cli](https://goc8ycli.netlify.app/docs/cli/c8y/operations/c8y_operations_create/) tool:
Or use the [Cumulocity REST API](https://cumulocity.com/api/core/#operation/postOperationCollectionResource).
232
+
233
+
In the Cumulocity UI, the widget [Asset table](https://cumulocity.com/docs/cockpit/widgets-collection/#asset-table) can be used to create operations for the device.
234
+
235
+

236
+
237
+
238
+
:construction: The plugin does not yet support Cumulocity Fieldbus device widget. Please follow the above instrucstions to create operations.
239
+
240
+
172
241
## Testing
173
242
174
243
To run the tests locally, you need to provide your Cumulocity credentials as environment variables in a .env file:
0 commit comments