node-red-contrib-ccu 4.13.0 → 4.14.1
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/CHANGELOG.md +36 -0
- package/README.md +12 -2
- package/nodes/ccu-connection.js +658 -47
- package/nodes/ccu-poll.js +4 -3
- package/nodes/ccu-program.js +1 -1
- package/nodes/ccu-sysvar.js +1 -1
- package/nodes/lib/lite.js +15 -2
- package/nodes/lib/logic.js +178 -0
- package/nodes/lib/status.js +31 -0
- package/nodes/locales/de/ccu-poll.html +2 -0
- package/nodes/locales/de/ccu-program.html +5 -0
- package/nodes/locales/de/ccu-sysvar.html +7 -0
- package/nodes/locales/en-US/ccu-poll.html +2 -0
- package/nodes/locales/en-US/ccu-program.html +5 -0
- package/nodes/locales/en-US/ccu-sysvar.html +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,42 @@ Notable changes to node-red-contrib-ccu. Format follows
|
|
|
5
5
|
user-visible symptom and the cause, not the commit list (the release notes
|
|
6
6
|
append commits automatically).
|
|
7
7
|
|
|
8
|
+
## 4.14.1 (2026-11-25)
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **openccu-lite: a Logic system variable without its texts, list or unit
|
|
13
|
+
after the start.** At connect the values come before the descriptions of
|
|
14
|
+
the variables, so a variable's message and the editor's list had an empty
|
|
15
|
+
`enum`, no `valueEnum` and no `unit` until the variable was written the
|
|
16
|
+
next time. The variable now takes them as soon as its description is
|
|
17
|
+
there. Writing was not affected.
|
|
18
|
+
|
|
19
|
+
## 4.14.0 (2026-11-25)
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **openccu-lite: system variables and programs from the Logic addon.** On
|
|
24
|
+
openccu-lite the `ccu-sysvar` and `ccu-program` nodes stayed
|
|
25
|
+
_disconnected_ and answered every message with an error, because the system
|
|
26
|
+
has no ReGaHSS. The Logic addon now offers the variables and programs as
|
|
27
|
+
devices of its interface `Logic` through the system's lite-rpc, and the nodes
|
|
28
|
+
use it: a variable or program is found by its name, as on a CCU, so flows
|
|
29
|
+
written for a CCU keep working after the switch once the variables and
|
|
30
|
+
programs were imported into Logic. Values arrive at every write (with
|
|
31
|
+
_Emit changed values only_, changes only), writes take a list entry or a
|
|
32
|
+
logic value also by its text, a program is switched by `true`/`false` and
|
|
33
|
+
started (the first _Then_, as the CCU's _Start_) by anything else. The
|
|
34
|
+
editor lists the variables and programs; `ccu-get-value`, `ccu-switch` and
|
|
35
|
+
`ccu-mqtt` find them as well. Without the addon the nodes show _Logic addon
|
|
36
|
+
not installed_, and the addon installed while Node-RED runs is taken
|
|
37
|
+
without a deploy.
|
|
38
|
+
- **openccu-lite: every interface the system lists.** The connection
|
|
39
|
+
followed only the radio interfaces it knows; an addon's interface (such as
|
|
40
|
+
Logic's) was never seen. It now follows every interface lite-rpc lists, an
|
|
41
|
+
addon's without a checkbox; its devices and datapoints can be used with the
|
|
42
|
+
value, event and rpc nodes like those of any interface.
|
|
43
|
+
|
|
8
44
|
## 4.13.0 (2026-11-22)
|
|
9
45
|
|
|
10
46
|
### Added
|
package/README.md
CHANGED
|
@@ -55,8 +55,18 @@ CCU-Jack keep their own connections.
|
|
|
55
55
|
(`rpc:read` for events and reads, `rpc:operate` for `setValue`, `rpc:configure` for paramsets and links,
|
|
56
56
|
`rpc:admin` for the rest). A token without `rpc:read` (one made for the names alone) keeps the direct connection
|
|
57
57
|
with callbacks under _auto_, and the log says what lite-rpc would need.
|
|
58
|
-
- **System variables
|
|
59
|
-
`
|
|
58
|
+
- **System variables and programs come from the Logic addon** (4.14.0). Logic offers them as devices of an interface
|
|
59
|
+
of its own, `Logic`, which lite-rpc carries like the radio interfaces; the connection follows every interface the
|
|
60
|
+
system lists, an addon's without a checkbox. The `ccu-sysvar` and `ccu-program` nodes find a variable or a program
|
|
61
|
+
by its name, as on a CCU, so a flow written for a CCU keeps working once the variables and programs were imported
|
|
62
|
+
into Logic: a variable is read, written (a list entry or a logic value also by its text) and reported at every
|
|
63
|
+
write (_Emit changed values only_ leaves out a write of the same value); a program is switched by `true`/`false`
|
|
64
|
+
and started by anything else - the first _Then_ without the conditions, as the CCU's _Start_ does. The editor lists
|
|
65
|
+
them, and `ccu-get-value`, `ccu-switch` and `ccu-mqtt` find them too. Messages keep the CCU's shape, with
|
|
66
|
+
`iface: "Logic"`, `key` and `address` (the Logic channel) in place of the ReGa `id`. This needs lite-rpc (RedMatic
|
|
67
|
+
on the system, or a paired connection); without the addon the nodes show _Logic addon not installed_ and a write
|
|
68
|
+
is refused with that reason. `ccu-poll` has nothing to poll there (the values are events). **HM-Script does not
|
|
69
|
+
exist there**: the `ccu-script` node stays in the flows and answers every message with an error.
|
|
60
70
|
|
|
61
71
|
## Topics
|
|
62
72
|
|
package/nodes/ccu-connection.js
CHANGED
|
@@ -19,6 +19,7 @@ const {Rega} = require('homematic-rega'); // ES module - require(esm) needs Node
|
|
|
19
19
|
const metaProvider = require('./lib/metaprovider.js');
|
|
20
20
|
const {InitRetry, retryDelay, RETRY_INTERVAL} = require('./lib/initretry.js');
|
|
21
21
|
const lite = require('./lib/lite.js');
|
|
22
|
+
const logic = require('./lib/logic.js');
|
|
22
23
|
const {Pairings} = require('./lib/pairing.js');
|
|
23
24
|
const {
|
|
24
25
|
writeJsonAtomic,
|
|
@@ -775,6 +776,13 @@ module.exports = function (RED) {
|
|
|
775
776
|
// and, per interface, why it cannot be reached (the nodes show it)
|
|
776
777
|
this.liteScopes = undefined;
|
|
777
778
|
this.ifaceError = {};
|
|
779
|
+
// task 32: Logic (lite-addon-logic), the interface of the system variables and programs on
|
|
780
|
+
// openccu-lite - its name once lite-rpc listed it, whether the list was read, the objects by
|
|
781
|
+
// their value channel, and the writes waiting for the first picture
|
|
782
|
+
this.logicIface = null;
|
|
783
|
+
this.liteListed = false;
|
|
784
|
+
this.logicObjects = {};
|
|
785
|
+
this.logicWaiters = [];
|
|
778
786
|
this.metaMode = false;
|
|
779
787
|
this.meta = null;
|
|
780
788
|
// #167: minutes between re-reads of channel names, rooms and
|
|
@@ -1564,6 +1572,10 @@ module.exports = function (RED) {
|
|
|
1564
1572
|
all ? Object.keys(all).length : 0,
|
|
1565
1573
|
'(' + Object.keys(this.paramsetDescriptions).length + ' in memory for the device types present)',
|
|
1566
1574
|
);
|
|
1575
|
+
if (loaded > 0) {
|
|
1576
|
+
this.refreshLogicShapesSoon();
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1567
1579
|
return loaded;
|
|
1568
1580
|
}
|
|
1569
1581
|
|
|
@@ -1883,7 +1895,7 @@ module.exports = function (RED) {
|
|
|
1883
1895
|
') - names, rooms and functions come from its metadata api',
|
|
1884
1896
|
);
|
|
1885
1897
|
this.logger.info(
|
|
1886
|
-
'this system has no ReGaHSS: system variables
|
|
1898
|
+
'this system has no ReGaHSS: system variables and programs come from the Logic addon through lite-rpc where it is installed, HM-Script is not available (the script node stays idle)',
|
|
1887
1899
|
);
|
|
1888
1900
|
if (!this.regaEnabled) {
|
|
1889
1901
|
// B-46: the checkbox has nothing to switch here - the names are the metadata api's
|
|
@@ -2066,6 +2078,7 @@ module.exports = function (RED) {
|
|
|
2066
2078
|
' functions',
|
|
2067
2079
|
);
|
|
2068
2080
|
this.saveRegadata();
|
|
2081
|
+
this.relabelLogic();
|
|
2069
2082
|
}
|
|
2070
2083
|
|
|
2071
2084
|
/**
|
|
@@ -2265,12 +2278,11 @@ module.exports = function (RED) {
|
|
|
2265
2278
|
* @returns {Promise}
|
|
2266
2279
|
*/
|
|
2267
2280
|
programActive(name, active) {
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
return;
|
|
2272
|
-
}
|
|
2281
|
+
if (this.metaMode) {
|
|
2282
|
+
return this.logicProgramCall(name, 'ACTIVE', Boolean(active));
|
|
2283
|
+
}
|
|
2273
2284
|
|
|
2285
|
+
return new Promise((resolve, reject) => {
|
|
2274
2286
|
const program = this.program[name];
|
|
2275
2287
|
if (program) {
|
|
2276
2288
|
const script = `dom.GetObject(${program.id}).Active(${active});`;
|
|
@@ -2297,12 +2309,11 @@ module.exports = function (RED) {
|
|
|
2297
2309
|
* @returns {Promise}
|
|
2298
2310
|
*/
|
|
2299
2311
|
programExecute(name) {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
return;
|
|
2304
|
-
}
|
|
2312
|
+
if (this.metaMode) {
|
|
2313
|
+
return this.logicProgramCall(name, 'RUN_THEN', true);
|
|
2314
|
+
}
|
|
2305
2315
|
|
|
2316
|
+
return new Promise((resolve, reject) => {
|
|
2306
2317
|
const program = this.program[name];
|
|
2307
2318
|
if (program) {
|
|
2308
2319
|
const d = new Date();
|
|
@@ -2336,12 +2347,11 @@ module.exports = function (RED) {
|
|
|
2336
2347
|
* @returns {Promise}
|
|
2337
2348
|
*/
|
|
2338
2349
|
setVariable(name, value) {
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
return;
|
|
2343
|
-
}
|
|
2350
|
+
if (this.metaMode) {
|
|
2351
|
+
return this.setLogicVariable(name, value);
|
|
2352
|
+
}
|
|
2344
2353
|
|
|
2354
|
+
return new Promise((resolve, reject) => {
|
|
2345
2355
|
if (!this.hasRegaVariables) {
|
|
2346
2356
|
this.logger.debug('variables not yet known. defer setVariable ' + name);
|
|
2347
2357
|
clearTimeout(this.setVariableQueueTimeout[name]);
|
|
@@ -2550,29 +2560,57 @@ module.exports = function (RED) {
|
|
|
2550
2560
|
cache: isNew,
|
|
2551
2561
|
});
|
|
2552
2562
|
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2563
|
+
this.dispatchSysvar(sysvar.name);
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
/**
|
|
2568
|
+
* A system variable's state to the sysvar subscriptions whose filter takes it: its name, a
|
|
2569
|
+
* value from the start (cache) only where the filter asks for one, a value that did not
|
|
2570
|
+
* change only where the filter does not ask for changes alone.
|
|
2571
|
+
* @param {string} name
|
|
2572
|
+
*/
|
|
2573
|
+
dispatchSysvar(name) {
|
|
2574
|
+
const sysvar = this.sysvar[name];
|
|
2575
|
+
if (!sysvar) {
|
|
2576
|
+
return;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
Object.keys(this.sysvarCallbacks).forEach((key) => {
|
|
2580
|
+
const {filter, callback} = this.sysvarCallbacks[key];
|
|
2581
|
+
let match = !filter.name || filter.name === name;
|
|
2582
|
+
if (sysvar.cache && !filter.cache) {
|
|
2583
|
+
match = false;
|
|
2584
|
+
} else if (filter.change && !sysvar.change) {
|
|
2585
|
+
if (!(sysvar.cache && filter.cache)) {
|
|
2557
2586
|
match = false;
|
|
2558
|
-
} else if (filter.change && !this.sysvar[sysvar.name].change) {
|
|
2559
|
-
if (!(this.sysvar[sysvar.name].cache && filter.cache)) {
|
|
2560
|
-
match = false;
|
|
2561
|
-
}
|
|
2562
2587
|
}
|
|
2588
|
+
}
|
|
2563
2589
|
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
});
|
|
2569
|
-
}
|
|
2590
|
+
if (match) {
|
|
2591
|
+
callback(RED.util.cloneMessage(sysvar));
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2570
2594
|
}
|
|
2571
2595
|
|
|
2572
2596
|
/**
|
|
2573
|
-
*
|
|
2574
|
-
* @
|
|
2597
|
+
* A program's state to the program subscriptions of its name (or of every program).
|
|
2598
|
+
* @param {string} name
|
|
2575
2599
|
*/
|
|
2600
|
+
dispatchProgram(name) {
|
|
2601
|
+
const program = this.program[name];
|
|
2602
|
+
if (!program) {
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
Object.keys(this.programCallbacks).forEach((key) => {
|
|
2607
|
+
const {filter, callback} = this.programCallbacks[key];
|
|
2608
|
+
if (!filter.name || filter.name === name) {
|
|
2609
|
+
callback(program);
|
|
2610
|
+
}
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2576
2614
|
/**
|
|
2577
2615
|
* Re-read the ReGa metadata that only ever got fetched once, in the
|
|
2578
2616
|
* constructor: channel names, rooms and functions. A room or function
|
|
@@ -2695,12 +2733,7 @@ module.exports = function (RED) {
|
|
|
2695
2733
|
ts: prg.ts,
|
|
2696
2734
|
tsPrevious: this.program[prg.name].ts,
|
|
2697
2735
|
};
|
|
2698
|
-
|
|
2699
|
-
const {filter, callback} = this.programCallbacks[key];
|
|
2700
|
-
if (!filter.name || filter.name === prg.name) {
|
|
2701
|
-
callback(this.program[prg.name]);
|
|
2702
|
-
}
|
|
2703
|
-
});
|
|
2736
|
+
this.dispatchProgram(prg.name);
|
|
2704
2737
|
}
|
|
2705
2738
|
});
|
|
2706
2739
|
resolve();
|
|
@@ -2882,7 +2915,9 @@ module.exports = function (RED) {
|
|
|
2882
2915
|
this.meta.attach(box);
|
|
2883
2916
|
}
|
|
2884
2917
|
},
|
|
2885
|
-
|
|
2918
|
+
// task 32: the client follows every interface the system lists; the stream's calls of an
|
|
2919
|
+
// interface this connection does not use (unticked) get an id no handler takes
|
|
2920
|
+
initId: (iface) => (this.liteWants(iface) ? this.liteInitId(iface) : 'nr_ignored'),
|
|
2886
2921
|
logger: this.logger,
|
|
2887
2922
|
createClient: this.liteCreateClient,
|
|
2888
2923
|
onCallback: (method, err, parameters, callback) => {
|
|
@@ -2907,7 +2942,20 @@ module.exports = function (RED) {
|
|
|
2907
2942
|
}
|
|
2908
2943
|
},
|
|
2909
2944
|
onInterface: (iface, state) => {
|
|
2910
|
-
if (
|
|
2945
|
+
if (this.closing) {
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
if (state === 'removed' && iface === this.logicIface) {
|
|
2950
|
+
this.logicGone();
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
|
|
2954
|
+
if (state !== 'removed' && !this.liteWants(iface)) {
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
if (!this.liteIfaces.includes(iface)) {
|
|
2911
2959
|
return;
|
|
2912
2960
|
}
|
|
2913
2961
|
|
|
@@ -2928,12 +2976,13 @@ module.exports = function (RED) {
|
|
|
2928
2976
|
}
|
|
2929
2977
|
|
|
2930
2978
|
this.logger.debug('lite-rpc client', state);
|
|
2979
|
+
const followed = this.liteIfaces.slice();
|
|
2931
2980
|
if (state === 'ready') {
|
|
2932
|
-
|
|
2981
|
+
followed.forEach((iface) => this.setIfaceStatus(iface, running(iface), !running(iface)));
|
|
2933
2982
|
} else if (state === 'degraded' || state === 'offline' || state === 'connecting') {
|
|
2934
|
-
|
|
2983
|
+
followed.forEach((iface) => this.setIfaceStatus(iface, false, true));
|
|
2935
2984
|
} else if (state === 'closed') {
|
|
2936
|
-
|
|
2985
|
+
followed.forEach((iface) => this.setIfaceStatus(iface, false));
|
|
2937
2986
|
}
|
|
2938
2987
|
},
|
|
2939
2988
|
onValues: (values) => this.applyLiteValues(values),
|
|
@@ -2949,7 +2998,9 @@ module.exports = function (RED) {
|
|
|
2949
2998
|
return;
|
|
2950
2999
|
}
|
|
2951
3000
|
|
|
2952
|
-
|
|
3001
|
+
// task 32: the addon interfaces the system lists (Logic), followed without a checkbox
|
|
3002
|
+
this.liteAddonsListed();
|
|
3003
|
+
const up = this.liteIfaces.filter((iface) => running(iface));
|
|
2953
3004
|
this.logger.info('lite-rpc connected: ' + (up.join(', ') || 'no interface running'));
|
|
2954
3005
|
if (!this.lite.may('rpc:operate')) {
|
|
2955
3006
|
// B-44: events and device lists, but every command refused
|
|
@@ -3005,6 +3056,7 @@ module.exports = function (RED) {
|
|
|
3005
3056
|
this.ifaceStatus[iface] = null;
|
|
3006
3057
|
this.setIfaceStatus(iface, false);
|
|
3007
3058
|
});
|
|
3059
|
+
this.logicSettled();
|
|
3008
3060
|
return;
|
|
3009
3061
|
}
|
|
3010
3062
|
|
|
@@ -3026,7 +3078,7 @@ module.exports = function (RED) {
|
|
|
3026
3078
|
let count = 0;
|
|
3027
3079
|
values.forEach((entry, ref) => {
|
|
3028
3080
|
const [iface, channel, datapoint] = String(ref).split('.');
|
|
3029
|
-
if (!
|
|
3081
|
+
if (!channel || !datapoint || !this.liteWants(iface)) {
|
|
3030
3082
|
return;
|
|
3031
3083
|
}
|
|
3032
3084
|
|
|
@@ -3041,10 +3093,15 @@ module.exports = function (RED) {
|
|
|
3041
3093
|
});
|
|
3042
3094
|
this.values[message.datapointName] = message;
|
|
3043
3095
|
count += 1;
|
|
3096
|
+
if (iface === this.logicIface) {
|
|
3097
|
+
this.logicValue(iface, channel, datapoint, entry.value, {ts: ts || now(), picture: true});
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3044
3100
|
if (!datapoint.startsWith('PRESS_')) {
|
|
3045
3101
|
this.callCallbacks(message);
|
|
3046
3102
|
}
|
|
3047
3103
|
});
|
|
3104
|
+
this.logicPictureDone();
|
|
3048
3105
|
this.logger.debug('lite-rpc: ' + count + ' values from the state store');
|
|
3049
3106
|
this.cachedValuesReceived = true;
|
|
3050
3107
|
this.saveValues();
|
|
@@ -3060,6 +3117,545 @@ module.exports = function (RED) {
|
|
|
3060
3117
|
}
|
|
3061
3118
|
}
|
|
3062
3119
|
|
|
3120
|
+
/**
|
|
3121
|
+
* task 32: whether this connection uses an interface the system's lite-rpc carries - one whose
|
|
3122
|
+
* checkbox put it on lite-rpc, or an addon's interface (Logic), which needs no checkbox: it is
|
|
3123
|
+
* taken the first time the stream or the system's list names it. An interface this package
|
|
3124
|
+
* knows by name (CUxD, CCU-Jack, an unticked one) keeps what its checkbox says.
|
|
3125
|
+
* @param {string} iface
|
|
3126
|
+
* @returns {boolean}
|
|
3127
|
+
*/
|
|
3128
|
+
liteWants(iface) {
|
|
3129
|
+
if (typeof iface !== 'string' || iface === '') {
|
|
3130
|
+
return false;
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
if (this.liteIfaces.includes(iface)) {
|
|
3134
|
+
return true;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
if (this.ifaceTypes[iface] || iface === META_IFACE || !this.lite || this.closing) {
|
|
3138
|
+
return false;
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
return this.liteAddonIface(iface);
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
/**
|
|
3145
|
+
* task 32: an addon's interface the system lists, followed through lite-rpc from now on: its
|
|
3146
|
+
* devices, datapoints and events are those of any interface (the value and event nodes can
|
|
3147
|
+
* address them), and Logic's are the system variables and programs as well.
|
|
3148
|
+
* @param {string} iface
|
|
3149
|
+
* @returns {boolean} whether it is followed
|
|
3150
|
+
*/
|
|
3151
|
+
liteAddonIface(iface) {
|
|
3152
|
+
if (!/^[\w.-]+$/.test(iface)) {
|
|
3153
|
+
this.logger.warn('lite-rpc: the interface "' + iface + '" has a name this package cannot follow');
|
|
3154
|
+
return false;
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
const info =
|
|
3158
|
+
(this.lite &&
|
|
3159
|
+
this.lite.box &&
|
|
3160
|
+
Array.isArray(this.lite.box.interfaces) &&
|
|
3161
|
+
this.lite.box.interfaces.find((entry) => entry.name === iface)) ||
|
|
3162
|
+
{};
|
|
3163
|
+
this.ifaceTypes[iface] = {
|
|
3164
|
+
conf: 'addon',
|
|
3165
|
+
addonIface: true,
|
|
3166
|
+
addon: info.addon || '',
|
|
3167
|
+
protocol: 'lite-rpc',
|
|
3168
|
+
init: false,
|
|
3169
|
+
ping: false,
|
|
3170
|
+
enabled: true,
|
|
3171
|
+
};
|
|
3172
|
+
this.liteIfaces.push(iface);
|
|
3173
|
+
this.lite.follow(iface);
|
|
3174
|
+
if (!this.enabledIfaces.includes(iface)) {
|
|
3175
|
+
this.enabledIfaces.push(iface);
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
this.ifaceStatus[iface] = null;
|
|
3179
|
+
const isLogic = logic.isLogicIface(iface, info);
|
|
3180
|
+
if (isLogic) {
|
|
3181
|
+
this.logicIface = iface;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
this.logger.info(
|
|
3185
|
+
'lite-rpc: the interface ' +
|
|
3186
|
+
iface +
|
|
3187
|
+
(info.addon ? ' of the addon ' + info.addon : '') +
|
|
3188
|
+
' is followed as well' +
|
|
3189
|
+
(isLogic ? ' - the system variables and programs' : ''),
|
|
3190
|
+
);
|
|
3191
|
+
this.pushStatus();
|
|
3192
|
+
return true;
|
|
3193
|
+
}
|
|
3194
|
+
|
|
3195
|
+
/**
|
|
3196
|
+
* task 32: the system's list of interfaces, read by the client at connect: every addon
|
|
3197
|
+
* interface in it is followed. Then it is known whether Logic is installed.
|
|
3198
|
+
*/
|
|
3199
|
+
liteAddonsListed() {
|
|
3200
|
+
const list = this.lite && this.lite.box && this.lite.box.interfaces;
|
|
3201
|
+
if (Array.isArray(list)) {
|
|
3202
|
+
list.forEach((entry) => this.liteWants(entry && entry.name));
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
this.liteListed = true;
|
|
3206
|
+
if (!this.logicIface) {
|
|
3207
|
+
this.logger.info(
|
|
3208
|
+
'openccu-lite: the Logic addon is not installed - the sysvar and program nodes have nothing to reach until it is',
|
|
3209
|
+
);
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
this.logicSettled();
|
|
3213
|
+
this.pushStatus();
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
/**
|
|
3217
|
+
* task 32: the Logic interface was removed (the addon uninstalled): its variables and programs
|
|
3218
|
+
* are gone, the nodes say so.
|
|
3219
|
+
*/
|
|
3220
|
+
logicGone() {
|
|
3221
|
+
const iface = this.logicIface;
|
|
3222
|
+
this.logger.warn('lite-rpc: the interface ' + iface + ' was removed - the Logic addon is gone');
|
|
3223
|
+
Object.keys(this.logicObjects).forEach((channel) => this.forgetLogicObject(channel));
|
|
3224
|
+
this.setIfaceStatus(iface, false);
|
|
3225
|
+
this.logicIface = null;
|
|
3226
|
+
this.pushStatus();
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
/** task 32: whether Logic is installed is known now (or cannot be known): waiting writes go on */
|
|
3230
|
+
logicSettled() {
|
|
3231
|
+
const waiters = this.logicWaiters;
|
|
3232
|
+
this.logicWaiters = [];
|
|
3233
|
+
waiters.forEach((resolve) => resolve());
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
/**
|
|
3237
|
+
* task 32: resolves once it is known whether Logic is installed and its picture is loaded, or
|
|
3238
|
+
* after `timeout` - a write in the first seconds after a deploy waits for it, as the CCU path
|
|
3239
|
+
* waits for the first poll of the ReGa.
|
|
3240
|
+
* @param {number} [timeout] ms
|
|
3241
|
+
* @returns {Promise<void>}
|
|
3242
|
+
*/
|
|
3243
|
+
whenLogicKnown(timeout = 30000) {
|
|
3244
|
+
if (this.liteListed || !this.lite) {
|
|
3245
|
+
return Promise.resolve();
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
return new Promise((resolve) => {
|
|
3249
|
+
const timer = setTimeout(resolve, timeout);
|
|
3250
|
+
this.logicWaiters.push(() => {
|
|
3251
|
+
clearTimeout(timer);
|
|
3252
|
+
resolve();
|
|
3253
|
+
});
|
|
3254
|
+
});
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* task 32: why system variables and programs cannot be reached on this openccu-lite system, or
|
|
3259
|
+
* null when they can (or it is not known yet).
|
|
3260
|
+
* @param {string} feature for the message, e.g. "system variables"
|
|
3261
|
+
* @returns {Error|null}
|
|
3262
|
+
*/
|
|
3263
|
+
logicUnavailable(feature) {
|
|
3264
|
+
if (this.logicIface) {
|
|
3265
|
+
return null;
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
if (!this.lite) {
|
|
3269
|
+
return new Error(
|
|
3270
|
+
feature +
|
|
3271
|
+
" are reached through the system's lite-rpc (the Logic addon's interface), which this connection does not use - see the log for why",
|
|
3272
|
+
);
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
if (this.liteListed) {
|
|
3276
|
+
return new Error(feature + ' are not available: the Logic addon is not installed on this system');
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
return null;
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
/**
|
|
3283
|
+
* task 32: what the sysvar, program and poll nodes show: the ReGaHSS's state on a CCU; on
|
|
3284
|
+
* openccu-lite the Logic interface's, or why there is none.
|
|
3285
|
+
* @returns {{iface: string, error?: string, waiting?: boolean}}
|
|
3286
|
+
*/
|
|
3287
|
+
sysvarSource() {
|
|
3288
|
+
if (!this.metaMode) {
|
|
3289
|
+
return {iface: 'ReGaHSS'};
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
if (this.logicIface) {
|
|
3293
|
+
return {iface: this.logicIface};
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
if (!this.lite) {
|
|
3297
|
+
return {iface: logic.LOGIC_IFACE, error: 'needs lite-rpc'};
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
if (this.liteListed) {
|
|
3301
|
+
return {iface: logic.LOGIC_IFACE, error: 'Logic addon not installed'};
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
return {iface: logic.LOGIC_IFACE, waiting: true};
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
/**
|
|
3308
|
+
* task 32: the description of a datapoint of a Logic channel, where it was fetched.
|
|
3309
|
+
* @param {string} channel
|
|
3310
|
+
* @param {string} datapoint
|
|
3311
|
+
* @returns {object|undefined}
|
|
3312
|
+
*/
|
|
3313
|
+
logicDescription(channel, datapoint) {
|
|
3314
|
+
const devices = this.metadata.devices[this.logicIface];
|
|
3315
|
+
const description = devices && devices[channel];
|
|
3316
|
+
if (!description) {
|
|
3317
|
+
return undefined;
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
const psKey = this.paramsetName(this.logicIface, description, 'VALUES');
|
|
3321
|
+
const paramset = psKey && this.paramsetDescriptions[psKey];
|
|
3322
|
+
return paramset ? paramset[datapoint] : undefined;
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
/**
|
|
3326
|
+
* task 32: a variable's shape (type, list, unit, limits) comes from its VALUE description,
|
|
3327
|
+
* which may be fetched after the value came in (the start's picture): once descriptions
|
|
3328
|
+
* arrive, the entries that were made without one take it. Once per burst.
|
|
3329
|
+
*/
|
|
3330
|
+
refreshLogicShapesSoon() {
|
|
3331
|
+
if (this.logicShapeTimer || !this.logicIface) {
|
|
3332
|
+
return;
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
this.logicShapeTimer = setImmediate(() => {
|
|
3336
|
+
this.logicShapeTimer = null;
|
|
3337
|
+
Object.keys(this.logicObjects).forEach((channel) => {
|
|
3338
|
+
const entry = this.logicObjects[channel];
|
|
3339
|
+
if (entry.type !== 'SYSVAR') {
|
|
3340
|
+
return;
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
const description = this.logicDescription(channel, 'VALUE');
|
|
3344
|
+
if (!description) {
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
const shape = logic.variableShape(description, entry.value);
|
|
3349
|
+
Object.assign(entry, {
|
|
3350
|
+
valueType: shape.valueType,
|
|
3351
|
+
enum: shape.enum,
|
|
3352
|
+
unit: shape.unit,
|
|
3353
|
+
valueEnum: shape.enum[Number(entry.value)],
|
|
3354
|
+
});
|
|
3355
|
+
if (shape.min !== undefined) {
|
|
3356
|
+
entry.min = shape.min;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
if (shape.max !== undefined) {
|
|
3360
|
+
entry.max = shape.max;
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
});
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
/**
|
|
3367
|
+
* task 32: a datapoint of Logic's interface - a variable's VALUE, a program's ACTIVE or
|
|
3368
|
+
* LAST_RUN - into the tables the sysvar and program nodes read (this.sysvar, this.program).
|
|
3369
|
+
* @param {string} iface
|
|
3370
|
+
* @param {string} channel
|
|
3371
|
+
* @param {string} datapoint
|
|
3372
|
+
* @param {*} value
|
|
3373
|
+
* @param {{ts: number, picture?: boolean}} options picture: from the state store at connect
|
|
3374
|
+
*/
|
|
3375
|
+
logicValue(iface, channel, datapoint, value, {ts, picture = false}) {
|
|
3376
|
+
const ref = logic.parseAddress(channel);
|
|
3377
|
+
if (!ref) {
|
|
3378
|
+
return;
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
if (ref.kind === 'variable') {
|
|
3382
|
+
if (datapoint === 'VALUE') {
|
|
3383
|
+
this.updateLogicVariable(ref, value, ts, picture);
|
|
3384
|
+
}
|
|
3385
|
+
} else if (datapoint === 'ACTIVE') {
|
|
3386
|
+
this.updateLogicProgram(ref, {active: Boolean(value)}, ts, picture);
|
|
3387
|
+
} else if (datapoint === 'LAST_RUN') {
|
|
3388
|
+
this.updateLogicProgram(ref, {ran: true}, ts, picture);
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
/**
|
|
3393
|
+
* task 32: the entry of a Logic object under its current name in `table` (this.sysvar or
|
|
3394
|
+
* this.program): a rename moves it, a name another object holds is not taken over.
|
|
3395
|
+
* @param {object} table
|
|
3396
|
+
* @param {object} ref from logic.parseAddress()
|
|
3397
|
+
* @returns {{entry: object|undefined, name: string}}
|
|
3398
|
+
*/
|
|
3399
|
+
logicEntry(table, ref) {
|
|
3400
|
+
const name = logic.nameOf(this.channelNames, ref);
|
|
3401
|
+
const entry = this.logicObjects[ref.channel];
|
|
3402
|
+
if (entry && entry.name !== name) {
|
|
3403
|
+
if (table[entry.name] === entry) {
|
|
3404
|
+
delete table[entry.name];
|
|
3405
|
+
}
|
|
3406
|
+
|
|
3407
|
+
entry.name = name;
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
if (entry) {
|
|
3411
|
+
table[name] = entry;
|
|
3412
|
+
}
|
|
3413
|
+
|
|
3414
|
+
return {entry, name};
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
/**
|
|
3418
|
+
* task 32: a system variable's value. A write is an event at every write, so a value that did
|
|
3419
|
+
* not change is an update (change false), as the CCU's poll reported a new timestamp.
|
|
3420
|
+
* @param {object} ref
|
|
3421
|
+
* @param {*} value
|
|
3422
|
+
* @param {number} ts
|
|
3423
|
+
* @param {boolean} picture
|
|
3424
|
+
*/
|
|
3425
|
+
updateLogicVariable(ref, value, ts, picture) {
|
|
3426
|
+
const {entry, name} = this.logicEntry(this.sysvar, ref);
|
|
3427
|
+
const shape = logic.variableShape(this.logicDescription(ref.channel, 'VALUE'), value);
|
|
3428
|
+
if (entry && picture && entry.ts >= ts) {
|
|
3429
|
+
// the picture again (a resync): nothing new
|
|
3430
|
+
return;
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
const isNew = !entry;
|
|
3434
|
+
const sysvar = entry || {
|
|
3435
|
+
topic: '',
|
|
3436
|
+
ccu: this.host,
|
|
3437
|
+
iface: this.logicIface,
|
|
3438
|
+
type: 'SYSVAR',
|
|
3439
|
+
name,
|
|
3440
|
+
info: '',
|
|
3441
|
+
key: ref.key,
|
|
3442
|
+
address: ref.channel,
|
|
3443
|
+
};
|
|
3444
|
+
Object.assign(sysvar, {
|
|
3445
|
+
payload: value,
|
|
3446
|
+
value,
|
|
3447
|
+
valueType: shape.valueType,
|
|
3448
|
+
enum: shape.enum,
|
|
3449
|
+
unit: shape.unit,
|
|
3450
|
+
valueEnum: shape.enum[Number(value)],
|
|
3451
|
+
valuePrevious: isNew ? undefined : sysvar.value,
|
|
3452
|
+
valueEnumPrevious: isNew ? undefined : sysvar.valueEnum,
|
|
3453
|
+
ts,
|
|
3454
|
+
tsPrevious: isNew ? undefined : sysvar.ts,
|
|
3455
|
+
lc: isNew || sysvar.value !== value ? ts : sysvar.lc,
|
|
3456
|
+
lcPrevious: isNew ? undefined : sysvar.lc,
|
|
3457
|
+
change: isNew ? false : sysvar.value !== value,
|
|
3458
|
+
// a value from the start is the cache; the first event of a variable made later is an event
|
|
3459
|
+
cache: isNew && picture,
|
|
3460
|
+
});
|
|
3461
|
+
if (shape.min !== undefined) {
|
|
3462
|
+
sysvar.min = shape.min;
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
if (shape.max !== undefined) {
|
|
3466
|
+
sysvar.max = shape.max;
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
if (isNew) {
|
|
3470
|
+
this.logicObjects[ref.channel] = sysvar;
|
|
3471
|
+
this.sysvar[name] = sysvar;
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3474
|
+
this.dispatchSysvar(name);
|
|
3475
|
+
}
|
|
3476
|
+
|
|
3477
|
+
/**
|
|
3478
|
+
* task 32: a program's state: ACTIVE, and LAST_RUN as the time it last ran (the CCU's
|
|
3479
|
+
* ProgramLastExecuteTime, `ts`). The state store's picture is said once per program, after
|
|
3480
|
+
* both datapoints are in (logicPictureDone).
|
|
3481
|
+
* @param {object} ref
|
|
3482
|
+
* @param {{active?: boolean, ran?: boolean}} change
|
|
3483
|
+
* @param {number} ts
|
|
3484
|
+
* @param {boolean} picture
|
|
3485
|
+
*/
|
|
3486
|
+
updateLogicProgram(ref, change, ts, picture) {
|
|
3487
|
+
const {entry, name} = this.logicEntry(this.program, ref);
|
|
3488
|
+
const program = entry || {
|
|
3489
|
+
ccu: this.host,
|
|
3490
|
+
iface: this.logicIface,
|
|
3491
|
+
type: 'PROGRAM',
|
|
3492
|
+
name,
|
|
3493
|
+
key: ref.key,
|
|
3494
|
+
address: ref.channel,
|
|
3495
|
+
};
|
|
3496
|
+
const previous = {active: program.active, ts: program.ts};
|
|
3497
|
+
if (change.active !== undefined) {
|
|
3498
|
+
program.active = change.active;
|
|
3499
|
+
program.payload = change.active;
|
|
3500
|
+
program.value = change.active;
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
if (change.ran) {
|
|
3504
|
+
program.ts = ts;
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
if (!entry) {
|
|
3508
|
+
this.logicObjects[ref.channel] = program;
|
|
3509
|
+
this.program[name] = program;
|
|
3510
|
+
program.pictured = picture;
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
if (picture) {
|
|
3514
|
+
program.pictured = true;
|
|
3515
|
+
return;
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
if (previous.active === program.active && previous.ts === program.ts) {
|
|
3519
|
+
return;
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
program.activePrevious = previous.active;
|
|
3523
|
+
program.tsPrevious = previous.ts;
|
|
3524
|
+
this.dispatchProgram(name);
|
|
3525
|
+
}
|
|
3526
|
+
|
|
3527
|
+
/**
|
|
3528
|
+
* task 32: the state store's picture is in: each program once to its nodes, as the CCU's
|
|
3529
|
+
* first poll does.
|
|
3530
|
+
*/
|
|
3531
|
+
logicPictureDone() {
|
|
3532
|
+
Object.keys(this.program).forEach((name) => {
|
|
3533
|
+
const program = this.program[name];
|
|
3534
|
+
if (program.pictured) {
|
|
3535
|
+
delete program.pictured;
|
|
3536
|
+
this.dispatchProgram(name);
|
|
3537
|
+
}
|
|
3538
|
+
});
|
|
3539
|
+
}
|
|
3540
|
+
|
|
3541
|
+
/**
|
|
3542
|
+
* task 32: the names changed - a variable or program that was renamed (or whose name came
|
|
3543
|
+
* after its value) is found by its new name; a node waiting for it gets the value it would
|
|
3544
|
+
* have got at the start.
|
|
3545
|
+
*/
|
|
3546
|
+
relabelLogic() {
|
|
3547
|
+
Object.keys(this.logicObjects).forEach((channel) => {
|
|
3548
|
+
const entry = this.logicObjects[channel];
|
|
3549
|
+
const ref = logic.parseAddress(channel);
|
|
3550
|
+
const before = entry.name;
|
|
3551
|
+
const {name} = this.logicEntry(entry.type === 'SYSVAR' ? this.sysvar : this.program, ref);
|
|
3552
|
+
if (name === before) {
|
|
3553
|
+
return;
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
this.logger.debug(
|
|
3557
|
+
'Logic',
|
|
3558
|
+
channel,
|
|
3559
|
+
'is',
|
|
3560
|
+
JSON.stringify(name),
|
|
3561
|
+
'now (was',
|
|
3562
|
+
JSON.stringify(before) + ')',
|
|
3563
|
+
);
|
|
3564
|
+
if (entry.type === 'SYSVAR') {
|
|
3565
|
+
const {cache, change} = entry;
|
|
3566
|
+
entry.cache = true;
|
|
3567
|
+
entry.change = false;
|
|
3568
|
+
this.dispatchSysvar(name);
|
|
3569
|
+
entry.cache = cache;
|
|
3570
|
+
entry.change = change;
|
|
3571
|
+
} else {
|
|
3572
|
+
this.dispatchProgram(name);
|
|
3573
|
+
}
|
|
3574
|
+
});
|
|
3575
|
+
}
|
|
3576
|
+
|
|
3577
|
+
/**
|
|
3578
|
+
* task 32: a variable or program deleted in Logic (its device, or its value channel).
|
|
3579
|
+
* @param {string} address
|
|
3580
|
+
*/
|
|
3581
|
+
forgetLogicObject(address) {
|
|
3582
|
+
const channel = String(address).includes(':') ? address : address + ':1';
|
|
3583
|
+
const entry = this.logicObjects[channel];
|
|
3584
|
+
if (!entry) {
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
|
|
3588
|
+
delete this.logicObjects[channel];
|
|
3589
|
+
const table = entry.type === 'SYSVAR' ? this.sysvar : this.program;
|
|
3590
|
+
if (table[entry.name] === entry) {
|
|
3591
|
+
delete table[entry.name];
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
/**
|
|
3596
|
+
* task 32: a write to a system variable on openccu-lite - setValue of VALUE on Logic's
|
|
3597
|
+
* interface, cast as the CCU path casts it; the addon refuses what the variable does not take.
|
|
3598
|
+
* @param {string} name
|
|
3599
|
+
* @param {*} value
|
|
3600
|
+
* @returns {Promise<object>} the variable
|
|
3601
|
+
*/
|
|
3602
|
+
setLogicVariable(name, value) {
|
|
3603
|
+
return this.whenLogicKnown().then(() => {
|
|
3604
|
+
const unavailable = this.logicUnavailable('system variables');
|
|
3605
|
+
if (unavailable) {
|
|
3606
|
+
throw unavailable;
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
const sysvar = this.sysvar[name];
|
|
3610
|
+
if (!sysvar || sysvar.iface !== this.logicIface) {
|
|
3611
|
+
throw new Error('setVariable ' + name + ' unknown');
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
const shape = logic.variableShape(this.logicDescription(sysvar.address, 'VALUE'), sysvar.value);
|
|
3615
|
+
const cast = logic.castVariable(value, shape);
|
|
3616
|
+
this.logger.debug('setVariable', name, sysvar.address, JSON.stringify(cast));
|
|
3617
|
+
return this.methodCall(this.logicIface, 'setValue', [sysvar.address, 'VALUE', cast]).then(() => sysvar);
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
/**
|
|
3622
|
+
* task 32: a program on openccu-lite: ACTIVE, or RUN_THEN - what the CCU's ProgramExecute()
|
|
3623
|
+
* does, the first "Then" without the conditions (the addon's interface calls it the CCU's
|
|
3624
|
+
* "Start"); RUN would evaluate the conditions first.
|
|
3625
|
+
* @param {string} name
|
|
3626
|
+
* @param {string} datapoint ACTIVE | RUN_THEN
|
|
3627
|
+
* @param {boolean} value
|
|
3628
|
+
* @returns {Promise<object>} the program
|
|
3629
|
+
*/
|
|
3630
|
+
logicProgramCall(name, datapoint, value) {
|
|
3631
|
+
return this.whenLogicKnown().then(() => {
|
|
3632
|
+
const unavailable = this.logicUnavailable('programs');
|
|
3633
|
+
if (unavailable) {
|
|
3634
|
+
throw unavailable;
|
|
3635
|
+
}
|
|
3636
|
+
|
|
3637
|
+
const program = this.program[name];
|
|
3638
|
+
if (!program || program.iface !== this.logicIface) {
|
|
3639
|
+
throw new Error(
|
|
3640
|
+
(datapoint === 'ACTIVE' ? 'programActive ' : 'programExecute ') + name + ' not found',
|
|
3641
|
+
);
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
return this.methodCall(this.logicIface, 'setValue', [program.address, datapoint, value]).then(() => {
|
|
3645
|
+
if (datapoint === 'ACTIVE') {
|
|
3646
|
+
program.activePrevious = program.active;
|
|
3647
|
+
program.active = value;
|
|
3648
|
+
program.payload = value;
|
|
3649
|
+
program.value = value;
|
|
3650
|
+
} else {
|
|
3651
|
+
program.ts = now();
|
|
3652
|
+
}
|
|
3653
|
+
|
|
3654
|
+
return program;
|
|
3655
|
+
});
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3063
3659
|
/**
|
|
3064
3660
|
*
|
|
3065
3661
|
* @param iface
|
|
@@ -3328,7 +3924,10 @@ module.exports = function (RED) {
|
|
|
3328
3924
|
*/
|
|
3329
3925
|
rereadDevices() {
|
|
3330
3926
|
const ifaces = Object.keys(this.ifaceTypes).filter(
|
|
3331
|
-
(iface) =>
|
|
3927
|
+
(iface) =>
|
|
3928
|
+
this.ifaceTypes[iface].enabled &&
|
|
3929
|
+
(this.ifaceTypes[iface].init || this.ifaceTypes[iface].addonIface) &&
|
|
3930
|
+
iface !== 'CUxD',
|
|
3332
3931
|
);
|
|
3333
3932
|
this.logger.info('re-reading device data:', ifaces.join(', '));
|
|
3334
3933
|
return Promise.all(
|
|
@@ -3859,6 +4458,10 @@ module.exports = function (RED) {
|
|
|
3859
4458
|
this.newParamsetDescription = true;
|
|
3860
4459
|
this.paramsetDescriptions[name] = res;
|
|
3861
4460
|
this.paramsetNew[name] = res;
|
|
4461
|
+
if (iface === this.logicIface) {
|
|
4462
|
+
this.refreshLogicShapesSoon();
|
|
4463
|
+
}
|
|
4464
|
+
|
|
3862
4465
|
this.paramsetFileMissing.delete(name);
|
|
3863
4466
|
// saved once the queue is through (or at stop): every save rewrites the
|
|
3864
4467
|
// whole file, 14 MB and more - one every 30 descriptions was a dozen
|
|
@@ -4012,6 +4615,9 @@ module.exports = function (RED) {
|
|
|
4012
4615
|
*/
|
|
4013
4616
|
deleteDevice(iface, device) {
|
|
4014
4617
|
this.logger.debug('deleteDevice', iface, device);
|
|
4618
|
+
if (iface === this.logicIface) {
|
|
4619
|
+
this.forgetLogicObject(device);
|
|
4620
|
+
}
|
|
4015
4621
|
const known = this.metadata.devices[iface] && this.metadata.devices[iface][device];
|
|
4016
4622
|
if (this.metadata.devices[iface]) {
|
|
4017
4623
|
delete this.metadata.devices[iface][device];
|
|
@@ -4220,7 +4826,7 @@ module.exports = function (RED) {
|
|
|
4220
4826
|
return idInit;
|
|
4221
4827
|
}
|
|
4222
4828
|
|
|
4223
|
-
const match = idInit.match(/^nr_[\da-zA-Z]{6}_([
|
|
4829
|
+
const match = idInit.match(/^nr_[\da-zA-Z]{6}_([\w.-]+)$/);
|
|
4224
4830
|
return match && this.ifaceTypes[match[1]] ? match[1] : null;
|
|
4225
4831
|
}
|
|
4226
4832
|
|
|
@@ -4725,6 +5331,11 @@ module.exports = function (RED) {
|
|
|
4725
5331
|
return;
|
|
4726
5332
|
}
|
|
4727
5333
|
|
|
5334
|
+
if (iface === this.logicIface) {
|
|
5335
|
+
// task 32: a variable's or a program's datapoint is the sysvar or program nodes' event too
|
|
5336
|
+
this.logicValue(iface, channel, datapoint, payload, {ts: now()});
|
|
5337
|
+
}
|
|
5338
|
+
|
|
4728
5339
|
//this.logger.trace('publishEvent', JSON.stringify(params));
|
|
4729
5340
|
|
|
4730
5341
|
const message = this.createMessage(iface, channel, datapoint, payload, {
|
package/nodes/ccu-poll.js
CHANGED
|
@@ -18,8 +18,9 @@ module.exports = function (RED) {
|
|
|
18
18
|
|
|
19
19
|
this.on('input', (message, send, done) => {
|
|
20
20
|
if (this.ccu.metaMode) {
|
|
21
|
-
// openccu-lite has no ReGaHSS -
|
|
22
|
-
|
|
21
|
+
// openccu-lite has no ReGaHSS (B-17); the Logic addon's variables and programs
|
|
22
|
+
// arrive as events, there is nothing to poll (task 32)
|
|
23
|
+
done(this.ccu.logicUnavailable('system variables and programs') || undefined);
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -30,7 +31,7 @@ module.exports = function (RED) {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
setStatus(data) {
|
|
33
|
-
statusHelper(this, data);
|
|
34
|
+
statusHelper.sysvar(this, data);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
package/nodes/ccu-program.js
CHANGED
package/nodes/ccu-sysvar.js
CHANGED
package/nodes/lib/lite.js
CHANGED
|
@@ -277,7 +277,8 @@ class LiteConnection {
|
|
|
277
277
|
* @param {string} options.token the credential
|
|
278
278
|
* @param {boolean} [options.insecure] accept any certificate
|
|
279
279
|
* @param {string} [options.fingerprint256] accept exactly this certificate (pinned at pairing; wins over insecure)
|
|
280
|
-
* @param {string[]} options.interfaces the interfaces
|
|
280
|
+
* @param {string[]} options.interfaces the interfaces the connection uses (the enabled ones lite-rpc carries;
|
|
281
|
+
* addon interfaces are added with follow()); the client itself follows all the system lists
|
|
281
282
|
* @param {function(string): string} options.initId the init id the connection's callback table expects per interface
|
|
282
283
|
* @param {function(string, *, Array, Function)} options.onCallback (method, err, params, answer): a callback server's call
|
|
283
284
|
* @param {function(string, string)} options.onInterface (iface, state): up | down | restarted | added | removed
|
|
@@ -312,6 +313,16 @@ class LiteConnection {
|
|
|
312
313
|
return this.interfaces.includes(iface);
|
|
313
314
|
}
|
|
314
315
|
|
|
316
|
+
/**
|
|
317
|
+
* task 32: an interface the connection uses from now on (an addon's, named by the system).
|
|
318
|
+
* @param {string} iface
|
|
319
|
+
*/
|
|
320
|
+
follow(iface) {
|
|
321
|
+
if (!this.interfaces.includes(iface)) {
|
|
322
|
+
this.interfaces.push(iface);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
315
326
|
/**
|
|
316
327
|
* Opens the client. Resolves once the first picture is loaded. occulite-client (0.4) does not
|
|
317
328
|
* try a failed connect again (its streams only reconnect once connected), so a system that
|
|
@@ -364,7 +375,9 @@ class LiteConnection {
|
|
|
364
375
|
url: this.options.url,
|
|
365
376
|
auth: {token: this.options.token},
|
|
366
377
|
transport: nodeTransport(trustOf(this.options)),
|
|
367
|
-
|
|
378
|
+
// task 32: no interface filter - the client follows every interface the system lists, so
|
|
379
|
+
// an addon's interface (Logic) is seen, also one installed later (a filter would hide its
|
|
380
|
+
// `interface added`); the connection takes what it uses (initId)
|
|
368
381
|
values: true,
|
|
369
382
|
meta: Boolean(this.options.meta),
|
|
370
383
|
devices: true,
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* task 32: system variables and programs on openccu-lite. The system has no ReGaHSS; the addon
|
|
3
|
+
* Logic (lite-addon-logic) offers them as devices of an interface of its own, which the system's
|
|
4
|
+
* lite-rpc carries like the radio interfaces:
|
|
5
|
+
*
|
|
6
|
+
* system variable `regen` device var-regen (LOGIC-VARIABLE), channel var-regen:1, VALUE
|
|
7
|
+
* (an alarm variable also ACKNOWLEDGE, COUNT, FIRST, LAST)
|
|
8
|
+
* program `markise` device prg-markise (LOGIC-PROGRAM), channel prg-markise:1,
|
|
9
|
+
* ACTIVE, RUN (with the conditions), RUN_THEN (the CCU's "Start"),
|
|
10
|
+
* LAST_RUN (an event at every run)
|
|
11
|
+
*
|
|
12
|
+
* The address is the object's key and stays across a rename; the name is the system's metadata
|
|
13
|
+
* name of the channel (or the device), which the addon writes. The sysvar and program nodes find
|
|
14
|
+
* an object by that name, as they did by the ReGa name on a CCU, so a flow written for a CCU
|
|
15
|
+
* keeps working after the switch once the variables and programs were imported.
|
|
16
|
+
*
|
|
17
|
+
* Pure helpers, no connection state: the connection (ccu-connection.js) keeps the tables.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** the interface's name as lite-addon-logic registers it */
|
|
21
|
+
const LOGIC_IFACE = 'Logic';
|
|
22
|
+
|
|
23
|
+
/** the addon's id, `addon` in GET /api/rpc/v1/interfaces */
|
|
24
|
+
const LOGIC_ADDON = 'logic';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Whether an interface the system lists is Logic's: by its addon id, else by its name.
|
|
28
|
+
* @param {string} name
|
|
29
|
+
* @param {{addon?: string}} [info] the entry of GET /api/rpc/v1/interfaces
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
function isLogicIface(name, info) {
|
|
33
|
+
if (info && info.addon) {
|
|
34
|
+
return info.addon === LOGIC_ADDON;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return name === LOGIC_IFACE;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* What a Logic address stands for: a variable's or a program's value channel (`:1`), else null.
|
|
42
|
+
* @param {string} channel e.g. var-regen:1
|
|
43
|
+
* @returns {{kind: 'variable'|'program', key: string, device: string, channel: string}|null}
|
|
44
|
+
*/
|
|
45
|
+
function parseAddress(channel) {
|
|
46
|
+
const match = /^(var|prg)-(.+):1$/.exec(String(channel || ''));
|
|
47
|
+
if (!match) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
kind: match[1] === 'var' ? 'variable' : 'program',
|
|
53
|
+
key: match[2],
|
|
54
|
+
device: match[1] + '-' + match[2],
|
|
55
|
+
channel: match[1] + '-' + match[2] + ':1',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The name a node finds an object by: the channel's metadata name, else the device's, else its key
|
|
61
|
+
* (a connection without a credential for the names).
|
|
62
|
+
* @param {object} names channelNames, by address
|
|
63
|
+
* @param {{key: string, device: string, channel: string}} ref from parseAddress()
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
function nameOf(names, ref) {
|
|
67
|
+
const map = names || {};
|
|
68
|
+
return map[ref.channel] || map[ref.device] || ref.key;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The CCU's shape of a system variable (homematic-rega's getVariables) from the description of
|
|
73
|
+
* Logic's VALUE datapoint: `valueType` boolean | number | string, `enum` (the texts for false and
|
|
74
|
+
* true of a logic value, the entries of a value list), `unit`, and the Homematic type.
|
|
75
|
+
* Without a description (not fetched yet) the type follows the value.
|
|
76
|
+
* @param {object} [description] the paramset description of VALUE
|
|
77
|
+
* @param {*} [value] the current value, for the fallback
|
|
78
|
+
* @returns {{valueType: string, enum: string[], unit: string, type: string|undefined, min?: number, max?: number}}
|
|
79
|
+
*/
|
|
80
|
+
function variableShape(description, value) {
|
|
81
|
+
const list = description && Array.isArray(description.VALUE_LIST) ? description.VALUE_LIST.map(String) : [];
|
|
82
|
+
const unit = (description && typeof description.UNIT === 'string' && description.UNIT) || '';
|
|
83
|
+
const type = description && description.TYPE;
|
|
84
|
+
const shape = {valueType: 'number', enum: [], unit, type};
|
|
85
|
+
switch (type) {
|
|
86
|
+
case 'BOOL':
|
|
87
|
+
case 'ACTION':
|
|
88
|
+
shape.valueType = 'boolean';
|
|
89
|
+
shape.enum = list;
|
|
90
|
+
break;
|
|
91
|
+
case 'STRING':
|
|
92
|
+
shape.valueType = 'string';
|
|
93
|
+
break;
|
|
94
|
+
case 'ENUM':
|
|
95
|
+
shape.enum = list;
|
|
96
|
+
break;
|
|
97
|
+
case 'FLOAT':
|
|
98
|
+
case 'INTEGER':
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
if (typeof value === 'boolean') {
|
|
102
|
+
shape.valueType = 'boolean';
|
|
103
|
+
} else if (typeof value === 'string') {
|
|
104
|
+
shape.valueType = 'string';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (description && typeof description.MIN === 'number' && shape.valueType === 'number' && type !== 'ENUM') {
|
|
109
|
+
shape.min = description.MIN;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (description && typeof description.MAX === 'number' && shape.valueType === 'number' && type !== 'ENUM') {
|
|
113
|
+
shape.max = description.MAX;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return shape;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A value for Logic's VALUE, cast the way the CCU path casts a variable (castSysvar): a logic
|
|
121
|
+
* value takes true/false, a number, or one of its two texts; a value list its entry's number or
|
|
122
|
+
* text; a number a number; a string a string. A FLOAT goes out as homematic-xmlrpc's
|
|
123
|
+
* `{explicitDouble}`, which lite.js turns into lite-rpc's double. Limits are the addon's to check:
|
|
124
|
+
* it refuses a number outside them and an entry the list does not have, and the refusal is said.
|
|
125
|
+
* @param {*} value
|
|
126
|
+
* @param {{valueType: string, enum: string[], type?: string}} shape from variableShape()
|
|
127
|
+
* @returns {*}
|
|
128
|
+
*/
|
|
129
|
+
function castVariable(value, shape) {
|
|
130
|
+
const list = shape.enum || [];
|
|
131
|
+
switch (shape.valueType) {
|
|
132
|
+
case 'boolean':
|
|
133
|
+
if (typeof value === 'string') {
|
|
134
|
+
if (list.includes(value)) {
|
|
135
|
+
return list.indexOf(value) === 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (value === 'false' || value === '0') {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return Boolean(value);
|
|
144
|
+
case 'string':
|
|
145
|
+
return value === null || value === undefined ? '' : String(value);
|
|
146
|
+
default: {
|
|
147
|
+
if (typeof value === 'string' && list.includes(value)) {
|
|
148
|
+
return list.indexOf(value);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (typeof value === 'boolean') {
|
|
152
|
+
value = value ? 1 : 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const number = Number.parseFloat(value);
|
|
156
|
+
const safe = Number.isFinite(number) ? number : 0;
|
|
157
|
+
if (shape.type === 'ENUM' || shape.type === 'INTEGER') {
|
|
158
|
+
return Math.round(safe);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (shape.type === 'FLOAT') {
|
|
162
|
+
return {explicitDouble: safe};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return safe;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
module.exports = {
|
|
171
|
+
LOGIC_IFACE,
|
|
172
|
+
LOGIC_ADDON,
|
|
173
|
+
isLogicIface,
|
|
174
|
+
parseAddress,
|
|
175
|
+
nameOf,
|
|
176
|
+
variableShape,
|
|
177
|
+
castVariable,
|
|
178
|
+
};
|
package/nodes/lib/status.js
CHANGED
|
@@ -63,3 +63,34 @@ module.exports = (that, data) => {
|
|
|
63
63
|
that.currentStatus = 'red';
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* task 32: the status of a node of system variables or programs (sysvar, program, poll): on a CCU
|
|
69
|
+
* the ReGaHSS's, on openccu-lite the Logic interface's - or why there is none (the addon is not
|
|
70
|
+
* installed, the connection does not use lite-rpc).
|
|
71
|
+
* @param {object} that the node; `that.ccu.sysvarSource()` decides
|
|
72
|
+
* @param {object} data what the connection pushes
|
|
73
|
+
*/
|
|
74
|
+
module.exports.sysvar = (that, data) => {
|
|
75
|
+
const source = that.ccu && typeof that.ccu.sysvarSource === 'function' ? that.ccu.sysvarSource() : {};
|
|
76
|
+
if (source.iface) {
|
|
77
|
+
that.iface = source.iface;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (source.error) {
|
|
81
|
+
if (that.currentStatus !== 'error:' + source.error) {
|
|
82
|
+
that.status({fill: 'red', shape: 'ring', text: source.error});
|
|
83
|
+
that.currentStatus = 'error:' + source.error;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (source.waiting) {
|
|
90
|
+
that.status(WAITING);
|
|
91
|
+
that.currentStatus = 'waiting';
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports(that, data);
|
|
96
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script type="text/html" data-help-name="ccu-poll">
|
|
2
2
|
<p>Führt einen sofortigen Poll von ReGaHSS Systemvariablen durch.</p>
|
|
3
|
+
<p><b>openccu-lite:</b> die Variablen und Programme des Addons <i>Logic</i> kommen als Ereignisse; es gibt nichts
|
|
4
|
+
zu pollen, eine Nachricht bewirkt nichts.</p>
|
|
3
5
|
<p>Dieser Node ist dazu vorgesehen die Änderung von Systemvariablen mit möglichst geringer Verzögerung zu empfangen.
|
|
4
6
|
Hierzu kann man ein Programm auf der CCU anlegen dass bei Änderung von Variablen einen virtuellen Taster betätigt.
|
|
5
7
|
In Node-RED wird dann ein <i>rpc event</i> oder <i>value</i> Node so konfiguriert dass er diese
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script type="text/html" data-help-name="ccu-program">
|
|
2
2
|
<p>Führt ein ReGaHSS Programm aus.</p>
|
|
3
|
+
<p><b>openccu-lite:</b> die Programme kommen vom Addon <i>Logic</i> über die lite-rpc des Systems (Schnittstelle
|
|
4
|
+
<code>Logic</code>). Ein boolean schaltet <code>ACTIVE</code> des Programms; alles andere startet es wie auf der
|
|
5
|
+
CCU - das erste <i>Dann</i>, ohne die Bedingungen zu prüfen (<code>RUN_THEN</code>). Der Ausgang folgt
|
|
6
|
+
<code>ACTIVE</code> und jedem Lauf des Programms. Ohne das Addon zeigt der Node <i>Logic addon not
|
|
7
|
+
installed</i>.</p>
|
|
3
8
|
<h3>Inputs</h3>
|
|
4
9
|
<dl class="message-properties">
|
|
5
10
|
<dt>payload
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<script type="text/html" data-help-name="ccu-sysvar">
|
|
2
2
|
<p>Setzen und lesen von ReGaHSS Systemvariablen.</p>
|
|
3
|
+
<p><b>openccu-lite:</b> das System hat keine ReGaHSS; die Systemvariablen kommen vom Addon <i>Logic</i>, das sie
|
|
4
|
+
als Geräte seiner Schnittstelle <code>Logic</code> über die lite-rpc des Systems anbietet. Der Node findet eine
|
|
5
|
+
Variable wie auf der CCU über ihren Namen und bekommt bei jedem Schreiben ein Ereignis (<i>Nur geänderte Werte ausgeben</i>
|
|
6
|
+
lässt das Schreiben desselben Werts weg). Die Verbindung braucht lite-rpc (ein Token mit <code>rpc:read</code>
|
|
7
|
+
und <code>rpc:operate</code>, oder RedMatic auf dem System selbst); ohne das Addon zeigt der Node
|
|
8
|
+
<i>Logic addon not installed</i>. <code>msg.iface</code> ist <code>Logic</code>, <code>msg.key</code> der
|
|
9
|
+
Schlüssel der Variablen und <code>msg.address</code> ihr Kanal (<code>var-<key>:1</code>).</p>
|
|
3
10
|
<h3>Inputs</h3>
|
|
4
11
|
<dl class="message-properties">
|
|
5
12
|
<dt>payload
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script type="text/html" data-help-name="ccu-poll">
|
|
2
2
|
<p>Triggers an immediate polling of Sysvars from ReGaHSS.</p>
|
|
3
|
+
<p><b>openccu-lite:</b> the <i>Logic</i> addon's variables and programs arrive as events; there is nothing to
|
|
4
|
+
poll, a message does nothing.</p>
|
|
3
5
|
<p>This node is intended to receive changes of variables with lower latency. You can create a CCU Program that
|
|
4
6
|
reacts to variable changes by pressing a virtual button, this virtual button presses can then be received by a
|
|
5
7
|
<i>value</i> or <i>rpc event</i> node that triggers an update of the variables through the <i>ccu poll</i>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script type="text/html" data-help-name="ccu-program">
|
|
2
2
|
<p>Executes a ReGaHSS program.</p>
|
|
3
|
+
<p><b>openccu-lite:</b> the programs come from the <i>Logic</i> addon through the system's lite-rpc (interface
|
|
4
|
+
<code>Logic</code>). A boolean switches the program's <code>ACTIVE</code>; anything else starts it as on a CCU -
|
|
5
|
+
the first <i>Then</i> without looking at the conditions (<code>RUN_THEN</code>). The output follows
|
|
6
|
+
<code>ACTIVE</code> and every run of the program. Without the addon the node shows <i>Logic addon not
|
|
7
|
+
installed</i>.</p>
|
|
3
8
|
<h3>Inputs</h3>
|
|
4
9
|
<dl class="message-properties">
|
|
5
10
|
<dt>payload
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<script type="text/html" data-help-name="ccu-sysvar">
|
|
2
2
|
<p>Set and read ReGaHSS system variables.</p>
|
|
3
|
+
<p><b>openccu-lite:</b> the system has no ReGaHSS; the system variables come from the <i>Logic</i> addon,
|
|
4
|
+
which offers them as devices of its interface <code>Logic</code> through the system's lite-rpc. The node finds a
|
|
5
|
+
variable by its name, as on a CCU, and gets an event at every write (<i>Emit changed values only</i> leaves out a write of
|
|
6
|
+
the same value). The connection needs lite-rpc (a token with <code>rpc:read</code> and <code>rpc:operate</code>,
|
|
7
|
+
or RedMatic on the system itself); without the addon the node shows <i>Logic addon not installed</i>.
|
|
8
|
+
<code>msg.iface</code> is <code>Logic</code>, <code>msg.key</code> the variable's key and
|
|
9
|
+
<code>msg.address</code> its channel (<code>var-<key>:1</code>).</p>
|
|
3
10
|
<h3>Inputs</h3>
|
|
4
11
|
<dl class="message-properties">
|
|
5
12
|
<dt>payload
|