@etm-professional-control/winccoa-mcp-server 1.3.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +8 -1
- package/LEGAL_INFO.md +47 -0
- package/LICENSE.md +21 -0
- package/OSS.md +178 -0
- package/README.md +62 -7
- package/build/config/demo-project-instructions.md +28 -0
- package/build/config/server.config.d.ts +16 -1
- package/build/config/server.config.d.ts.map +1 -1
- package/build/config/server.config.js +60 -10
- package/build/config/server.config.js.map +1 -1
- package/build/fields/default.md +50 -0
- package/build/fields/oil.md +46 -0
- package/build/fields/transport.md +70 -0
- package/build/helpers/drivers/MqttConnection.d.ts +113 -0
- package/build/helpers/drivers/MqttConnection.d.ts.map +1 -0
- package/build/helpers/drivers/MqttConnection.js +644 -0
- package/build/helpers/drivers/MqttConnection.js.map +1 -0
- package/build/helpers/pmon/PmonClient.d.ts.map +1 -1
- package/build/helpers/pmon/PmonClient.js +53 -27
- package/build/helpers/pmon/PmonClient.js.map +1 -1
- package/build/index_http.d.ts +14 -1
- package/build/index_http.d.ts.map +1 -1
- package/build/index_http.js +122 -45
- package/build/index_http.js.map +1 -1
- package/build/server.d.ts +38 -4
- package/build/server.d.ts.map +1 -1
- package/build/server.js +192 -142
- package/build/server.js.map +1 -1
- package/build/systemprompt.md +50 -0
- package/build/tool_loader.d.ts.map +1 -1
- package/build/tool_loader.js +18 -4
- package/build/tool_loader.js.map +1 -1
- package/build/tools/common/common_query.d.ts.map +1 -1
- package/build/tools/common/common_query.js +49 -32
- package/build/tools/common/common_query.js.map +1 -1
- package/build/tools/dashboards/widget.d.ts.map +1 -1
- package/build/tools/dashboards/widget.js +12 -2
- package/build/tools/dashboards/widget.js.map +1 -1
- package/build/tools/datapoints/dp_basic.d.ts.map +1 -1
- package/build/tools/datapoints/dp_basic.js +48 -0
- package/build/tools/datapoints/dp_basic.js.map +1 -1
- package/build/tools/datapoints/dp_types.d.ts.map +1 -1
- package/build/tools/datapoints/dp_types.js +16 -1
- package/build/tools/datapoints/dp_types.js.map +1 -1
- package/build/tools/mqtt/mqtt_connection.d.ts +14 -0
- package/build/tools/mqtt/mqtt_connection.d.ts.map +1 -0
- package/build/tools/mqtt/mqtt_connection.js +380 -0
- package/build/tools/mqtt/mqtt_connection.js.map +1 -0
- package/build/types/drivers/connection.d.ts +36 -53
- package/build/types/drivers/connection.d.ts.map +1 -1
- package/build/types/drivers/connection.js +38 -31
- package/build/types/drivers/connection.js.map +1 -1
- package/build/types/drivers/mqtt.d.ts +253 -0
- package/build/types/drivers/mqtt.d.ts.map +1 -0
- package/build/types/drivers/mqtt.js +142 -0
- package/build/types/drivers/mqtt.js.map +1 -0
- package/build/types/drivers/opcua.d.ts +62 -0
- package/build/types/drivers/opcua.d.ts.map +1 -0
- package/build/types/drivers/opcua.js +41 -0
- package/build/types/drivers/opcua.js.map +1 -0
- package/build/types/drivers/{browse.d.ts → opcua_browse.d.ts} +1 -1
- package/build/types/drivers/opcua_browse.d.ts.map +1 -0
- package/build/types/drivers/{browse.js → opcua_browse.js} +1 -1
- package/build/types/drivers/opcua_browse.js.map +1 -0
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js +6 -2
- package/build/types/index.js.map +1 -1
- package/build/utils/logger.d.ts +29 -0
- package/build/utils/logger.d.ts.map +1 -0
- package/build/utils/logger.js +56 -0
- package/build/utils/logger.js.map +1 -0
- package/package.json +83 -71
- package/sbom.json +5541 -0
- package/build/types/drivers/browse.d.ts.map +0 -1
- package/build/types/drivers/browse.js.map +0 -1
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MQTT Connection Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for creating and managing MQTT connections.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { MqttConnection, MqttConnectionType, } from "../../helpers/drivers/MqttConnection.js";
|
|
8
|
+
import { createSuccessResponse, createErrorResponse, } from "../../utils/helpers.js";
|
|
9
|
+
/**
|
|
10
|
+
* Register MQTT Connection tools
|
|
11
|
+
* @param server - MCP server instance
|
|
12
|
+
* @param context - Server context with winccoa, configs, etc.
|
|
13
|
+
* @returns Number of tools registered
|
|
14
|
+
*/
|
|
15
|
+
export function registerTools(server, context) {
|
|
16
|
+
const mqtt = new MqttConnection();
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Tool 1: Add MQTT Connection (unified for all connection types)
|
|
19
|
+
// ============================================================================
|
|
20
|
+
server.tool("mqtt-add-connection", `Creates and configures a new MQTT client connection to an MQTT broker.
|
|
21
|
+
|
|
22
|
+
Connection Naming:
|
|
23
|
+
Connection names are automatically generated: _MqttConnection1, _MqttConnection2, etc.
|
|
24
|
+
|
|
25
|
+
Connection Types:
|
|
26
|
+
- 1: Unsecure (TCP, default port 1883) - default
|
|
27
|
+
- 2: TLS (default port 8883)
|
|
28
|
+
- 3: WebSocket
|
|
29
|
+
- 4: TLS-PSK
|
|
30
|
+
|
|
31
|
+
Usage Examples:
|
|
32
|
+
- Simple unsecure: host + port
|
|
33
|
+
- Unsecure with auth: host + port + username + password
|
|
34
|
+
- TLS without auth: host + port + connectionType=2 + certificate
|
|
35
|
+
- TLS with auth: host + port + connectionType=2 + certificate + username + password
|
|
36
|
+
- TLS-PSK: host + port + connectionType=4 + pskIdentity + psk
|
|
37
|
+
|
|
38
|
+
Required parameters:
|
|
39
|
+
- host: Hostname or IP address of the MQTT broker
|
|
40
|
+
- port: Port number (default: 1883)
|
|
41
|
+
|
|
42
|
+
Optional parameters:
|
|
43
|
+
- connectionType: 1=Unsecure, 2=TLS, 3=WebSocket, 4=TLS-PSK (default: 1)
|
|
44
|
+
- username: Username for authentication
|
|
45
|
+
- password: Encrypted password (WinCC OA encrypted blob string)
|
|
46
|
+
- certificate: Broker/Root-CA certificate path for TLS (required for connectionType=2). Relative to data/mqtt/cert/
|
|
47
|
+
- clientCertificate: Client certificate path for mutual TLS. Relative to data/mqtt/cert/
|
|
48
|
+
- clientKey: Client private key path for mutual TLS. Relative to data/mqtt/cert/
|
|
49
|
+
- clientCertPassword: Password for client certificate (encrypted WinCC OA blob)
|
|
50
|
+
- pskIdentity: PSK Identity for TLS-PSK (required for connectionType=4)
|
|
51
|
+
- psk: Pre-Shared Key for TLS-PSK (required for connectionType=4, encrypted)
|
|
52
|
+
- managerNumber: WinCC OA MQTT driver number (1-99). If not specified, uses the lowest available MQTT driver.
|
|
53
|
+
- keepAliveInterval: Keep alive interval in seconds (default: 20)
|
|
54
|
+
- reconnectInterval: Reconnect interval in seconds (default: 20)
|
|
55
|
+
- persistentSession: Use persistent MQTT session (default: true)
|
|
56
|
+
- enableConnection: Enable connection immediately (default: true)
|
|
57
|
+
- clientId: Custom client ID (auto-generated if not provided)
|
|
58
|
+
- jsonProfiles: Array of JSON profile strings for value transformation.
|
|
59
|
+
Examples:
|
|
60
|
+
- Value only: {"name":"Value","_value":"Value"}
|
|
61
|
+
- Value & Timestamp: {"name":"Value & Timestamp","_value":"Value","_stime":"Time"}
|
|
62
|
+
- Value, Timestamp & Status: {"name":"Value, Timestamp & Status","_value":"Value","_status64":"Status","_stime":"Time"}
|
|
63
|
+
|
|
64
|
+
Returns: The auto-generated connection name on success.`, {
|
|
65
|
+
host: z.string().describe("Hostname or IP address of the MQTT broker"),
|
|
66
|
+
port: z
|
|
67
|
+
.number()
|
|
68
|
+
.min(1)
|
|
69
|
+
.max(65535)
|
|
70
|
+
.default(1883)
|
|
71
|
+
.describe("Port number (default: 1883)"),
|
|
72
|
+
connectionType: z
|
|
73
|
+
.number()
|
|
74
|
+
.min(1)
|
|
75
|
+
.max(4)
|
|
76
|
+
.optional()
|
|
77
|
+
.describe("Connection type: 1=Unsecure (default), 2=TLS, 3=WebSocket, 4=TLS-PSK"),
|
|
78
|
+
username: z
|
|
79
|
+
.string()
|
|
80
|
+
.optional()
|
|
81
|
+
.describe("Username for authentication"),
|
|
82
|
+
password: z
|
|
83
|
+
.string()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe("Encrypted password (WinCC OA encrypted blob string)"),
|
|
86
|
+
certificate: z
|
|
87
|
+
.string()
|
|
88
|
+
.optional()
|
|
89
|
+
.describe("Broker/Root-CA certificate path for TLS, relative to data/mqtt/cert/. " +
|
|
90
|
+
"Path is validated by WinCC OA driver."),
|
|
91
|
+
clientCertificate: z
|
|
92
|
+
.string()
|
|
93
|
+
.optional()
|
|
94
|
+
.describe("Client certificate path for mutual TLS, relative to data/mqtt/cert/. " +
|
|
95
|
+
"Path is validated by WinCC OA driver."),
|
|
96
|
+
clientKey: z
|
|
97
|
+
.string()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe("Client private key path for mutual TLS, relative to data/mqtt/cert/. " +
|
|
100
|
+
"Path is validated by WinCC OA driver."),
|
|
101
|
+
clientCertPassword: z
|
|
102
|
+
.string()
|
|
103
|
+
.optional()
|
|
104
|
+
.describe("Password for client certificate (encrypted WinCC OA blob)"),
|
|
105
|
+
pskIdentity: z
|
|
106
|
+
.string()
|
|
107
|
+
.optional()
|
|
108
|
+
.describe("PSK Identity for TLS-PSK (required for connectionType=4)"),
|
|
109
|
+
psk: z
|
|
110
|
+
.string()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe("Pre-Shared Key for TLS-PSK (encrypted, required for connectionType=4)"),
|
|
113
|
+
managerNumber: z
|
|
114
|
+
.number()
|
|
115
|
+
.min(1)
|
|
116
|
+
.max(99)
|
|
117
|
+
.optional()
|
|
118
|
+
.describe("WinCC OA MQTT driver number (1-99). If not specified, uses lowest available MQTT driver."),
|
|
119
|
+
keepAliveInterval: z
|
|
120
|
+
.number()
|
|
121
|
+
.positive()
|
|
122
|
+
.optional()
|
|
123
|
+
.describe("Keep alive interval in seconds (default: 20)"),
|
|
124
|
+
reconnectInterval: z
|
|
125
|
+
.number()
|
|
126
|
+
.positive()
|
|
127
|
+
.optional()
|
|
128
|
+
.describe("Reconnect interval in seconds (default: 20)"),
|
|
129
|
+
persistentSession: z
|
|
130
|
+
.boolean()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe("Use persistent MQTT session (default: true)"),
|
|
133
|
+
enableConnection: z
|
|
134
|
+
.boolean()
|
|
135
|
+
.optional()
|
|
136
|
+
.describe("Enable connection immediately (default: true)"),
|
|
137
|
+
clientId: z
|
|
138
|
+
.string()
|
|
139
|
+
.optional()
|
|
140
|
+
.describe("Custom client ID (auto-generated if not provided)"),
|
|
141
|
+
jsonProfiles: z
|
|
142
|
+
.array(z.string())
|
|
143
|
+
.optional()
|
|
144
|
+
.describe("JSON profiles for value transformation (array of JSON strings)"),
|
|
145
|
+
}, async (params) => {
|
|
146
|
+
try {
|
|
147
|
+
console.log("Adding MQTT connection:", params);
|
|
148
|
+
const connType = params.connectionType ?? MqttConnectionType.Unsecure;
|
|
149
|
+
// Validate TLS requires certificate
|
|
150
|
+
if (connType === MqttConnectionType.TLS && !params.certificate) {
|
|
151
|
+
return createErrorResponse("Certificate is required for TLS connections (connectionType=2)");
|
|
152
|
+
}
|
|
153
|
+
// Validate TLS-PSK requires pskIdentity and psk
|
|
154
|
+
if (connType === MqttConnectionType.TLS_PSK) {
|
|
155
|
+
if (!params.pskIdentity || !params.psk) {
|
|
156
|
+
return createErrorResponse("pskIdentity and psk are required for TLS-PSK connections (connectionType=4)");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const result = await mqtt.addConnection({
|
|
160
|
+
connectionType: connType,
|
|
161
|
+
connectionString: `${params.host}:${params.port}`,
|
|
162
|
+
managerNumber: params.managerNumber,
|
|
163
|
+
username: params.username,
|
|
164
|
+
password: params.password,
|
|
165
|
+
certificate: params.certificate,
|
|
166
|
+
clientCertificate: params.clientCertificate,
|
|
167
|
+
clientKey: params.clientKey,
|
|
168
|
+
clientCertPassword: params.clientCertPassword,
|
|
169
|
+
pskIdentity: params.pskIdentity,
|
|
170
|
+
psk: params.psk,
|
|
171
|
+
keepAliveInterval: params.keepAliveInterval,
|
|
172
|
+
reconnectInterval: params.reconnectInterval,
|
|
173
|
+
persistentSession: params.persistentSession,
|
|
174
|
+
enableConnection: params.enableConnection,
|
|
175
|
+
clientId: params.clientId,
|
|
176
|
+
jsonProfiles: params.jsonProfiles,
|
|
177
|
+
});
|
|
178
|
+
if (!result.success) {
|
|
179
|
+
return createErrorResponse(`Failed to add MQTT connection: ${result.error}`);
|
|
180
|
+
}
|
|
181
|
+
const connTypeNames = {
|
|
182
|
+
1: "Unsecure",
|
|
183
|
+
2: "TLS",
|
|
184
|
+
3: "WebSocket",
|
|
185
|
+
4: "TLS-PSK",
|
|
186
|
+
};
|
|
187
|
+
console.log(`Successfully created MQTT connection: ${result.connectionName}`);
|
|
188
|
+
return createSuccessResponse({
|
|
189
|
+
connectionName: result.connectionName,
|
|
190
|
+
broker: `${params.host}:${params.port}`,
|
|
191
|
+
managerNumber: params.managerNumber ?? "auto-detected",
|
|
192
|
+
connectionType: connTypeNames[connType] ?? "Unknown",
|
|
193
|
+
username: params.username ?? "(none)",
|
|
194
|
+
message: "MQTT connection created and configured successfully",
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
199
|
+
console.error("Error adding MQTT connection:", error);
|
|
200
|
+
return createErrorResponse(`Failed to add MQTT connection: ${errorMessage}`);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
// ============================================================================
|
|
204
|
+
// Tool 3: Delete MQTT Connection
|
|
205
|
+
// ============================================================================
|
|
206
|
+
server.tool("mqtt-delete-connection", `Deletes an existing MQTT connection.
|
|
207
|
+
|
|
208
|
+
This tool removes the connection datapoint and disconnects from the broker.
|
|
209
|
+
The connection will be disabled before deletion.
|
|
210
|
+
|
|
211
|
+
Required parameters:
|
|
212
|
+
- connectionName: Name of the connection to delete (e.g., "_MqttConnection1" or "MqttConnection1")
|
|
213
|
+
|
|
214
|
+
Returns: Success status.`, {
|
|
215
|
+
connectionName: z
|
|
216
|
+
.string()
|
|
217
|
+
.describe("Name of the MQTT connection to delete"),
|
|
218
|
+
}, async (params) => {
|
|
219
|
+
try {
|
|
220
|
+
console.log("Deleting MQTT connection:", params.connectionName);
|
|
221
|
+
const result = await mqtt.deleteConnection(params.connectionName);
|
|
222
|
+
if (!result.success) {
|
|
223
|
+
return createErrorResponse(`Failed to delete MQTT connection: ${result.error}`);
|
|
224
|
+
}
|
|
225
|
+
return createSuccessResponse({
|
|
226
|
+
connectionName: params.connectionName,
|
|
227
|
+
message: "MQTT connection deleted successfully",
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
232
|
+
console.error("Error deleting MQTT connection:", error);
|
|
233
|
+
return createErrorResponse(`Failed to delete MQTT connection: ${errorMessage}`);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
// ============================================================================
|
|
237
|
+
// Tool 4: List MQTT Connections
|
|
238
|
+
// ============================================================================
|
|
239
|
+
server.tool("mqtt-list-connections", `Lists all configured MQTT connections and their current states.
|
|
240
|
+
|
|
241
|
+
Returns information about each connection including:
|
|
242
|
+
- Connection name
|
|
243
|
+
- Connection state (Inactive, Disconnected, Connecting, Connected, etc.)
|
|
244
|
+
- Broker address (if available)
|
|
245
|
+
|
|
246
|
+
No parameters required.`, {}, async () => {
|
|
247
|
+
try {
|
|
248
|
+
console.log("Listing MQTT connections");
|
|
249
|
+
const result = await mqtt.listConnections();
|
|
250
|
+
if (!result.success) {
|
|
251
|
+
return createErrorResponse(`Failed to list MQTT connections: ${result.error}`);
|
|
252
|
+
}
|
|
253
|
+
return createSuccessResponse({
|
|
254
|
+
count: result.connections?.length ?? 0,
|
|
255
|
+
connections: result.connections,
|
|
256
|
+
message: `Found ${result.connections?.length ?? 0} MQTT connection(s)`,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
261
|
+
console.error("Error listing MQTT connections:", error);
|
|
262
|
+
return createErrorResponse(`Failed to list MQTT connections: ${errorMessage}`);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
// ============================================================================
|
|
266
|
+
// Tool 5: Get MQTT Connection State
|
|
267
|
+
// ============================================================================
|
|
268
|
+
server.tool("mqtt-get-connection-state", `Gets the current state of an MQTT connection.
|
|
269
|
+
|
|
270
|
+
Connection States:
|
|
271
|
+
- 0: Inactive
|
|
272
|
+
- 1: Disconnected
|
|
273
|
+
- 2: Connecting
|
|
274
|
+
- 3: Connected
|
|
275
|
+
- 4: Disconnecting
|
|
276
|
+
- 5: Failure
|
|
277
|
+
- 6: Listening
|
|
278
|
+
|
|
279
|
+
Required parameters:
|
|
280
|
+
- connectionName: Name of the connection
|
|
281
|
+
|
|
282
|
+
Returns: Current connection state.`, {
|
|
283
|
+
connectionName: z.string().describe("Name of the MQTT connection"),
|
|
284
|
+
}, async (params) => {
|
|
285
|
+
try {
|
|
286
|
+
const result = await mqtt.getConnectionState(params.connectionName);
|
|
287
|
+
if (!result.success) {
|
|
288
|
+
return createErrorResponse(`Failed to get connection state: ${result.error}`);
|
|
289
|
+
}
|
|
290
|
+
return createSuccessResponse({
|
|
291
|
+
connectionName: params.connectionName,
|
|
292
|
+
state: result.state,
|
|
293
|
+
stateText: result.stateText,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
298
|
+
console.error("Error getting MQTT connection state:", error);
|
|
299
|
+
return createErrorResponse(`Failed to get connection state: ${errorMessage}`);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
// ============================================================================
|
|
303
|
+
// Tool 6: Add MQTT Address to DPE
|
|
304
|
+
// ============================================================================
|
|
305
|
+
server.tool("mqtt-add-address", `Configures an MQTT peripheral address for a datapoint element (DPE).
|
|
306
|
+
|
|
307
|
+
This tool sets up a DPE to publish and/or subscribe to an MQTT topic.
|
|
308
|
+
The DPE will send/receive values through the specified MQTT connection.
|
|
309
|
+
|
|
310
|
+
Required parameters:
|
|
311
|
+
- dpeName: Full datapoint element name (e.g., "MyDevice.Temperature.Value")
|
|
312
|
+
- topic: MQTT topic (e.g., "sensors/temperature")
|
|
313
|
+
- connectionName: Name of the MQTT connection (e.g., "_MqttConnection1")
|
|
314
|
+
- direction: Message direction:
|
|
315
|
+
- 1 = Publish (output) - WinCC OA sends to broker
|
|
316
|
+
- 2 = Subscribe (input) - WinCC OA receives from broker
|
|
317
|
+
- 6 = Both (bidirectional)
|
|
318
|
+
|
|
319
|
+
Optional parameters:
|
|
320
|
+
- transformation: Value transformation type:
|
|
321
|
+
- 1001 = Plain string (default)
|
|
322
|
+
- 1002 = JSON Profile: Value only
|
|
323
|
+
- 1003 = JSON Profile: Value & Timestamp
|
|
324
|
+
- 1004 = JSON Profile: Value, Timestamp & Status
|
|
325
|
+
- driverNumber: MQTT driver number (1-99). Auto-detected from connection if not specified.
|
|
326
|
+
- oldNewComparison: Enable old/new value comparison for input (default: true)
|
|
327
|
+
|
|
328
|
+
Returns: Success status.`, {
|
|
329
|
+
dpeName: z.string().describe("Full datapoint element name (e.g., 'MyDevice.Temperature.Value')"),
|
|
330
|
+
topic: z.string().describe("MQTT topic (e.g., 'sensors/temperature')"),
|
|
331
|
+
connectionName: z.string().describe("Name of the MQTT connection (e.g., '_MqttConnection1')"),
|
|
332
|
+
direction: z
|
|
333
|
+
.number()
|
|
334
|
+
.min(1)
|
|
335
|
+
.max(6)
|
|
336
|
+
.describe("Direction: 1=Publish, 2=Subscribe, 6=Both"),
|
|
337
|
+
transformation: z
|
|
338
|
+
.number()
|
|
339
|
+
.optional()
|
|
340
|
+
.describe("Transformation: 1001=PlainString, 1002=JsonValue, 1003=JsonValueTimestamp, 1004=JsonValueTimestampStatus (default: 1001)"),
|
|
341
|
+
driverNumber: z
|
|
342
|
+
.number()
|
|
343
|
+
.min(1)
|
|
344
|
+
.max(99)
|
|
345
|
+
.optional()
|
|
346
|
+
.describe("MQTT driver number (auto-detected from connection if not specified)"),
|
|
347
|
+
oldNewComparison: z
|
|
348
|
+
.boolean()
|
|
349
|
+
.optional()
|
|
350
|
+
.describe("Enable old/new value comparison for input (default: true)"),
|
|
351
|
+
}, async (params) => {
|
|
352
|
+
try {
|
|
353
|
+
console.log("Configuring MQTT address:", params);
|
|
354
|
+
console.log(" DEBUG - transformation param:", params.transformation, "type:", typeof params.transformation);
|
|
355
|
+
await mqtt.addAddressConfig({
|
|
356
|
+
dpeName: params.dpeName,
|
|
357
|
+
topic: params.topic,
|
|
358
|
+
connectionName: params.connectionName,
|
|
359
|
+
direction: params.direction,
|
|
360
|
+
transformation: params.transformation,
|
|
361
|
+
driverNumber: params.driverNumber,
|
|
362
|
+
oldNewComparison: params.oldNewComparison,
|
|
363
|
+
});
|
|
364
|
+
return createSuccessResponse({
|
|
365
|
+
dpeName: params.dpeName,
|
|
366
|
+
topic: params.topic,
|
|
367
|
+
connectionName: params.connectionName,
|
|
368
|
+
direction: params.direction,
|
|
369
|
+
message: "MQTT address configured successfully",
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
374
|
+
console.error("Error configuring MQTT address:", error);
|
|
375
|
+
return createErrorResponse(`Failed to configure MQTT address: ${errorMessage}`);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
return 5;
|
|
379
|
+
}
|
|
380
|
+
//# sourceMappingURL=mqtt_connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mqtt_connection.js","sourceRoot":"","sources":["../../../src/tools/mqtt/mqtt_connection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL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AE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,cAAc,EAAE,MAAM,CAAC,cAAc;gBACrC,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,cAAc,EAAE,MAAM,CAAC,cAAc;gBACrC,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;aAC1C,CAAC,CAAC;YAEH,OAAO,qBAAqB,CAAC;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,cAAc,EAAE,MAAM,CAAC,cAAc;gBACrC,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,sCAAsC;aAChD,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACzD,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACxD,OAAO,mBAAmB,CACxB,qCAAqC,YAAY,EAAE,CACpD,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Driver Connection
|
|
2
|
+
* Base Driver Connection Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Generic types shared by all driver connections.
|
|
5
|
+
* Note: DpAddressConfig and DpDistribConfig are defined in winccoa/manager.ts
|
|
5
6
|
*/
|
|
6
7
|
/**
|
|
7
8
|
* Base connection configuration
|
|
@@ -12,57 +13,39 @@ export interface ConnectionConfig {
|
|
|
12
13
|
enableConnection?: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Common connection state values (unified across drivers)
|
|
17
|
+
* Values < 256 = not connected, >= 256 = connected
|
|
16
18
|
*/
|
|
17
|
-
export declare enum
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
export declare enum CommonConnectionState {
|
|
20
|
+
/** Not initialized */
|
|
21
|
+
NotInitialized = -1,
|
|
22
|
+
/** Undefined state */
|
|
23
|
+
Undefined = 0,
|
|
24
|
+
/** Not connected */
|
|
25
|
+
NotConnected = 1,
|
|
26
|
+
/** Connecting in progress */
|
|
27
|
+
Connecting = 2,
|
|
28
|
+
/** Connection not active */
|
|
29
|
+
NotActive = 3,
|
|
30
|
+
/** Disconnecting in progress */
|
|
31
|
+
Disconnecting = 4,
|
|
32
|
+
/** Connection failure */
|
|
33
|
+
Failure = 5,
|
|
34
|
+
/** Waiting for reconnect */
|
|
35
|
+
WaitForReconnect = 9,
|
|
36
|
+
/** Connected (base value) */
|
|
37
|
+
Connected = 256,
|
|
38
|
+
/** Connected - First device, first connection active */
|
|
39
|
+
ConnectedFirstFirst = 257,
|
|
40
|
+
/** Connected - First device, second connection active */
|
|
41
|
+
ConnectedFirstSecond = 258,
|
|
42
|
+
/** Connected - Second device, first connection active */
|
|
43
|
+
ConnectedSecondFirst = 259,
|
|
44
|
+
/** Connected - Second device, second connection active */
|
|
45
|
+
ConnectedSecondSecond = 260,
|
|
46
|
+
/** General query running */
|
|
47
|
+
GeneralQueryRunning = 261,
|
|
48
|
+
/** Info query running */
|
|
49
|
+
InfoQueryRunning = 262
|
|
24
50
|
}
|
|
25
|
-
/**
|
|
26
|
-
* OPC UA Message Security Mode
|
|
27
|
-
*/
|
|
28
|
-
export declare enum MessageSecurityMode {
|
|
29
|
-
None = 0,
|
|
30
|
-
Sign = 1,
|
|
31
|
-
SignAndEncrypt = 2
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* OPC UA Connection Configuration
|
|
35
|
-
*/
|
|
36
|
-
export interface OpcUaConnectionConfig extends ConnectionConfig {
|
|
37
|
-
/** IP address of the OPC UA server */
|
|
38
|
-
ipAddress: string;
|
|
39
|
-
/** Port of the OPC UA server */
|
|
40
|
-
port: number;
|
|
41
|
-
/** Manager number of the OPC UA client (e.g., 4 for _OPCUA4) */
|
|
42
|
-
managerNumber: number;
|
|
43
|
-
/** Reconnect timer in seconds (default: 10) */
|
|
44
|
-
reconnectTimer?: number;
|
|
45
|
-
/** Security policy (default: None) */
|
|
46
|
-
securityPolicy?: SecurityPolicy;
|
|
47
|
-
/** Message security mode (default: None) */
|
|
48
|
-
messageSecurityMode?: MessageSecurityMode;
|
|
49
|
-
/** Username for authentication */
|
|
50
|
-
username?: string;
|
|
51
|
-
/** Password for authentication */
|
|
52
|
-
password?: string;
|
|
53
|
-
/** Client certificate name */
|
|
54
|
-
clientCertificate?: string;
|
|
55
|
-
/** Separator for display names (default: ".") */
|
|
56
|
-
separator?: string;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Default values for OPC UA connections
|
|
60
|
-
*/
|
|
61
|
-
export declare const OPCUA_DEFAULTS: {
|
|
62
|
-
readonly reconnectTimer: 10;
|
|
63
|
-
readonly securityPolicy: SecurityPolicy.None;
|
|
64
|
-
readonly messageSecurityMode: MessageSecurityMode.None;
|
|
65
|
-
readonly separator: ".";
|
|
66
|
-
readonly enableConnection: true;
|
|
67
|
-
};
|
|
68
51
|
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/types/drivers/connection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/types/drivers/connection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,oBAAY,qBAAqB;IAC/B,sBAAsB;IACtB,cAAc,KAAK;IACnB,sBAAsB;IACtB,SAAS,IAAI;IACb,oBAAoB;IACpB,YAAY,IAAI;IAChB,6BAA6B;IAC7B,UAAU,IAAI;IACd,4BAA4B;IAC5B,SAAS,IAAI;IACb,gCAAgC;IAChC,aAAa,IAAI;IACjB,yBAAyB;IACzB,OAAO,IAAI;IACX,4BAA4B;IAC5B,gBAAgB,IAAI;IACpB,6BAA6B;IAC7B,SAAS,MAAM;IACf,wDAAwD;IACxD,mBAAmB,MAAM;IACzB,yDAAyD;IACzD,oBAAoB,MAAM;IAC1B,yDAAyD;IACzD,oBAAoB,MAAM;IAC1B,0DAA0D;IAC1D,qBAAqB,MAAM;IAC3B,4BAA4B;IAC5B,mBAAmB,MAAM;IACzB,yBAAyB;IACzB,gBAAgB,MAAM;CACvB"}
|
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Driver Connection
|
|
2
|
+
* Base Driver Connection Types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Generic types shared by all driver connections.
|
|
5
|
+
* Note: DpAddressConfig and DpDistribConfig are defined in winccoa/manager.ts
|
|
5
6
|
*/
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Common connection state values (unified across drivers)
|
|
9
|
+
* Values < 256 = not connected, >= 256 = connected
|
|
8
10
|
*/
|
|
9
|
-
export var
|
|
10
|
-
(function (
|
|
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
|
-
|
|
11
|
+
export var CommonConnectionState;
|
|
12
|
+
(function (CommonConnectionState) {
|
|
13
|
+
/** Not initialized */
|
|
14
|
+
CommonConnectionState[CommonConnectionState["NotInitialized"] = -1] = "NotInitialized";
|
|
15
|
+
/** Undefined state */
|
|
16
|
+
CommonConnectionState[CommonConnectionState["Undefined"] = 0] = "Undefined";
|
|
17
|
+
/** Not connected */
|
|
18
|
+
CommonConnectionState[CommonConnectionState["NotConnected"] = 1] = "NotConnected";
|
|
19
|
+
/** Connecting in progress */
|
|
20
|
+
CommonConnectionState[CommonConnectionState["Connecting"] = 2] = "Connecting";
|
|
21
|
+
/** Connection not active */
|
|
22
|
+
CommonConnectionState[CommonConnectionState["NotActive"] = 3] = "NotActive";
|
|
23
|
+
/** Disconnecting in progress */
|
|
24
|
+
CommonConnectionState[CommonConnectionState["Disconnecting"] = 4] = "Disconnecting";
|
|
25
|
+
/** Connection failure */
|
|
26
|
+
CommonConnectionState[CommonConnectionState["Failure"] = 5] = "Failure";
|
|
27
|
+
/** Waiting for reconnect */
|
|
28
|
+
CommonConnectionState[CommonConnectionState["WaitForReconnect"] = 9] = "WaitForReconnect";
|
|
29
|
+
/** Connected (base value) */
|
|
30
|
+
CommonConnectionState[CommonConnectionState["Connected"] = 256] = "Connected";
|
|
31
|
+
/** Connected - First device, first connection active */
|
|
32
|
+
CommonConnectionState[CommonConnectionState["ConnectedFirstFirst"] = 257] = "ConnectedFirstFirst";
|
|
33
|
+
/** Connected - First device, second connection active */
|
|
34
|
+
CommonConnectionState[CommonConnectionState["ConnectedFirstSecond"] = 258] = "ConnectedFirstSecond";
|
|
35
|
+
/** Connected - Second device, first connection active */
|
|
36
|
+
CommonConnectionState[CommonConnectionState["ConnectedSecondFirst"] = 259] = "ConnectedSecondFirst";
|
|
37
|
+
/** Connected - Second device, second connection active */
|
|
38
|
+
CommonConnectionState[CommonConnectionState["ConnectedSecondSecond"] = 260] = "ConnectedSecondSecond";
|
|
39
|
+
/** General query running */
|
|
40
|
+
CommonConnectionState[CommonConnectionState["GeneralQueryRunning"] = 261] = "GeneralQueryRunning";
|
|
41
|
+
/** Info query running */
|
|
42
|
+
CommonConnectionState[CommonConnectionState["InfoQueryRunning"] = 262] = "InfoQueryRunning";
|
|
43
|
+
})(CommonConnectionState || (CommonConnectionState = {}));
|
|
37
44
|
//# sourceMappingURL=connection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/types/drivers/connection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/types/drivers/connection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;;GAGG;AACH,MAAM,CAAN,IAAY,qBA+BX;AA/BD,WAAY,qBAAqB;IAC/B,sBAAsB;IACtB,sFAAmB,CAAA;IACnB,sBAAsB;IACtB,2EAAa,CAAA;IACb,oBAAoB;IACpB,iFAAgB,CAAA;IAChB,6BAA6B;IAC7B,6EAAc,CAAA;IACd,4BAA4B;IAC5B,2EAAa,CAAA;IACb,gCAAgC;IAChC,mFAAiB,CAAA;IACjB,yBAAyB;IACzB,uEAAW,CAAA;IACX,4BAA4B;IAC5B,yFAAoB,CAAA;IACpB,6BAA6B;IAC7B,6EAAe,CAAA;IACf,wDAAwD;IACxD,iGAAyB,CAAA;IACzB,yDAAyD;IACzD,mGAA0B,CAAA;IAC1B,yDAAyD;IACzD,mGAA0B,CAAA;IAC1B,0DAA0D;IAC1D,qGAA2B,CAAA;IAC3B,4BAA4B;IAC5B,iGAAyB,CAAA;IACzB,yBAAyB;IACzB,2FAAsB,CAAA;AACxB,CAAC,EA/BW,qBAAqB,KAArB,qBAAqB,QA+BhC"}
|