node-red-contrib-ccu 4.10.0 → 4.10.2

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 CHANGED
@@ -5,6 +5,46 @@ 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.10.2 (2026-11-20)
9
+
10
+ ### Fixed
11
+
12
+ - **openccu-lite: with the ReGaHSS unticked in the connection node, the
13
+ connection did not notice it was talking to openccu-lite.** The check for
14
+ openccu-lite's metadata API only ran while the ReGaHSS was ticked. Without
15
+ it the interfaces were connected directly with callbacks instead of through
16
+ lite-rpc, and no names were loaded. The check now runs regardless of the
17
+ checkbox; only the ReGaHSS itself (names, rooms and polling on a CCU) stays
18
+ behind it. On openccu-lite the checkbox has no effect: names come from the
19
+ system's metadata API and the interfaces go through lite-rpc either way.
20
+ - **ccu-homeassistant: the node could wait the full five minutes ("waiting
21
+ for CCU") for a device description that never comes.** It waited for the
22
+ values description of every channel of the selected devices, including
23
+ channels that have none, descriptions the interface refused, and devices
24
+ missing from the device table. Those now count as settled; only a fetch
25
+ that is still pending holds the node.
26
+
27
+ ## 4.10.1 (2026-11-10)
28
+
29
+ ### Fixed
30
+
31
+ - **openccu-lite: a connection whose token reads only the names lost its
32
+ events and commands after the update to 4.7 or later, without a word.**
33
+ Since 4.7 a connection to openccu-lite with a token in the connection node
34
+ moves its interfaces to the system's lite-rpc. A token made for the names
35
+ alone (`meta:read`, all the direct connection needed before) may not use
36
+ lite-rpc: the system refused the interface list and the event stream, and
37
+ the log said only `lite-rpc connected: no interface running`. The
38
+ connection now asks the system what the token may do before it moves
39
+ anything. Without `rpc:read` the interfaces stay on the direct connection
40
+ with callbacks, as before the update, and the log says that lite-rpc needs
41
+ `rpc:read` (events and device lists) and `rpc:operate` (commands). Where
42
+ the connection type is set to _openccu-lite_, the log has an error naming
43
+ the missing scopes and the nodes show `token lacks rpc:read, rpc:operate`
44
+ instead of waiting. A token with `rpc:read` but without `rpc:operate`
45
+ connects through lite-rpc and gets a warning that commands are refused.
46
+ (#189, @reini12345)
47
+
8
48
  ## 4.10.0 (2026-11-09)
9
49
 
10
50
  ### Changed
package/README.md CHANGED
@@ -57,7 +57,8 @@ CCU-Jack keep their own connections.
57
57
  rpc node may call any method) and for reading the names. Alternatively an API token made on the system goes into
58
58
  the **openccu-lite token** field by hand - for lite-rpc it needs the `rpc:*` scope of what the flow does
59
59
  (`rpc:read` for events and reads, `rpc:operate` for `setValue`, `rpc:configure` for paramsets and links,
60
- `rpc:admin` for the rest).
60
+ `rpc:admin` for the rest). A token without `rpc:read` (one made for the names alone) keeps the direct connection
61
+ with callbacks under _auto_, and the log says what lite-rpc would need.
61
62
  - **System variables, programs and HM-Script do not exist there.** The `ccu-sysvar`, `ccu-program`, `ccu-script` and
62
63
  `ccu-poll` nodes stay in the flows and answer every message with an error.
63
64
 
@@ -736,6 +736,10 @@ module.exports = function (RED) {
736
736
  this.liteConfig = config;
737
737
  this.lite = null;
738
738
  this.liteIfaces = [];
739
+ // B-44: the scopes the system lists for the lite-rpc credential (undefined: not known)
740
+ // and, per interface, why it cannot be reached (the nodes show it)
741
+ this.liteScopes = undefined;
742
+ this.ifaceError = {};
739
743
  this.metaMode = false;
740
744
  this.meta = null;
741
745
  // #167: minutes between re-reads of channel names, rooms and
@@ -862,34 +866,36 @@ module.exports = function (RED) {
862
866
  }
863
867
  });
864
868
 
865
- if (config.regaEnabled) {
866
- this.lastRegaDataRefresh = now();
867
- // B-17: ask the box once whether it speaks the openccu-lite
868
- // metadata api. It does not on a CCU/RaspberryMatic/OpenCCU,
869
- // where everything below runs exactly as before.
870
- this.lastMetaProbe = now();
871
- this.detectMetaOutcome()
872
- .then((outcome) => {
873
- if (outcome.info) {
874
- return this.startMeta(outcome.info);
875
- }
869
+ // B-17: ask the box once whether it speaks the openccu-lite metadata api. It does not
870
+ // on a CCU/RaspberryMatic/OpenCCU, where everything below runs exactly as before.
871
+ // B-46: asked whatever the ReGaHSS checkbox says - on openccu-lite there is no ReGaHSS
872
+ // the checkbox could switch, the names come from the metadata api and the interfaces
873
+ // through lite-rpc; only the ReGa path (names, sysvars, programs) stays behind it.
874
+ this.lastMetaProbe = now();
875
+ this.detectMetaOutcome()
876
+ .then((outcome) => {
877
+ if (outcome.info) {
878
+ return this.startMeta(outcome.info);
879
+ }
876
880
 
877
- // B-28: a timeout or a refused connection decides nothing -
878
- // the ReGa path starts, and the detection is repeated
879
- this.scheduleMetaRedetect(outcome);
880
- return this.getRegaData().then(() => {
881
- this.regaPoll();
882
- });
883
- })
884
- .catch((error) => {
885
- this.logger.error('name sync ' + error.message);
886
- })
887
- .then(() => {
888
- this.initIfaces(config);
881
+ // B-28: a timeout or a refused connection decides nothing -
882
+ // the ReGa path starts, and the detection is repeated
883
+ this.scheduleMetaRedetect(outcome);
884
+ if (!config.regaEnabled) {
885
+ return;
886
+ }
887
+
888
+ this.lastRegaDataRefresh = now();
889
+ return this.getRegaData().then(() => {
890
+ this.regaPoll();
889
891
  });
890
- } else {
891
- this.initIfaces(config);
892
- }
892
+ })
893
+ .catch((error) => {
894
+ this.logger.error('name sync ' + error.message);
895
+ })
896
+ .then(() => {
897
+ this.initIfaces(config);
898
+ });
893
899
 
894
900
  this.stats(true);
895
901
 
@@ -1058,6 +1064,11 @@ module.exports = function (RED) {
1058
1064
  }
1059
1065
 
1060
1066
  waiting = Boolean(waiting) && !connected;
1067
+ if (connected && this.ifaceError[iface]) {
1068
+ delete this.ifaceError[iface];
1069
+ this.ifaceStatus[iface] = null; // the nodes drop the error text
1070
+ }
1071
+
1061
1072
  const waitingChanged = Boolean(this.ifaceWaiting[iface]) !== waiting;
1062
1073
  if (this.ifaceStatus[iface] !== connected || waitingChanged) {
1063
1074
  if (this.ifaceStatus[iface] !== connected) {
@@ -1126,7 +1137,11 @@ module.exports = function (RED) {
1126
1137
  pushStatus() {
1127
1138
  Object.keys(this.users).forEach((id) => {
1128
1139
  if (typeof this.users[id].setStatus === 'function') {
1129
- this.users[id].setStatus({ifaceStatus: this.ifaceStatus, ifaceWaiting: this.ifaceWaiting});
1140
+ this.users[id].setStatus({
1141
+ ifaceStatus: this.ifaceStatus,
1142
+ ifaceWaiting: this.ifaceWaiting,
1143
+ ifaceError: this.ifaceError,
1144
+ });
1130
1145
  }
1131
1146
  });
1132
1147
  }
@@ -1682,7 +1697,8 @@ module.exports = function (RED) {
1682
1697
  outcome.reason +
1683
1698
  ') after ' +
1684
1699
  META_REDETECT_ATTEMPTS +
1685
- ' attempts - staying with the ReGaHSS, detecting again every five minutes',
1700
+ ' attempts - staying with the ' +
1701
+ (this.regaEnabled ? 'ReGaHSS, detecting again every five minutes' : 'CCU way'),
1686
1702
  );
1687
1703
  this.metaRedetectAttempt = 0;
1688
1704
  return;
@@ -1692,7 +1708,9 @@ module.exports = function (RED) {
1692
1708
  const line =
1693
1709
  'meta api detection inconclusive (' +
1694
1710
  outcome.reason +
1695
- ') - names come from the ReGaHSS until the system answers, detecting again in ' +
1711
+ ') - ' +
1712
+ (this.regaEnabled ? 'names come from the ReGaHSS' : 'the interfaces are reached the CCU way') +
1713
+ ' until the system answers, detecting again in ' +
1696
1714
  delay / 1000 +
1697
1715
  ' s';
1698
1716
  if (this.metaRedetectAttempt === 1) {
@@ -1731,7 +1749,12 @@ module.exports = function (RED) {
1731
1749
 
1732
1750
  this.metaRedetectAttempt = 0;
1733
1751
  this.logger.info(
1734
- 'not an openccu-lite (' + outcome.reason + ') - names, rooms and functions come from the ReGaHSS',
1752
+ 'not an openccu-lite (' +
1753
+ outcome.reason +
1754
+ ') - ' +
1755
+ (this.regaEnabled
1756
+ ? 'names, rooms and functions come from the ReGaHSS'
1757
+ : 'the interfaces are reached the CCU way'),
1735
1758
  );
1736
1759
  });
1737
1760
  }
@@ -1782,6 +1805,10 @@ module.exports = function (RED) {
1782
1805
  this.logger.info(
1783
1806
  'this system has no ReGaHSS: system variables, programs and HM-Script are not available (sysvar, program, poll and script nodes stay idle)',
1784
1807
  );
1808
+ if (!this.regaEnabled) {
1809
+ // B-46: the checkbox has nothing to switch here - the names are the metadata api's
1810
+ this.logger.debug('the ReGaHSS checkbox is off - it has no effect on openccu-lite');
1811
+ }
1785
1812
 
1786
1813
  if (info.version > 1) {
1787
1814
  this.logger.warn(
@@ -1799,6 +1826,44 @@ module.exports = function (RED) {
1799
1826
  );
1800
1827
  }
1801
1828
 
1829
+ return this.checkLiteScopes().then(() => this.startMetaProvider());
1830
+ }
1831
+
1832
+ /**
1833
+ * B-44: what the lite-rpc credential may do, asked once before the interfaces are moved
1834
+ * there - a token made for the names alone (meta:read, enough for the CCU way up to 4.6)
1835
+ * cannot follow them to lite-rpc, and liteInterfaces() keeps them on the direct path then.
1836
+ * @returns {Promise<void>}
1837
+ */
1838
+ checkLiteScopes() {
1839
+ if (
1840
+ this.connectionType === 'ccu' ||
1841
+ !this.liteToken ||
1842
+ !lite.LITE_INTERFACES.some((iface) => this.liteConfig[this.ifaceTypes[iface].conf + 'Enabled'])
1843
+ ) {
1844
+ return Promise.resolve();
1845
+ }
1846
+
1847
+ return lite
1848
+ .tokenScopes({
1849
+ url: (this.tlsEnabled ? 'https' : 'http') + '://' + this.host + ':' + this.metaPort,
1850
+ token: this.liteToken,
1851
+ insecure: Boolean(this.inSecure),
1852
+ fingerprint256: this.fingerprint256,
1853
+ })
1854
+ .then((scopes) => {
1855
+ this.liteScopes = scopes;
1856
+ if (scopes) {
1857
+ this.logger.debug('openccu-lite: the lite-rpc credential holds ' + scopes.join(', '));
1858
+ }
1859
+ });
1860
+ }
1861
+
1862
+ /**
1863
+ * The names from the system's metadata api (startMeta's second half).
1864
+ * @returns {Promise<void>}
1865
+ */
1866
+ startMetaProvider() {
1802
1867
  // one client for names and interfaces where the lite-rpc credential reads the names too
1803
1868
  // (the connection node's own token, as pairing makes it); a names-only client of its own
1804
1869
  // where they differ (RedMatic: the system's local token for the names, the addon token
@@ -1859,6 +1924,11 @@ module.exports = function (RED) {
1859
1924
  // B-28: an unreachable box is not a CCU yet - keep asking
1860
1925
  this.scheduleMetaRedetect(outcome);
1861
1926
 
1927
+ if (!this.regaEnabled) {
1928
+ // B-46: the ReGaHSS is switched off in the connection node
1929
+ return;
1930
+ }
1931
+
1862
1932
  if (this.ifaceTypes.ReGaHSS.enabled && !this.clients.ReGaHSS) {
1863
1933
  this.createClient('ReGaHSS').then(() => this.setIfaceStatus('ReGaHSS', true));
1864
1934
  }
@@ -2620,6 +2690,24 @@ module.exports = function (RED) {
2620
2690
  return [];
2621
2691
  }
2622
2692
 
2693
+ // B-44: a token without rpc:read (one made for the names, as the CCU way needed up to
2694
+ // 4.6) cannot follow the interfaces to lite-rpc: `auto` keeps the direct connection that
2695
+ // worked with it; `openccu-lite` insists, and startLite() says what the token lacks
2696
+ const missing = lite.missingTiers(this.liteScopes);
2697
+ if (missing.includes('rpc:read') && this.connectionType === 'auto') {
2698
+ if (!quiet) {
2699
+ this.logger.warn(
2700
+ 'openccu-lite: the token in the connection node holds ' +
2701
+ (this.liteScopes.join(', ') || 'no scope') +
2702
+ ' - lite-rpc needs ' +
2703
+ lite.describeTiers(missing) +
2704
+ ', so the interfaces stay on the direct connection with callbacks. To use lite-rpc, give the token these scopes on the system or pair the connection node with it',
2705
+ );
2706
+ }
2707
+
2708
+ return [];
2709
+ }
2710
+
2623
2711
  return enabled;
2624
2712
  }
2625
2713
 
@@ -2751,6 +2839,15 @@ module.exports = function (RED) {
2751
2839
 
2752
2840
  const up = ifaces.filter((iface) => running(iface));
2753
2841
  this.logger.info('lite-rpc connected: ' + (up.join(', ') || 'no interface running'));
2842
+ if (!this.lite.may('rpc:operate')) {
2843
+ // B-44: events and device lists, but every command refused
2844
+ this.logger.warn(
2845
+ 'lite-rpc: the openccu-lite token lacks ' +
2846
+ lite.describeTiers(['rpc:operate']) +
2847
+ ' - events arrive, but setValue, putParamset and the other commands are refused. Give the token rpc:operate on the system or pair the connection node with it',
2848
+ );
2849
+ }
2850
+
2754
2851
  return Promise.all(
2755
2852
  up.map((iface) =>
2756
2853
  this.getDevices(iface)
@@ -2774,6 +2871,31 @@ module.exports = function (RED) {
2774
2871
  return;
2775
2872
  }
2776
2873
 
2874
+ if (error.kind === 'forbidden' || error.kind === 'unauthenticated') {
2875
+ // B-44: a refused credential is not tried again - said as an error, and
2876
+ // the nodes show what the token lacks instead of "waiting"
2877
+ const missing = error.missing || (error.scope ? [error.scope] : []);
2878
+ this.logger.error(
2879
+ 'lite-rpc: ' +
2880
+ (error.message || error) +
2881
+ (error.kind === 'forbidden'
2882
+ ? '. Give the token ' +
2883
+ (missing.join(' and ') || 'rpc:read and rpc:operate') +
2884
+ ' on the system, pair the connection node with it, or set the connection type to CCU for the direct connection with callbacks'
2885
+ : ''),
2886
+ );
2887
+ const text =
2888
+ error.kind === 'forbidden'
2889
+ ? 'token lacks ' + (missing.join(', ') || 'rpc:read')
2890
+ : 'token not accepted';
2891
+ ifaces.forEach((iface) => {
2892
+ this.ifaceError[iface] = text;
2893
+ this.ifaceStatus[iface] = null;
2894
+ this.setIfaceStatus(iface, false);
2895
+ });
2896
+ return;
2897
+ }
2898
+
2777
2899
  this.logger.warn('lite-rpc: ' + (error.message || error) + ' - the client keeps trying');
2778
2900
  ifaces.forEach((iface) => this.setIfaceStatus(iface, false, true));
2779
2901
  });
@@ -158,6 +158,18 @@ module.exports = function (RED) {
158
158
  return true;
159
159
  }
160
160
 
161
+ // B-46: a description that will never come must not hold the node for its
162
+ // five minutes - no key (the parent is not in the device table), a channel
163
+ // without a VALUES paramset (nothing is ever queued for it), or a fetch the
164
+ // interface refused with a fault (not asked again in this run, B-36)
165
+ if (
166
+ !key ||
167
+ !(channel.PARAMSETS || []).includes('VALUES') ||
168
+ (ccu.paramsetFailed && ccu.paramsetFailed.has(iface + '/' + channel.ADDRESS + '/VALUES'))
169
+ ) {
170
+ return true;
171
+ }
172
+
161
173
  ccu.getParamsetDescription(iface, channel, 'VALUES'); // queues the fetch
162
174
  return false;
163
175
  });
package/nodes/lib/lite.js CHANGED
@@ -34,6 +34,20 @@ const CALLBACK_METHODS = [
34
34
  'readdedDevice',
35
35
  ];
36
36
 
37
+ /**
38
+ * B-44: the rpc tiers as the system reads them (occulited's scope table): each tier includes the
39
+ * ones before it, Full access (`*`) everything. The system lists only the highest tier a token
40
+ * holds (`rpc:operate`, no `rpc:read` beside it), so a tier is never looked up literally.
41
+ */
42
+ const RPC_INCLUDES = {
43
+ 'rpc:operate': ['rpc:read'],
44
+ 'rpc:configure': ['rpc:operate', 'rpc:read'],
45
+ 'rpc:admin': ['rpc:configure', 'rpc:operate', 'rpc:read'],
46
+ };
47
+
48
+ /** what each tier the interfaces need is for, in the order they matter */
49
+ const RPC_TIERS = {'rpc:read': 'events and device lists', 'rpc:operate': 'commands'};
50
+
37
51
  let modules = null;
38
52
 
39
53
  /**
@@ -74,6 +88,81 @@ function readAddonToken(file = module.exports.ADDON_TOKEN_FILE) {
74
88
  }
75
89
  }
76
90
 
91
+ /**
92
+ * Whether a credential holding `scopes` may do what needs `want`.
93
+ * @param {string[]} scopes as the system lists them
94
+ * @param {string} want
95
+ * @returns {boolean}
96
+ */
97
+ function covers(scopes, want) {
98
+ return scopes.some((have) => have === want || have === '*' || (RPC_INCLUDES[have] || []).includes(want));
99
+ }
100
+
101
+ /**
102
+ * B-44: the tiers lite-rpc needs that `scopes` lacks: `rpc:read` (events, device lists),
103
+ * `rpc:operate` (commands).
104
+ * @param {string[]|undefined} scopes undefined: not known, nothing is said to be missing
105
+ * @returns {string[]}
106
+ */
107
+ function missingTiers(scopes) {
108
+ if (!Array.isArray(scopes)) {
109
+ return [];
110
+ }
111
+
112
+ return Object.keys(RPC_TIERS).filter((tier) => !covers(scopes, tier));
113
+ }
114
+
115
+ /**
116
+ * B-44: what a token lacking these tiers cannot do, for the log.
117
+ * @param {string[]} missing from missingTiers()
118
+ * @returns {string} e.g. "rpc:read (events and device lists) and rpc:operate (commands)"
119
+ */
120
+ function describeTiers(missing) {
121
+ return missing.map((tier) => tier + ' (' + RPC_TIERS[tier] + ')').join(' and ');
122
+ }
123
+
124
+ /**
125
+ * B-44: the scopes the system lists for a credential (GET /api/auth/v1/state), asked before the
126
+ * interfaces are moved to lite-rpc: a token made for the names (meta:read) cannot follow them
127
+ * there. Undefined where it cannot be told (no answer, a refused credential - the client says
128
+ * that itself -, an older system without the auth state): nothing is decided on it then.
129
+ * @param {object} options
130
+ * @param {string} options.url the system, scheme and authority
131
+ * @param {string} options.token
132
+ * @param {boolean} [options.insecure]
133
+ * @param {string} [options.fingerprint256]
134
+ * @param {number} [options.timeout] ms
135
+ * @returns {Promise<string[]|undefined>}
136
+ */
137
+ async function tokenScopes({url, token, insecure, fingerprint256, timeout = 5000}) {
138
+ const controller = new AbortController();
139
+ const timer = setTimeout(() => controller.abort(), timeout);
140
+ try {
141
+ const transport = load().nodeTransport(trustOf({insecure, fingerprint256}));
142
+ const response = await transport.request(
143
+ 'GET',
144
+ url + '/api/auth/v1/state',
145
+ {Accept: 'application/json', Authorization: 'Bearer ' + token, 'X-Occulite-Request': '1'},
146
+ undefined,
147
+ controller.signal,
148
+ );
149
+ if (response.status !== 200) {
150
+ return undefined;
151
+ }
152
+
153
+ const state = JSON.parse(response.body);
154
+ if (!state || state.authenticated === false || !Array.isArray(state.scopes)) {
155
+ return undefined;
156
+ }
157
+
158
+ return state.scopes.map(String);
159
+ } catch {
160
+ return undefined;
161
+ } finally {
162
+ clearTimeout(timer);
163
+ }
164
+ }
165
+
77
166
  /**
78
167
  * Whether an error of the client is an RPC fault of the interface process (the process answered).
79
168
  * @param {*} error
@@ -325,6 +414,22 @@ class LiteConnection {
325
414
  return;
326
415
  }
327
416
 
417
+ // B-44: occulite-client runs a credential without rpc:read names-only - no interface
418
+ // list, no stream, every call refused. Said as that, not as "no interface running";
419
+ // the client stays open (a shared names provider follows its copy).
420
+ if (box.mode === 'names-only') {
421
+ const missing = missingTiers(box.scopes);
422
+ const refused = new Error(
423
+ 'the openccu-lite token lacks ' +
424
+ describeTiers(missing.length > 0 ? missing : ['rpc:read']) +
425
+ ' - the system refuses the interfaces to it',
426
+ );
427
+ refused.kind = 'forbidden';
428
+ refused.scope = 'rpc:read';
429
+ refused.missing = missing.length > 0 ? missing : ['rpc:read'];
430
+ throw refused;
431
+ }
432
+
328
433
  this.ready = true;
329
434
  if (this.options.onValues) {
330
435
  this.options.onValues(box.values);
@@ -353,6 +458,19 @@ class LiteConnection {
353
458
  );
354
459
  }
355
460
 
461
+ /**
462
+ * B-44: whether the credential may do what needs `scope`, as the system lists its scopes.
463
+ * @param {string} scope
464
+ * @returns {boolean} true while not known
465
+ */
466
+ may(scope) {
467
+ if (!this.box || !Array.isArray(this.box.scopes) || this.box.scopes.length === 0) {
468
+ return true;
469
+ }
470
+
471
+ return covers(this.box.scopes, scope);
472
+ }
473
+
356
474
  /**
357
475
  * Whether the system says this interface runs (the client's live list).
358
476
  * @param {string} iface
@@ -386,6 +504,10 @@ module.exports = {
386
504
  ADDON_TOKEN_FILE,
387
505
  CALLBACK_METHODS,
388
506
  readAddonToken,
507
+ covers,
508
+ missingTiers,
509
+ describeTiers,
510
+ tokenScopes,
389
511
  liteValue,
390
512
  trustOf,
391
513
  translateError,
@@ -5,6 +5,10 @@ module.exports = (that, data) => {
5
5
  // task 11: an interface whose process does not answer yet is retried; the
6
6
  // nodes show "waiting" (yellow ring) for it instead of "disconnected"
7
7
  const waiting = data.ifaceWaiting || {};
8
+ // B-44: an interface the connection cannot reach for a reason the user has to fix (the
9
+ // openccu-lite token lacks a scope) shows that reason instead of "disconnected"
10
+ const errors = data.ifaceError || {};
11
+ const error = (text) => ({fill: 'red', shape: 'ring', text});
8
12
  if (!that.iface) {
9
13
  if (data.ifaceStatus) {
10
14
  let status = 0;
@@ -14,7 +18,11 @@ module.exports = (that, data) => {
14
18
  }
15
19
  });
16
20
  if (status < 1) {
17
- if (Object.keys(waiting).some((s) => waiting[s])) {
21
+ const failed = Object.keys(errors).find((s) => errors[s]);
22
+ if (failed) {
23
+ that.status(error(errors[failed]));
24
+ that.currentStatus = 'error';
25
+ } else if (Object.keys(waiting).some((s) => waiting[s])) {
18
26
  that.status(WAITING);
19
27
  that.currentStatus = 'waiting';
20
28
  } else {
@@ -27,7 +35,12 @@ module.exports = (that, data) => {
27
35
  that.currentStatus = 'green';
28
36
  }
29
37
  } else {
30
- that.status({fill: 'yellow', shape: 'dot', text: 'partly connected'});
38
+ const failed = Object.keys(errors).find((s) => errors[s] && !data.ifaceStatus[s]);
39
+ that.status({
40
+ fill: 'yellow',
41
+ shape: 'dot',
42
+ text: failed ? 'partly connected: ' + errors[failed] : 'partly connected',
43
+ });
31
44
  that.currentStatus = 'yellow';
32
45
  }
33
46
  } else {
@@ -39,6 +52,9 @@ module.exports = (that, data) => {
39
52
  that.status({fill: 'green', shape: 'dot', text: 'connected'});
40
53
  that.currentStatus = 'green';
41
54
  }
55
+ } else if (errors[that.iface]) {
56
+ that.status(error(errors[that.iface]));
57
+ that.currentStatus = 'error';
42
58
  } else if (waiting[that.iface]) {
43
59
  that.status(WAITING);
44
60
  that.currentStatus = 'waiting';
@@ -26,7 +26,7 @@
26
26
  <ul>
27
27
  <li><b>Interfaces</b>: Hier können die zu verwendenden Schnittstellen angegeben werden. Nutzt man Beispielsweise keinen CUxD oder HmIP Geräte, kann der Haken entfernt werden was die entsprechenden ungenutzten Komponenten deaktiviert.
28
28
  <ul>
29
- <li>ReGaHSS: Die Logikschicht der CCU, verwaltet CCU-Programme und CCU-Systemvariablen</li>
29
+ <li>ReGaHSS: Die Logikschicht der CCU, verwaltet CCU-Programme und CCU-Systemvariablen (und die Namen, Räume und Gewerke). openccu-lite hat keine ReGaHSS: dort kommen die Namen aus der Metadaten-API des Systems und die Schnittstellen gehen über lite-rpc, ob der Haken gesetzt ist oder nicht</li>
30
30
  <li>BidCos-RF: Homematic Funk</li>
31
31
  <li>BidCos-Wired: Homematic Wired</li>
32
32
  <li>HmIP-RF: Homematic-IP Funk</li>
@@ -66,7 +66,7 @@ Weiteres unter <a target="_blank" href="https://nodered.org/docs/user-guide/cont
66
66
  </ul>
67
67
  <ul>
68
68
  <li><b>openccu-lite Port</b>: Nur nötig, wenn der Webserver des Systems nicht auf Port 80 bzw. 443 (TLS) läuft.</li>
69
- <li><b>openccu-lite Schnittstellen</b>: Wie die Schnittstellenprozesse auf einem openccu-lite-System erreicht werden. <i>auto</i> (Voreinstellung) geht dort über das <b>lite-rpc</b> des Systems - die Aufrufe über seinen Webport, die Ereignisse aus einem Stream, den dieser Node öffnet; ein Abonnent an den Prozessen für alle Programme auf dem System, die Ereignisse werden nach einer Unterbrechung nachgeliefert, kein eigener Callback-Server und kein eigenes <code>init</code> - und auf einer CCU, RaspberryMatic oder OpenCCU den CCU-Weg. Das Zugangsmerkmal ist das openccu-lite-Token oben, auf dem System selbst das eigene Token von RedMatic, das das System dafür erzeugt; ohne eines wird die direkte Verbindung benutzt, das Log sagt es. <i>CCU</i> behält auch auf openccu-lite die direkte Verbindung mit Rückrufen (CUxD geht immer so; lite-rpc trägt es nicht). Ein Flow aus einer Version vor 4.7.0 wird beim ersten Start auf openccu-lite einmal auf lite-rpc umgestellt - das Log sagt es - und eine hier getroffene Wahl ändert keine spätere Version mehr. Die Nodes sysvar, program, script und poll bleiben auf openccu-lite so oder so ohne Funktion.</li>
69
+ <li><b>openccu-lite Schnittstellen</b>: Wie die Schnittstellenprozesse auf einem openccu-lite-System erreicht werden. <i>auto</i> (Voreinstellung) geht dort über das <b>lite-rpc</b> des Systems - die Aufrufe über seinen Webport, die Ereignisse aus einem Stream, den dieser Node öffnet; ein Abonnent an den Prozessen für alle Programme auf dem System, die Ereignisse werden nach einer Unterbrechung nachgeliefert, kein eigener Callback-Server und kein eigenes <code>init</code> - und auf einer CCU, RaspberryMatic oder OpenCCU den CCU-Weg. Das Zugangsmerkmal ist das openccu-lite-Token oben, auf dem System selbst das eigene Token von RedMatic, das das System dafür erzeugt; ohne eines, oder mit einem Token ohne <code>rpc:read</code> (eines nur für die Namen), wird die direkte Verbindung benutzt, das Log sagt es; lite-rpc braucht <code>rpc:read</code> für die Ereignisse und <code>rpc:operate</code> für Befehle. <i>CCU</i> behält auch auf openccu-lite die direkte Verbindung mit Rückrufen (CUxD geht immer so; lite-rpc trägt es nicht). Ein Flow aus einer Version vor 4.7.0 wird beim ersten Start auf openccu-lite einmal auf lite-rpc umgestellt - das Log sagt es - und eine hier getroffene Wahl ändert keine spätere Version mehr. Die Nodes sysvar, program, script und poll bleiben auf openccu-lite so oder so ohne Funktion.</li>
70
70
  </ul>
71
71
  <ul>
72
72
  <li><b>Device data / Re-read device data</b>: Liest die Geräteliste jeder verbundenen Schnittstelle neu ein.
@@ -11,7 +11,7 @@
11
11
  <li><b>XMLRPC listening port</b>: The port of the XML-RPC server the CCU sends its events to. Several connections each need a port of their own.</li>
12
12
  <li><b>Interfaces</b>: The interfaces to use. Untick what you do not have (no CUxD, no HmIP devices, say) to switch the unused parts off.
13
13
  <ul>
14
- <li>ReGaHSS: the CCU's logic layer, which holds the programs and system variables</li>
14
+ <li>ReGaHSS: the CCU's logic layer, which holds the programs and system variables (and the names, rooms and functions). openccu-lite has no ReGaHSS: there the names come from the system's metadata API and the interfaces go through lite-rpc whether it is ticked or not</li>
15
15
  <li>BidCos-RF: Homematic radio</li>
16
16
  <li>BidCos-Wired: Homematic wired</li>
17
17
  <li>HmIP-RF: Homematic IP radio</li>
@@ -28,7 +28,7 @@
28
28
  <li><b>Context Store</b>: The Node-RED context store the states of all devices and variables are kept in. See <a target="_blank" href="https://nodered.org/docs/user-guide/context">Working with context</a> in the Node-RED documentation.</li>
29
29
  <li><b>openccu-lite token</b>: Only for <a href="https://github.com/hobbyquaker/openccu-lite" target="_blank">openccu-lite</a>, a CCU firmware without ReGaHSS. Names, rooms and functions come from the system's metadata API there, which needs a token made under <i>Users</i> on the system. When Node-RED runs on the system itself (RedMatic) the field stays empty: the local token is read automatically. The token is kept, like the password, in Node-RED's credentials (encrypted in <code>flows_cred.json</code>, never in the flow, never in an export). A CCU, RaspberryMatic or OpenCCU ignores the field. openccu-lite has no system variables, programs or HM-Script; those nodes stay in the flow and report an error per message.</li>
30
30
  <li><b>openccu-lite port</b>: Only needed when the system's web server is not on port 80 (443 with TLS).</li>
31
- <li><b>openccu-lite interfaces</b>: How the interface processes are reached on an openccu-lite system. <i>auto</i> (the default) goes through the system's <b>lite-rpc</b> there - the requests over its web port, the events from a stream this node opens, one subscriber at the processes for every program on the system, the events replayed after a break, no callback server and no <code>init</code> of its own - and the CCU way on a CCU, RaspberryMatic or OpenCCU. The credential is the openccu-lite token above, or on the system itself RedMatic's own token, which the system mints for it; without one the direct connection is used and the log says so. <i>CCU</i> keeps the direct connection with callbacks on openccu-lite as well (CUxD always goes that way; lite-rpc does not carry it). A flow from before 4.7.0 is moved to lite-rpc once at its first start on openccu-lite - the log says so - and a choice made here is never changed by a later version. The sysvar, program, script and poll nodes stay unavailable on openccu-lite either way.</li>
31
+ <li><b>openccu-lite interfaces</b>: How the interface processes are reached on an openccu-lite system. <i>auto</i> (the default) goes through the system's <b>lite-rpc</b> there - the requests over its web port, the events from a stream this node opens, one subscriber at the processes for every program on the system, the events replayed after a break, no callback server and no <code>init</code> of its own - and the CCU way on a CCU, RaspberryMatic or OpenCCU. The credential is the openccu-lite token above, or on the system itself RedMatic's own token, which the system mints for it; without one, or with a token that lacks <code>rpc:read</code> (one made for the names alone), the direct connection is used and the log says so; lite-rpc needs <code>rpc:read</code> for events and <code>rpc:operate</code> for commands. <i>CCU</i> keeps the direct connection with callbacks on openccu-lite as well (CUxD always goes that way; lite-rpc does not carry it). A flow from before 4.7.0 is moved to lite-rpc once at its first start on openccu-lite - the log says so - and a choice made here is never changed by a later version. The sysvar, program, script and poll nodes stay unavailable on openccu-lite either way.</li>
32
32
  <li><b>Device data / Re-read device data</b>: Reads the device list of every connected interface again. New and changed devices (a channel whose type changed, say) get their datapoints fetched anew, removed ones leave the table. A device the CCU reports with a changed type or version is re-read without the button as well. The button needs a deployed connection.</li>
33
33
  <li><b>Authentication</b>: Encryption and login for a CCU on the network (Node-RED not on the CCU). Both belong to the CCU's web server, which fronts the interface processes: on a CCU3 TLS and authentication are switched on in the firewall settings, on openccu-lite under <i>Remote access</i> (classic RPC). When Node-RED runs on the system itself (RedMatic; address <code>localhost</code> / <code>127.0.0.1</code>) the processes are reached directly on the loopback, BidCos over BIN-RPC, without TLS and without a login; these settings are then not used.
34
34
  <ul>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-ccu",
3
- "version": "4.10.0",
3
+ "version": "4.10.2",
4
4
  "license": "MIT",
5
5
  "main": "none",
6
6
  "keywords": [