loupedeck-commander 1.0.1 → 1.2.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/README.md +31 -8
- package/VERSION.md +33 -0
- package/common/ApplicationConfig.mjs +3 -0
- package/common/BaseLoupeDeckHandler.mjs +111 -28
- package/common/touchbuttons.mjs +304 -274
- package/config-test.json +9 -0
- package/eslint.config.mjs +9 -0
- package/{ExampleDeviceHandler.mjs → example/ExampleDeviceHandler.mjs} +3 -4
- package/example/example.mjs +21 -0
- package/icons/bulb_filled.png +0 -0
- package/interfaces/baseif.mjs +57 -0
- package/interfaces/httpif.mjs +86 -0
- package/interfaces/opcuaif.mjs +287 -0
- package/interfaces/opcuaif_test.mjs +31 -0
- package/interfaces/pubel.js +95 -0
- package/interfaces/shellif.mjs +46 -0
- package/package.json +9 -11
- package/profile-1.json +60 -96
- package/profile-2.json +164 -0
- package/test.mjs +23 -0
- package/example.mjs +0 -13
package/package.json
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loupedeck-commander",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A system to ease working with LoupeDeck devices using CMD-line interfaces",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "
|
|
7
|
+
"test": "node test.mjs",
|
|
8
|
+
"start": "node index.mjs"
|
|
8
9
|
},
|
|
9
10
|
"dependencies": {
|
|
10
11
|
"canvas": "^2.11.2",
|
|
11
|
-
"loupedeck": "^
|
|
12
|
+
"loupedeck": "^6.0.1",
|
|
12
13
|
"mkdirp": "^3.0.1",
|
|
14
|
+
"node-opcua": "^2.138.1",
|
|
13
15
|
"string-template": "^1.0.0"
|
|
14
16
|
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"eslint": "^8.53.0",
|
|
17
|
-
"eslint-config-standard": "^17.1.0",
|
|
18
|
-
"eslint-plugin-import": "^2.29.0",
|
|
19
|
-
"eslint-plugin-n": "^16.3.1",
|
|
20
|
-
"eslint-plugin-promise": "^6.1.1"
|
|
21
|
-
},
|
|
22
17
|
"author": "Thomas Schneider",
|
|
23
18
|
"license": "MIT",
|
|
24
19
|
"repository": {
|
|
@@ -27,5 +22,8 @@
|
|
|
27
22
|
},
|
|
28
23
|
"bugs": {
|
|
29
24
|
"url": "https://gitlab.com/keckxde/loupedeck-commander/-/issues"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"eslint": "^9.8.0"
|
|
30
28
|
}
|
|
31
|
-
}
|
|
29
|
+
}
|
package/profile-1.json
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"profile": "sample",
|
|
3
|
+
"parameters": {
|
|
4
|
+
"hostname": "localhost",
|
|
5
|
+
"user": "httpuser",
|
|
6
|
+
"password": "httppasswd",
|
|
7
|
+
"verbose" : false,
|
|
8
|
+
"endpointurl": "opc.tcp://localhost:4840",
|
|
9
|
+
"nodeid" : "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
10
|
+
"value" : "kvm-transmitter-1",
|
|
11
|
+
"simnbr": "1"
|
|
12
|
+
},
|
|
3
13
|
"description": "",
|
|
4
14
|
"config": {},
|
|
5
15
|
"touch": {
|
|
@@ -7,120 +17,74 @@
|
|
|
7
17
|
"right": {},
|
|
8
18
|
"center": {
|
|
9
19
|
"0": {
|
|
10
|
-
"
|
|
11
|
-
"off":
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"on":
|
|
20
|
+
"states": {
|
|
21
|
+
"off": {
|
|
22
|
+
"color": "#aaaaaa",
|
|
23
|
+
"image": "icons/home.png",
|
|
24
|
+
"cmd": "echo \"{id} {state}\""
|
|
25
|
+
},
|
|
26
|
+
"on": {
|
|
27
|
+
"color": "#11ff11",
|
|
28
|
+
"image": "icons/home.png",
|
|
29
|
+
"cmd": "echo \"{id} {state}\""
|
|
30
|
+
}
|
|
17
31
|
},
|
|
18
32
|
"group": "kvm1"
|
|
19
33
|
},
|
|
20
34
|
"1": {
|
|
21
|
-
"
|
|
22
|
-
"off":
|
|
23
|
-
|
|
35
|
+
"states": {
|
|
36
|
+
"off": {
|
|
37
|
+
"color": "#aaaaaa",
|
|
38
|
+
"image": "icons/bulb.png",
|
|
39
|
+
"http": "http://{user}:{password}@{hostname}:7778/control/connections"
|
|
40
|
+
},
|
|
41
|
+
"on": {
|
|
42
|
+
"color": "#11ff11",
|
|
43
|
+
"image": "icons/bulb.png",
|
|
44
|
+
"http": "http://{hostname}:7778/control/connections",
|
|
45
|
+
"opcua": "write",
|
|
46
|
+
"nodeid": "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
47
|
+
"value": "{key}"
|
|
48
|
+
}
|
|
24
49
|
},
|
|
25
50
|
"group": "kvm1"
|
|
26
51
|
},
|
|
27
52
|
"2": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
"states": {
|
|
54
|
+
"off": {
|
|
55
|
+
"color": "#aaaaaa",
|
|
56
|
+
"image": "icons/mountain.png"
|
|
57
|
+
},
|
|
58
|
+
"on": {
|
|
59
|
+
"color": "#11ff11",
|
|
60
|
+
"image": "icons/mountain.png",
|
|
61
|
+
"opcua": "write",
|
|
62
|
+
"nodeid": "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
63
|
+
"value": "{key}"
|
|
64
|
+
}
|
|
39
65
|
},
|
|
40
|
-
"
|
|
41
|
-
"off": "echo \"knob {state}\""
|
|
42
|
-
}
|
|
66
|
+
"group": "kvm1"
|
|
43
67
|
}
|
|
44
|
-
}
|
|
68
|
+
},
|
|
69
|
+
"knob": {}
|
|
45
70
|
},
|
|
46
71
|
"knobs": {
|
|
47
72
|
"left": {},
|
|
48
73
|
"right": {}
|
|
49
74
|
},
|
|
50
75
|
"buttons": {
|
|
51
|
-
"knobTL": {
|
|
52
|
-
"commands": {
|
|
53
|
-
"off": "echo \"{id} {state} {value}\"",
|
|
54
|
-
"on": "echo \"{id} {state} {value}\""
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"knobTR": {
|
|
58
|
-
"commands": {
|
|
59
|
-
"off": "echo \"{id} {state} {value}\"",
|
|
60
|
-
"on": "echo \"{id} {state} {value}\""
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"knobCL": {
|
|
64
|
-
"commands": {
|
|
65
|
-
"off": "echo \"{id} {state} {value}\"",
|
|
66
|
-
"on": "echo \"{id} {state} {value}\""
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"0": {
|
|
70
|
-
"commands": {
|
|
71
|
-
"off": "echo \"{id} {state}\"",
|
|
72
|
-
"on": "echo \"{id} {state}\""
|
|
73
|
-
},
|
|
74
|
-
"rgb": {
|
|
75
|
-
"off": [
|
|
76
|
-
0,
|
|
77
|
-
0,
|
|
78
|
-
0
|
|
79
|
-
],
|
|
80
|
-
"on": [
|
|
81
|
-
0,
|
|
82
|
-
255,
|
|
83
|
-
0
|
|
84
|
-
],
|
|
85
|
-
"intermediate": [
|
|
86
|
-
0,
|
|
87
|
-
255,
|
|
88
|
-
255
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
76
|
"1": {
|
|
93
|
-
"
|
|
94
|
-
"off":
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
"states": {
|
|
78
|
+
"off": {
|
|
79
|
+
"color": "#aaaaaa",
|
|
80
|
+
"cmd": "echo \"{id} {state}\""
|
|
81
|
+
},
|
|
82
|
+
"on": {
|
|
83
|
+
"color": "#11ff11",
|
|
84
|
+
"cmd": "echo \"{id} {state}\""
|
|
85
|
+
}
|
|
97
86
|
},
|
|
98
|
-
"
|
|
99
|
-
"off": [
|
|
100
|
-
0,
|
|
101
|
-
0,
|
|
102
|
-
0
|
|
103
|
-
],
|
|
104
|
-
"on": [
|
|
105
|
-
0,
|
|
106
|
-
255,
|
|
107
|
-
0
|
|
108
|
-
],
|
|
109
|
-
"intermediate": [
|
|
110
|
-
0,
|
|
111
|
-
255,
|
|
112
|
-
255
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"home": {
|
|
117
|
-
"rgb": {
|
|
118
|
-
"off": [
|
|
119
|
-
0,
|
|
120
|
-
0,
|
|
121
|
-
0
|
|
122
|
-
]
|
|
123
|
-
}
|
|
87
|
+
"group": "kvm1"
|
|
124
88
|
}
|
|
125
89
|
}
|
|
126
90
|
}
|
package/profile-2.json
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
{
|
|
2
|
+
"profile": "sample",
|
|
3
|
+
"parameters": {
|
|
4
|
+
"hostname": "localhost",
|
|
5
|
+
"user": "httpuser",
|
|
6
|
+
"password": "httppasswd",
|
|
7
|
+
"verbose" : false,
|
|
8
|
+
"endpointurl": "opc.tcp://localhost:4840",
|
|
9
|
+
"nodeid" : "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
10
|
+
"value" : "kvm-transmitter-1",
|
|
11
|
+
"simnbr": "1"
|
|
12
|
+
},
|
|
13
|
+
"description": "",
|
|
14
|
+
"config": {},
|
|
15
|
+
"touch": {
|
|
16
|
+
"left": {},
|
|
17
|
+
"right": {},
|
|
18
|
+
"center": {
|
|
19
|
+
"0": {
|
|
20
|
+
"states": {
|
|
21
|
+
"off": {
|
|
22
|
+
"color": "#aaaaaa",
|
|
23
|
+
"image": "icons/home.png"
|
|
24
|
+
},
|
|
25
|
+
"on": {
|
|
26
|
+
"color": "#11ff11",
|
|
27
|
+
"image": "icons/home.png",
|
|
28
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
29
|
+
"value": "kvm-transmitter{key}-1"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"nodeid": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
33
|
+
"group": "kvm1"
|
|
34
|
+
},
|
|
35
|
+
"1": {
|
|
36
|
+
"states": {
|
|
37
|
+
"off": {
|
|
38
|
+
"color": "#aaaaaa",
|
|
39
|
+
"image": "icons/bulb.png"
|
|
40
|
+
},
|
|
41
|
+
"on": {
|
|
42
|
+
"color": "#11ff11",
|
|
43
|
+
"image": "icons/bulb.png",
|
|
44
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
45
|
+
"value": "kvm-transmitter{key}-1"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"nodeid": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
49
|
+
"group": "kvm1"
|
|
50
|
+
},
|
|
51
|
+
"2": {
|
|
52
|
+
"states": {
|
|
53
|
+
"off": {
|
|
54
|
+
"color": "#aaaaaa",
|
|
55
|
+
"image": "icons/mountain.png"
|
|
56
|
+
},
|
|
57
|
+
"on": {
|
|
58
|
+
"color": "#11ff11",
|
|
59
|
+
"image": "icons/mountain.png",
|
|
60
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
61
|
+
"value": "kvm-transmitter{key}-1"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"nodeid": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
65
|
+
"group": "kvm1"
|
|
66
|
+
},
|
|
67
|
+
"3": {
|
|
68
|
+
"states": {
|
|
69
|
+
"off": {
|
|
70
|
+
"color": "#aaaaaa",
|
|
71
|
+
"image": "icons/mountain.png"
|
|
72
|
+
},
|
|
73
|
+
"on": {
|
|
74
|
+
"color": "#11ff11",
|
|
75
|
+
"image": "icons/mountain.png",
|
|
76
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
77
|
+
"value": "kvm-transmitter{key}-1"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"nodeid": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
81
|
+
"group": "kvm1"
|
|
82
|
+
},
|
|
83
|
+
"4": {
|
|
84
|
+
"states": {
|
|
85
|
+
"off": {
|
|
86
|
+
"color": "#aaaaaa",
|
|
87
|
+
"image": "icons/mountain.png"
|
|
88
|
+
},
|
|
89
|
+
"on": {
|
|
90
|
+
"color": "#11ff11",
|
|
91
|
+
"image": "icons/mountain.png",
|
|
92
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.in.Source",
|
|
93
|
+
"value": "kvm-transmitter{key}-1"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"nodeid": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
97
|
+
"group": "kvm1"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"knob": {}
|
|
101
|
+
},
|
|
102
|
+
"knobs": {
|
|
103
|
+
"left": {},
|
|
104
|
+
"right": {}
|
|
105
|
+
},
|
|
106
|
+
"buttons": {
|
|
107
|
+
"1": {
|
|
108
|
+
"states": {
|
|
109
|
+
"off": {
|
|
110
|
+
"color": "#aaaaaa"
|
|
111
|
+
},
|
|
112
|
+
"on": {
|
|
113
|
+
"color": "#11ff11",
|
|
114
|
+
"http": "http://{hostname}:7778/control/connections",
|
|
115
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
116
|
+
"value": "kvm-transmitter{key}-1"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"group": "kvm1"
|
|
120
|
+
},
|
|
121
|
+
"2": {
|
|
122
|
+
"states": {
|
|
123
|
+
"off": {
|
|
124
|
+
"color": "#aaaaaa"
|
|
125
|
+
},
|
|
126
|
+
"on": {
|
|
127
|
+
"color": "#11ff11",
|
|
128
|
+
"http": "http://{hostname}:7778/control/connections",
|
|
129
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
130
|
+
"value": "kvm-transmitter{key}-1"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"group": "kvm1"
|
|
134
|
+
},
|
|
135
|
+
"3": {
|
|
136
|
+
"states": {
|
|
137
|
+
"off": {
|
|
138
|
+
"color": "#aaaaaa"
|
|
139
|
+
},
|
|
140
|
+
"on": {
|
|
141
|
+
"color": "#11ff11",
|
|
142
|
+
"http": "http://{hostname}:7778/control/connections",
|
|
143
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
144
|
+
"value": "kvm-transmitter{key}-1"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"group": "kvm1"
|
|
148
|
+
},
|
|
149
|
+
"4": {
|
|
150
|
+
"states": {
|
|
151
|
+
"off": {
|
|
152
|
+
"color": "#aaaaaa"
|
|
153
|
+
},
|
|
154
|
+
"on": {
|
|
155
|
+
"color": "#11ff11",
|
|
156
|
+
"http": "http://{hostname}:7778/control/connections",
|
|
157
|
+
"opcua": "ns=4;s=Is{simnbr}.Kvm.out.Source",
|
|
158
|
+
"value": "kvm-transmitter{key}-1"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"group": "kvm1"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
package/test.mjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseLoupeDeckHandler } from './common/BaseLoupeDeckHandler.mjs'
|
|
2
|
+
//import { BaseLoupeDeckHandler } from 'loupedeck-commander'
|
|
3
|
+
|
|
4
|
+
const handler = new BaseLoupeDeckHandler('config-test.json')
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Stop the handlers when a signal like SIGINT or SIGTERM arrive
|
|
8
|
+
* @param {*} signal
|
|
9
|
+
*/
|
|
10
|
+
const stopHandler = async(signal) => {
|
|
11
|
+
console.log(`Receiving ${signal} => Stopping processes.`)
|
|
12
|
+
await handler.stop()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Initiating the signal handlers:
|
|
16
|
+
// see https://www.tutorialspoint.com/unix/unix-signals-traps.htm
|
|
17
|
+
process.on('SIGINT', async (signal) => { stopHandler(signal) })
|
|
18
|
+
process.on('SIGTERM', async (signal) => { stopHandler(signal) })
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
await handler.start()
|
|
22
|
+
|
|
23
|
+
await new Promise((resolve) => process.once("SIGINT", resolve));
|
package/example.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ExampleDeviceHandler } from './ExampleDeviceHandler.mjs'
|
|
2
|
-
|
|
3
|
-
const handler = new ExampleDeviceHandler('config.json')
|
|
4
|
-
|
|
5
|
-
const stopHandler = () => {
|
|
6
|
-
console.log('Receiving SIGINT => Stopping processes.')
|
|
7
|
-
handler.stop()
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// Initiating a process
|
|
11
|
-
process.on('SIGINT', stopHandler)
|
|
12
|
-
|
|
13
|
-
await handler.start()
|