node-red-contrib-ccu 4.10.1 → 4.10.3

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,40 @@ 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.3 (2026-11-20)
9
+
10
+ ### Fixed
11
+
12
+ - **ccu-homeassistant: a closed cover could show "open" at position 0 in
13
+ Home Assistant (and one opened from 0 "closed").** The cover's state came
14
+ from the DIRECTION/ACTIVITY_STATE message, which says "stopped" before the
15
+ final LEVEL arrives; Home Assistant then fixed open/closed from the stale
16
+ position and ignored the later one. The state now comes from the LEVEL
17
+ message itself, which carries working, direction and the position
18
+ together. With ccu-mqtt's mqsh-basic or plain payloads the cover gets no
19
+ state topic and Home Assistant derives open/closed from the position. Home
20
+ Assistant picks up the changed discovery on the next deploy
21
+ (hobbyquaker/hm2mqtt.js#35, @sgybas).
22
+
23
+ ## 4.10.2 (2026-11-20)
24
+
25
+ ### Fixed
26
+
27
+ - **openccu-lite: with the ReGaHSS unticked in the connection node, the
28
+ connection did not notice it was talking to openccu-lite.** The check for
29
+ openccu-lite's metadata API only ran while the ReGaHSS was ticked. Without
30
+ it the interfaces were connected directly with callbacks instead of through
31
+ lite-rpc, and no names were loaded. The check now runs regardless of the
32
+ checkbox; only the ReGaHSS itself (names, rooms and polling on a CCU) stays
33
+ behind it. On openccu-lite the checkbox has no effect: names come from the
34
+ system's metadata API and the interfaces go through lite-rpc either way.
35
+ - **ccu-homeassistant: the node could wait the full five minutes ("waiting
36
+ for CCU") for a device description that never comes.** It waited for the
37
+ values description of every channel of the selected devices, including
38
+ channels that have none, descriptions the interface refused, and devices
39
+ missing from the device table. Those now count as settled; only a fetch
40
+ that is still pending holds the node.
41
+
8
42
  ## 4.10.1 (2026-11-10)
9
43
 
10
44
  ### Fixed
@@ -866,34 +866,36 @@ module.exports = function (RED) {
866
866
  }
867
867
  });
868
868
 
869
- if (config.regaEnabled) {
870
- this.lastRegaDataRefresh = now();
871
- // B-17: ask the box once whether it speaks the openccu-lite
872
- // metadata api. It does not on a CCU/RaspberryMatic/OpenCCU,
873
- // where everything below runs exactly as before.
874
- this.lastMetaProbe = now();
875
- this.detectMetaOutcome()
876
- .then((outcome) => {
877
- if (outcome.info) {
878
- return this.startMeta(outcome.info);
879
- }
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
+ }
880
880
 
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
- return this.getRegaData().then(() => {
885
- this.regaPoll();
886
- });
887
- })
888
- .catch((error) => {
889
- this.logger.error('name sync ' + error.message);
890
- })
891
- .then(() => {
892
- 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();
893
891
  });
894
- } else {
895
- this.initIfaces(config);
896
- }
892
+ })
893
+ .catch((error) => {
894
+ this.logger.error('name sync ' + error.message);
895
+ })
896
+ .then(() => {
897
+ this.initIfaces(config);
898
+ });
897
899
 
898
900
  this.stats(true);
899
901
 
@@ -1695,7 +1697,8 @@ module.exports = function (RED) {
1695
1697
  outcome.reason +
1696
1698
  ') after ' +
1697
1699
  META_REDETECT_ATTEMPTS +
1698
- ' 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'),
1699
1702
  );
1700
1703
  this.metaRedetectAttempt = 0;
1701
1704
  return;
@@ -1705,7 +1708,9 @@ module.exports = function (RED) {
1705
1708
  const line =
1706
1709
  'meta api detection inconclusive (' +
1707
1710
  outcome.reason +
1708
- ') - 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 ' +
1709
1714
  delay / 1000 +
1710
1715
  ' s';
1711
1716
  if (this.metaRedetectAttempt === 1) {
@@ -1744,7 +1749,12 @@ module.exports = function (RED) {
1744
1749
 
1745
1750
  this.metaRedetectAttempt = 0;
1746
1751
  this.logger.info(
1747
- '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'),
1748
1758
  );
1749
1759
  });
1750
1760
  }
@@ -1795,6 +1805,10 @@ module.exports = function (RED) {
1795
1805
  this.logger.info(
1796
1806
  'this system has no ReGaHSS: system variables, programs and HM-Script are not available (sysvar, program, poll and script nodes stay idle)',
1797
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
+ }
1798
1812
 
1799
1813
  if (info.version > 1) {
1800
1814
  this.logger.warn(
@@ -1910,6 +1924,11 @@ module.exports = function (RED) {
1910
1924
  // B-28: an unreachable box is not a CCU yet - keep asking
1911
1925
  this.scheduleMetaRedetect(outcome);
1912
1926
 
1927
+ if (!this.regaEnabled) {
1928
+ // B-46: the ReGaHSS is switched off in the connection node
1929
+ return;
1930
+ }
1931
+
1913
1932
  if (this.ifaceTypes.ReGaHSS.enabled && !this.clients.ReGaHSS) {
1914
1933
  this.createClient('ReGaHSS').then(() => this.setIfaceStatus('ReGaHSS', true));
1915
1934
  }
@@ -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
  });
@@ -214,6 +226,7 @@ module.exports = function (RED) {
214
226
  prefix: this.prefix,
215
227
  origin: {name: pkg.name, sw: pkg.version, url: pkg.homepage},
216
228
  jsonPayloads: mqtt.payloadOutput !== 'plain',
229
+ hmPayload: mqtt.payloadOutput === 'mqsh-extended',
217
230
  generic: this.generic,
218
231
  area: this.area,
219
232
  devices: ccu.metadata.devices,
@@ -162,6 +162,7 @@ const BINARY_ONLY_CLASSES = new Set([
162
162
  * @property {string} [prefix] discovery prefix (default homeassistant)
163
163
  * @property {{name: string, sw: string, url?: string}} origin the `o` block (package name/version/url)
164
164
  * @property {boolean} [jsonPayloads] status payloads are {val, ts, lc} (ccu-mqtt mqsh-*), false = plain
165
+ * @property {boolean} [hmPayload] the payloads carry the `hm` block (ccu-mqtt mqsh-extended; default: jsonPayloads)
165
166
  * @property {boolean} [generic] generic entities for datapoints without a role (default true)
166
167
  * @property {Object<string, Object<string, object>>} devices metadata.devices (iface → address → device)
167
168
  * @property {string[]} selected device addresses to publish
@@ -174,6 +175,18 @@ const BINARY_ONLY_CLASSES = new Set([
174
175
  * @property {(iface: string, address: string, datapoint: string) => string} setTopicFor
175
176
  */
176
177
 
178
+ /**
179
+ * A cover's state from its LEVEL message in ccu-mqtt's mqsh-extended format: `hm.working` and
180
+ * `hm.direction` (1 up, 2 down; ACTIVITY_STATE mapped onto DIRECTION) say whether it moves, the
181
+ * value whether it is closed. Closed is what Home Assistant calls closed without a state topic:
182
+ * the position, rounded to a percent, is 0.
183
+ */
184
+ const COVER_STATE_TEMPLATE =
185
+ '{% set hm = value_json.hm | default({}) %}' +
186
+ '{% set d = (hm.direction | default(0) | int(0)) if hm.working | default(false) else 0 %}' +
187
+ "{{ 'opening' if d == 1 else 'closing' if d == 2 else" +
188
+ " 'closed' if ((value_json.val | float(0)) * 100) | round == 0 else 'open' }}";
189
+
177
190
  /** Stable device/unique-id base: ccu_<address>, sanitised. */
178
191
  function discoveryId(address) {
179
192
  return 'ccu_' + String(address).replace(/[^a-zA-Z0-9_-]/g, '_');
@@ -338,6 +351,7 @@ function suggestedArea(roomsOf, deviceAddress, channels) {
338
351
  */
339
352
  function deviceBlock(ctx, iface, device) {
340
353
  const json = ctx.jsonPayloads !== false;
354
+ const hm = json && ctx.hmPayload !== false;
341
355
  const generic = ctx.generic !== false;
342
356
  const t = templates(json);
343
357
  const list = ctx.devices[iface];
@@ -498,11 +512,6 @@ function deviceBlock(ctx, iface, device) {
498
512
  case 'cover': {
499
513
  if (has('LEVEL')) {
500
514
  const tilt = has('LEVEL_2');
501
- const direction = stateCh.description.ACTIVITY_STATE
502
- ? 'ACTIVITY_STATE'
503
- : stateCh.description.DIRECTION
504
- ? 'DIRECTION'
505
- : null;
506
515
  add(
507
516
  key('LEVEL'),
508
517
  e('LEVEL', 'cover', label, {
@@ -520,12 +529,22 @@ function deviceBlock(ctx, iface, device) {
520
529
  set_pos_tpl: '{{ (position / 100) | round(3) }}',
521
530
  pos_open: 100,
522
531
  pos_clsd: 0,
523
- ...(direction && {
524
- stat_t: sst(direction),
525
- val_tpl: `{% set d = ${t.int} %}{{ 'opening' if d == 1 else 'closing' if d == 2 else 'stopped' }}`,
532
+ // The state comes from the LEVEL message alone, which says in its
533
+ // hm block whether and where the cover is moving: every message is
534
+ // a whole state. A state topic that only says moving/stopped makes
535
+ // Home Assistant decide between open and closed from the position
536
+ // it has at that moment, and the 'stopped' of ACTIVITY_STATE/
537
+ // DIRECTION is published before the last LEVEL (which waits for
538
+ // WORKING, ccu-connection's publishEvent) - a closed cover stayed
539
+ // 'open' (hm2mqtt.js #35). Without the hm block there is no state
540
+ // topic: Home Assistant then takes open/closed from the position.
541
+ ...(hm && {
542
+ stat_t: sst('LEVEL'),
543
+ val_tpl: COVER_STATE_TEMPLATE,
544
+ stat_open: 'open',
545
+ stat_clsd: 'closed',
526
546
  stat_opening: 'opening',
527
547
  stat_closing: 'closing',
528
- stat_stopped: 'stopped',
529
548
  }),
530
549
  ...(tilt && {
531
550
  tilt_cmd_t: scmd('LEVEL_2'),
@@ -1001,6 +1020,7 @@ function discoveryMessages(ctx) {
1001
1020
  }
1002
1021
 
1003
1022
  module.exports = {
1023
+ COVER_STATE_TEMPLATE,
1004
1024
  DEVICE_CLASSES,
1005
1025
  NOT_ANNOUNCED,
1006
1026
  validDeviceClass,
@@ -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>
@@ -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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-ccu",
3
- "version": "4.10.1",
3
+ "version": "4.10.3",
4
4
  "license": "MIT",
5
5
  "main": "none",
6
6
  "keywords": [