-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-mapping.json
More file actions
250 lines (250 loc) · 5.79 KB
/
Copy pathexample-mapping.json
File metadata and controls
250 lines (250 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
{
"_notes": [
"Reference example of the edge-client mapping format. Copy to ./mapping.json and edit.",
"Three device_type values are supported: 'master', 'slave', 'weigher'.",
"connection.type: 'tcp' or 'rtu_serial' for Modbus, 'serial_ascii' for a scale.",
"commands (weigher): serial commands triggered from MQTT — publish to {base}/{loc}/{name}/cmd/{key}."
],
"base_topic": "acme/site",
"poll_interval_ms": 1000,
"devices": [
{
"_comment": "Main PLC — Modbus TCP.",
"device_type": "master",
"device_id": "plc1",
"location": "area2",
"name": "machine_c",
"connection": {
"type": "tcp",
"host": "192.168.10.10",
"port": 502,
"unit_id": 1
},
"monitoring": [
{
"key": "temp_tank",
"label": "Tank Temperature",
"topic": "temp/tank",
"type": "float",
"unit": "C",
"modbus": {
"kind": "read_holding_registers",
"address": 0,
"byte_order": "big_little"
}
},
{
"key": "current_motor",
"label": "Motor Current",
"topic": "current/motor",
"type": "float",
"unit": "A",
"modbus": {
"kind": "read_holding_registers",
"address": 10,
"byte_order": "big_big"
}
}
],
"set": [
{
"key": "set_temp_tank",
"label": "Tank Temp Setpoint",
"topic": "set/temp/tank",
"type": "float",
"unit": "C",
"modbus": {
"kind": "write_multiple_registers",
"address": 26
}
}
],
"control": [
{
"key": "control_motor",
"label": "Motor On/Off",
"topic": "control/motor",
"type": "boolean",
"modbus": {
"kind": "write_single_register",
"address": 6,
"on_value": 1,
"off_value": 3
}
},
{
"key": "control_valve_up",
"label": "Valve Open",
"topic": "control/valve/up",
"type": "boolean",
"modbus": {
"kind": "write_single_coil",
"address": 4
}
}
]
},
{
"_comment": "Chiller slave — Modbus RTU via RS-485.",
"device_type": "slave",
"device_id": "slave1",
"location": "area2",
"name": "chiller",
"connection": {
"type": "rtu_serial",
"unit_id": 8,
"path": "/dev/ttyUSB0",
"baud": 19200,
"parity": "none",
"stop_bits": 1,
"data_bits": 8
},
"monitoring": [
{
"key": "temp_out_chiller",
"label": "Chiller Outlet Temperature",
"topic": "temp/out",
"type": "integer",
"unit": "C",
"modbus": {
"kind": "read_input_registers",
"address": 1000,
"scale": 0.1
}
}
],
"set": [
{
"key": "set_temp_chiller",
"label": "Chiller Temp Setpoint",
"topic": "set/temp",
"type": "float",
"unit": "C",
"modbus": {
"kind": "write_multiple_registers",
"address": 20
}
}
],
"control": [
{
"key": "control_chiller_on",
"label": "Chiller On/Off",
"topic": "control/on",
"type": "boolean",
"modbus": {
"kind": "write_single_register",
"address": 30,
"on_value": 1,
"off_value": 3
}
}
]
},
{
"_comment": "GSC scale — serial ASCII, non-standard digit encoding (0xB0–0xB9 = '0'–'9').",
"device_type": "weigher",
"device_id": "weigher_gsc",
"location": "scale_area",
"name": "scale_gsc",
"connection": {
"type": "serial_ascii",
"path": "COM9",
"baud": 9600,
"parity": "none",
"stop_bits": 1,
"data_bits": 7
},
"parser": {
"regex": "[A-Za-z-]*(?P<weight>[-+]?[0-9]+\\.[0-9]+)(?P<unit>[A-Za-z]*)",
"byte_map": [
{
"from": 176,
"to": 48
},
{
"from": 177,
"to": 49
},
{
"from": 178,
"to": 50
},
{
"from": 179,
"to": 51
},
{
"from": 180,
"to": 52
},
{
"from": 181,
"to": 53
},
{
"from": 182,
"to": 54
},
{
"from": 183,
"to": 55
},
{
"from": 184,
"to": 56
},
{
"from": 185,
"to": 57
}
],
"raw_topic": "raw"
},
"monitoring": [
{
"key": "weight",
"label": "GSC Weight",
"topic": "weight/raw",
"type": "float",
"unit": "kg"
},
{
"key": "unit",
"label": "GSC Unit",
"topic": "unit/raw",
"type": "string"
}
],
"commands": [
{
"key": "tare",
"serial_cmd": "T\\r\\n"
},
{
"key": "zero",
"serial_cmd": "Z\\r\\n"
},
{
"key": "print",
"serial_cmd": "P\\r\\n"
}
],
"set": [],
"control": []
}
],
"bridge": [
{
"read_from": {
"device": "slave1",
"key": "temp_out_chiller"
},
"write_to": {
"device": "plc1",
"key": "set_temp_tank"
},
"transform": "passthrough"
}
]
}