node-red-contrib-ccu 4.14.1 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,56 @@ 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.16.0 (2026-11-28)
9
+
10
+ ### Added
11
+
12
+ - **display: the HmIP-WRCD.** The display node has the new type `HmIP-WRCD`
13
+ for the wall-mount remote with e-paper display: five lines of 16
14
+ characters, per line an icon, the alignment, text colour and background,
15
+ and a sound with repetitions and interval - written in one command to the
16
+ device's channel 3. A line set to _Don't touch_ stays as it is, and
17
+ `msg.lineX`, `msg.iconX`, `msg.colorX`, `msg.backgroundX` and `msg.alignX`
18
+ set a line from the message. Umlauts are translated for the display. Not
19
+ yet tried on a device (#144, @BayerSe).
20
+ - **signal: channels of the type `OPTICAL_SIGNAL_RECEIVER`** (the LEDs of an
21
+ HmIPW-WRC6) take the same command as the HmIP-BSL: colour, brightness,
22
+ behaviour, duration and ramp.
23
+ - **Device data for the HmIP-BSL 2.0.2, HmIP-RGBW, HmIP-DRG-DALI, HmIP-WRCD
24
+ and HmIPW-WRC6.** The shipped `paramsets.json` now describes these devices,
25
+ so their datapoints are in the editor's lists before the system has been
26
+ asked for them. The descriptions come from
27
+ [pydevccu](https://github.com/SukramJ/pydevccu)'s dumps of real devices.
28
+
29
+ ### Fixed
30
+
31
+ - **signal: the LED of an HmIP-BSL with firmware 2.x stayed dark.** From
32
+ firmware 2 on the device has the datapoint `COLOR_BEHAVIOUR` beside colour
33
+ and brightness, and its default is `OFF`; the signal node did not send it.
34
+ The node now sends it to every channel that has it, and has the new
35
+ setting _Behaviour_ (steady light, blinking, flashing or billowing, each
36
+ slow, medium or fast; `msg.config.colorBehaviour` as a number or a name). A
37
+ flow of before sends the steady light. An HmIP-BSL with firmware 1.x gets
38
+ exactly what it got before. Not yet tried on a device
39
+ (#177, @TinkyWonky; the workaround that showed the way is @andesse's).
40
+
41
+ ## 4.15.0 (2026-11-27)
42
+
43
+ ### Changed
44
+
45
+ - **A much smaller values cache file.** `ccu_values_<host>.json` in the
46
+ Node-RED user directory kept the whole message of every datapoint (names,
47
+ types, rooms, functions, the description's limits), about 730 bytes each -
48
+ 2.5 MB for 3500 datapoints on a large system. It now keeps only the value,
49
+ its timestamps and the previous value; the message around it is built from
50
+ the device, name and description caches at start, the same message as
51
+ before. The file shrinks to about a fifth, and a cached value carries the
52
+ current names, rooms and functions instead of those of its last event, so
53
+ a renamed channel no longer shows its old name in cached values. The file of
54
+ earlier versions is read, the next write is the short one. After going back
55
+ to an earlier version, the cached values of its first start carry no names
56
+ until it has read the values from the system again.
57
+
8
58
  ## 4.14.1 (2026-11-25)
9
59
 
10
60
  ### Fixed
package/docs/paramsets.md CHANGED
@@ -156,6 +156,28 @@ Optional later phase: rftypes→description converter for full BidCos coverage
156
156
  (medium effort, low demand — BidCos is EOL hardware and the runtime
157
157
  self-heals).
158
158
 
159
+ ### 3a. Device types no system at hand has: pydevccu's dumps (2026-11-28)
160
+
161
+ A device type neither the maintainer's systems nor a reporter's dump has can
162
+ come from [pydevccu](https://github.com/SukramJ/pydevccu) (MIT): its
163
+ `device_descriptions/<type>.json` is the `listDevices` result and its
164
+ `paramset_descriptions/<type>.json` the `getParamsetDescription` results of
165
+ a real device. `tools/paramsets-from-pydevccu.js` writes them as a dump with
166
+ the keys of `paramsets.json`, which the join tool merges as any other:
167
+
168
+ ```
169
+ node tools/paramsets-from-pydevccu.js --dir <pydevccu checkout>/pydevccu \
170
+ --out ccu_paramsets_dump.json HmIP-BSL HmIP-RGBW HmIP-DRG-DALI HmIP-WRCD HmIPW-WRC6
171
+ node tools/paramsets-join.js ccu_paramsets_dump.json
172
+ ```
173
+
174
+ Added this way from pydevccu 0.2.6: HmIP-BSL 2.0.2, HmIP-RGBW 1.0.52,
175
+ HmIP-DRG-DALI 1.4.8, HmIP-WRCD 1.4.6 and HmIPW-WRC6 1.0.8 (73 keys). The
176
+ HmIP-BSL 2.0.2 still reports its LED channels as `DIMMER_VIRTUAL_RECEIVER`,
177
+ now with `COLOR_BEHAVIOUR`; `OPTICAL_SIGNAL_RECEIVER` (the same datapoints)
178
+ is the HmIPW-WRC6's channel type. That corrects the #177 row below, which
179
+ was written from the firmware's device files.
180
+
159
181
  ## 4. Per-issue findings
160
182
 
161
183
  | Issue | Device | In paramsets.json? | Firmware/live says | Verdict |
@@ -8,7 +8,7 @@ const base62 = require('./lib/base62.js').toBase62;
8
8
  const {castValue, castSysvar} = require('./lib/cast.js');
9
9
  const {combinedParameterValue} = require('./lib/combined.js');
10
10
  const {isPartyWrite, mergePartyValues, PARTY_DATAPOINTS} = require('./lib/party.js');
11
- const {createMessage} = require('./lib/message.js');
11
+ const {createMessage, savedValue, restoreMessage} = require('./lib/message.js');
12
12
  const {topicReplace} = require('./lib/topic.js');
13
13
  const {isLocalCcu} = require('./lib/localccu.js');
14
14
  const {resolveTransport} = require('./lib/transport.js');
@@ -424,9 +424,12 @@ module.exports = function (RED) {
424
424
  if (devices) {
425
425
  Object.keys(devices).forEach((addr) => {
426
426
  if (
427
- ['SIGNAL_CHIME', 'SIGNAL_LED', 'ALARM_SWITCH_VIRTUAL_RECEIVER'].includes(
428
- devices[addr].TYPE,
429
- )
427
+ [
428
+ 'SIGNAL_CHIME',
429
+ 'SIGNAL_LED',
430
+ 'ALARM_SWITCH_VIRTUAL_RECEIVER',
431
+ 'OPTICAL_SIGNAL_RECEIVER',
432
+ ].includes(devices[addr].TYPE)
430
433
  ) {
431
434
  object[addr] = {
432
435
  name: config.channelNames[addr],
@@ -458,10 +461,16 @@ module.exports = function (RED) {
458
461
  const devices = config.metadata.devices[request.query.iface];
459
462
  if (devices) {
460
463
  Object.keys(devices).forEach((addr) => {
461
- if (
462
- (addr.endsWith(':3') && devices[addr].PARENT_TYPE.match(/HM-Dis-EP-WM55/)) ||
464
+ if (devices[addr].TYPE === 'ACOUSTIC_DISPLAY_RECEIVER') {
465
+ // the HmIP-WRCD's display and sound channel (#144)
466
+ object[addr] = {
467
+ name: config.channelNames[addr],
468
+ type: 'HmIP-WRCD',
469
+ };
470
+ } else if (
471
+ (addr.endsWith(':3') && String(devices[addr].PARENT_TYPE).match(/HM-Dis-EP-WM55/)) ||
463
472
  ((addr.endsWith(':1') || addr.endsWith(':2')) &&
464
- devices[addr].PARENT_TYPE.match(/HM-Dis-WM55/))
473
+ String(devices[addr].PARENT_TYPE).match(/HM-Dis-WM55/))
465
474
  ) {
466
475
  object[addr] = {
467
476
  name: config.channelNames[addr],
@@ -1302,6 +1311,19 @@ module.exports = function (RED) {
1302
1311
  return Promise.resolve();
1303
1312
  }
1304
1313
 
1314
+ /**
1315
+ * task 36: the values cache file now - per datapoint only what the restore needs
1316
+ * (savedValue), the rest is the metadata's
1317
+ */
1318
+ writeValues() {
1319
+ const values = {};
1320
+ for (const datapointName of Object.keys(this.values)) {
1321
+ values[datapointName] = savedValue(this.values[datapointName]);
1322
+ }
1323
+
1324
+ this.writeCache(this.valuesFile, 'values', {format: 2, values});
1325
+ }
1326
+
1305
1327
  /**
1306
1328
  * The values cache file. At stop and after a prune (`now`: datapoints of deleted devices
1307
1329
  * must leave the file) it is written at once; otherwise at most every `valuesSaveInterval`
@@ -1315,7 +1337,7 @@ module.exports = function (RED) {
1315
1337
  clearTimeout(this.valuesSaveTimer);
1316
1338
  this.valuesSaveTimer = null;
1317
1339
  if (now) {
1318
- this.writeCache(this.valuesFile, 'values', {values: this.values});
1340
+ this.writeValues();
1319
1341
  return Promise.resolve();
1320
1342
  }
1321
1343
 
@@ -1325,7 +1347,7 @@ module.exports = function (RED) {
1325
1347
 
1326
1348
  const due = lastWritten(this.valuesFile) + this.valuesSaveInterval * 60000 - Date.now();
1327
1349
  if (due <= 0) {
1328
- this.writeCache(this.valuesFile, 'values', {values: this.values});
1350
+ this.writeValues();
1329
1351
  } else {
1330
1352
  this.valuesSaveTimer = setTimeout(() => this.saveValues(), Math.min(due, 2147483647));
1331
1353
  if (typeof this.valuesSaveTimer.unref === 'function') {
@@ -1415,13 +1437,15 @@ module.exports = function (RED) {
1415
1437
  const {values} = JSON.parse(fs.readFileSync(this.valuesFile));
1416
1438
  this.logger.info('values loaded from', this.valuesFile);
1417
1439
 
1440
+ // task 36: the file keeps a value and its timestamps; the message around it
1441
+ // (names, types, rooms, functions) is built from the device table, the names
1442
+ // and the descriptions loaded before. An entry of the old format (the whole
1443
+ // message) is read too, the next write is the short one.
1418
1444
  for (const datapointName in values) {
1419
- this.values[datapointName] = {
1420
- ...values[datapointName],
1421
- cache: true,
1422
- change: false,
1423
- uncertain: true,
1424
- };
1445
+ const message = restoreMessage(this, datapointName, values[datapointName]);
1446
+ if (message) {
1447
+ this.values[datapointName] = message;
1448
+ }
1425
1449
  }
1426
1450
 
1427
1451
  resolve();
@@ -4512,6 +4536,24 @@ module.exports = function (RED) {
4512
4536
  }
4513
4537
  }
4514
4538
 
4539
+ /**
4540
+ * getParamsetDescription without asking the interface for a missing one (task 36: the
4541
+ * values cache's messages are built at start, before any interface is connected)
4542
+ * @param iface
4543
+ * @param device
4544
+ * @param paramset
4545
+ * @param parameter
4546
+ * @returns {*}
4547
+ */
4548
+ peekParamsetDescription(iface, device, paramset, parameter) {
4549
+ const descriptions = this.paramsetDescriptions[this.paramsetName(iface, device, paramset)];
4550
+ if (!descriptions) {
4551
+ return {};
4552
+ }
4553
+
4554
+ return parameter ? descriptions[parameter] : descriptions;
4555
+ }
4556
+
4515
4557
  /**
4516
4558
  *
4517
4559
  * @param iface
@@ -1,4 +1,16 @@
1
1
  <script type="text/javascript">
2
+ // the HmIP-WRCD's icons and sounds, as nodes/lib/wrcd.js has them: the number sent is the index
3
+ const ccuWrcdIcons = [
4
+ 'NO_ICON', 'LAMP_OFF', 'LAMP_ON', 'PADLOCK_OPEN', 'PADLOCK_CLOSED', 'ERROR', 'EVERYTHING_OKAY', 'INFORMATION',
5
+ 'NEW_MESSAGE', 'SERVICE_MESSAGE', 'SUN', 'MOON', 'WIND', 'CLOUD', 'THUNDERSTORM', 'DRIZZLE', 'CLOUD_AND_MOOON',
6
+ 'RAIN', 'SNOW', 'CLOUD_AND_SUN', 'CLOUD_SUN_AND_RAIN', 'SNOWFLAKE', 'RAINDROP', 'FLAME', 'WINDOW_OPEN',
7
+ 'SHUTTERS', 'ECO', 'PROTECTION_DEACTIVATED', 'EXTERNAL_PROTECTION', 'INTERNAL_PROTECTION', 'BELL', 'CLOCK'
8
+ ];
9
+ const ccuWrcdSounds = [
10
+ 'LOW_BATTERY', 'DISARMED', 'INTERNALLY_ARMED', 'EXTERNALLY_ARMED', 'DELAYED_INTERNALLY_ARMED',
11
+ 'DELAYED_EXTERNALLY_ARMED', 'EVENT', 'ERROR'
12
+ ];
13
+
2
14
  RED.nodes.registerType('ccu-display', {
3
15
 
4
16
  category: 'ccu',
@@ -35,6 +47,29 @@
35
47
  repeat: {value: '0xD0'},
36
48
  pause: {value: '0xE0'},
37
49
  sound: {value: '0xC0'},
50
+ wrcdIcon1: {value: '0'},
51
+ wrcdAlign1: {value: 'CENTER'},
52
+ wrcdColor1: {value: 'BLACK'},
53
+ wrcdBackground1: {value: 'WHITE'},
54
+ wrcdIcon2: {value: '0'},
55
+ wrcdAlign2: {value: 'CENTER'},
56
+ wrcdColor2: {value: 'BLACK'},
57
+ wrcdBackground2: {value: 'WHITE'},
58
+ wrcdIcon3: {value: '0'},
59
+ wrcdAlign3: {value: 'CENTER'},
60
+ wrcdColor3: {value: 'BLACK'},
61
+ wrcdBackground3: {value: 'WHITE'},
62
+ wrcdIcon4: {value: '0'},
63
+ wrcdAlign4: {value: 'CENTER'},
64
+ wrcdColor4: {value: 'BLACK'},
65
+ wrcdBackground4: {value: 'WHITE'},
66
+ wrcdIcon5: {value: '0'},
67
+ wrcdAlign5: {value: 'CENTER'},
68
+ wrcdColor5: {value: 'BLACK'},
69
+ wrcdBackground5: {value: 'WHITE'},
70
+ wrcdSound: {value: ''},
71
+ wrcdRepeat: {value: '0'},
72
+ wrcdInterval: {value: '5'},
38
73
  ccuConfig: {value: 'localhost', type: 'ccu-connection', required: true}
39
74
  },
40
75
  inputs: 1,
@@ -56,10 +91,43 @@
56
91
  const $nodeIconX = $('#node-icon-X')[0];
57
92
  const $nodeDisableI = $('#node-disable-X')[0];
58
93
 
94
+ const text = key => this._('ccu-display.' + key);
95
+ const options = list => list.map(([value, label]) => '<option value="' + value + '">' + label + '</option>').join('');
96
+
97
+ // the HmIP-WRCD's rows of line i: the icon, then alignment and colours (#144)
98
+ const wrcdRows = i => {
99
+ const width = share => 'width: calc(' + share + '% - 3px);';
100
+ return '<div class="form-row SUBMIT HmIP-WRCD">' +
101
+ '<label for="node-input-wrcdIcon' + i + '"><i class="icon-envelope"></i>' + text('icon') + ' ' + i + '</label>' +
102
+ '<select id="node-input-wrcdIcon' + i + '" class="ccu-dropdown">' +
103
+ options(ccuWrcdIcons.map((name, index) => [index, text('wrcd.icon.' + name)])) +
104
+ '</select></div>' +
105
+ '<div class="form-row SUBMIT HmIP-WRCD">' +
106
+ '<label for="node-input-wrcdAlign' + i + '"><i class="icon-envelope"></i>' + text('wrcd.style') + ' ' + i + '</label>' +
107
+ '<select id="node-input-wrcdAlign' + i + '" style="' + width(19) + '" title="' + text('wrcd.align') + '">' +
108
+ options([['LEFT', text('wrcd.left')], ['CENTER', text('wrcd.center')], ['RIGHT', text('wrcd.right')]]) +
109
+ '</select> ' +
110
+ '<select id="node-input-wrcdColor' + i + '" style="' + width(27) + '" title="' + text('wrcd.textColor') + '">' +
111
+ options([['BLACK', text('wrcd.textBlack')], ['WHITE', text('wrcd.textWhite')]]) +
112
+ '</select> ' +
113
+ '<select id="node-input-wrcdBackground' + i + '" style="' + width(24) + '" title="' + text('wrcd.background') + '">' +
114
+ options([['WHITE', text('wrcd.onWhite')], ['BLACK', text('wrcd.onBlack')]]) +
115
+ '</select></div>';
116
+ };
117
+
59
118
  // replace X -> number and insert templates
60
119
  for (let i = 6; i > 0; i--) {
61
120
  let extraClass = "HM-Dis-EP-WM55";
62
121
  if (i >= 4) extraClass="";
122
+ let wrcdClass = "";
123
+ if (i <= 5) {
124
+ wrcdClass = " HmIP-WRCD";
125
+ $nodeLineX.insertAdjacentHTML('afterend', wrcdRows(i));
126
+ for (const [field, fallback] of [['wrcdIcon', '0'], ['wrcdAlign', 'CENTER'], ['wrcdColor', 'BLACK'], ['wrcdBackground', 'WHITE']]) {
127
+ const value = this[field + i];
128
+ $('#node-input-' + field + i).val(value === undefined || value === '' ? fallback : String(value));
129
+ }
130
+ }
63
131
 
64
132
  let nodeIconI = $nodeIconX.innerHTML.replaceAll('X',i);
65
133
  $nodeLineX.insertAdjacentHTML('afterend','<div class="form-row SUBMIT HM-Dis-WM55 '+extraClass+'">'+nodeIconI+'</div>');
@@ -70,19 +138,32 @@
70
138
  $('#node-input-color'+i)[0].value=this['color'+i];
71
139
 
72
140
  let nodeLineI = $nodeLineX.innerHTML.replaceAll('X',i);
73
- $nodeLineX.insertAdjacentHTML('afterend','<div class="form-row SUBMIT HM-Dis-WM55 '+extraClass+'">'+nodeLineI+'</div>');
74
- $('#node-input-line'+i)[0].value=this['line'+i];
141
+ $nodeLineX.insertAdjacentHTML('afterend','<div class="form-row SUBMIT HM-Dis-WM55 '+extraClass+wrcdClass+'">'+nodeLineI+'</div>');
142
+ $('#node-input-line'+i)[0].value=this['line'+i] === undefined ? '' : this['line'+i];
75
143
 
76
144
  let nodeDisableI = $nodeDisableI.innerHTML.replaceAll('X',i);
77
- $nodeLineX.insertAdjacentHTML('afterend','<div class="form-row SUBMIT HM-Dis-WM55 '+extraClass+'">'+nodeDisableI+'</div>');
145
+ $nodeLineX.insertAdjacentHTML('afterend','<div class="form-row SUBMIT HM-Dis-WM55 '+extraClass+wrcdClass+'">'+nodeDisableI+'</div>');
78
146
  $('#node-input-disable'+i).on("change",function() {
79
147
  let dis = $('#node-input-disable'+i)[0].checked;
80
148
  $('#node-input-icon'+i).prop('disabled', dis);
149
+ $('#node-input-wrcdIcon'+i+', #node-input-wrcdAlign'+i+', #node-input-wrcdColor'+i+', #node-input-wrcdBackground'+i).prop('disabled', dis);
81
150
  $('#node-input-color'+i).prop('disabled',dis);
82
151
  $('#node-input-line'+i).prop('disabled', dis);
83
152
  });
84
153
 
85
154
  $('#node-input-disable'+i)[0].checked=this['disable'+i];
155
+ $('#node-input-disable'+i).trigger('change');
156
+ }
157
+
158
+ $('#node-input-wrcdSound').append(options(ccuWrcdSounds.map((name, index) => [index, text('wrcd.sound.' + name)])));
159
+ $('#node-input-wrcdSound').val(this.wrcdSound === undefined ? '' : String(this.wrcdSound));
160
+ // a node saved before the HmIP-WRCD was known has none of its settings: show the defaults
161
+ if (this.wrcdRepeat === undefined) {
162
+ $('#node-input-wrcdRepeat').val('0');
163
+ }
164
+
165
+ if (this.wrcdInterval === undefined) {
166
+ $('#node-input-wrcdInterval').val('5');
86
167
  }
87
168
 
88
169
  // remove templates
@@ -257,6 +338,7 @@
257
338
  <select id="node-input-channelType" class="ccu-dropdown">
258
339
  <option value="HM-Dis-WM55">HM-Dis-WM55</option>
259
340
  <option value="HM-Dis-EP-WM55">HM-Dis-EP-WM55</option>
341
+ <option value="HmIP-WRCD">HmIP-WRCD</option>
260
342
  </select>
261
343
  </div>
262
344
 
@@ -364,6 +446,55 @@
364
446
  <option value="0xEF">160 <span data-i18n="ccu-display.seconds"></span></option>
365
447
  </select>
366
448
  </div>
449
+ <div class="form-row SUBMIT HmIP-WRCD">
450
+ <label for="node-input-wrcdSound"><i class="icon-envelope"></i><span data-i18n="ccu-display.sound"></span></label>
451
+ <select id="node-input-wrcdSound" class="ccu-dropdown">
452
+ <option value="" data-i18n="ccu-display.off"></option>
453
+ </select>
454
+ </div>
455
+ <div class="form-row SUBMIT HmIP-WRCD">
456
+ <label for="node-input-wrcdRepeat"><span data-i18n="ccu-display.repeat"></span></label>
457
+ <select id="node-input-wrcdRepeat" class="ccu-dropdown">
458
+ <option value="0" data-i18n="ccu-display.wrcd.noRepeat"></option>
459
+ <option value="1">1</option>
460
+ <option value="2">2</option>
461
+ <option value="3">3</option>
462
+ <option value="4">4</option>
463
+ <option value="5">5</option>
464
+ <option value="6">6</option>
465
+ <option value="7">7</option>
466
+ <option value="8">8</option>
467
+ <option value="9">9</option>
468
+ <option value="10">10</option>
469
+ <option value="11">11</option>
470
+ <option value="12">12</option>
471
+ <option value="13">13</option>
472
+ <option value="14">14</option>
473
+ <option value="15" data-i18n="ccu-display.infinity"></option>
474
+ </select>
475
+ </div>
476
+ <div class="form-row SUBMIT HmIP-WRCD">
477
+ <label for="node-input-wrcdInterval"><i class="icon-bookmark"></i><span data-i18n="ccu-display.wrcd.interval"></span></label>
478
+ <select id="node-input-wrcdInterval" class="ccu-dropdown">
479
+ <option value="5">5 s</option>
480
+ <option value="10">10 s</option>
481
+ <option value="15">15 s</option>
482
+ <option value="20">20 s</option>
483
+ <option value="25">25 s</option>
484
+ <option value="30">30 s</option>
485
+ <option value="35">35 s</option>
486
+ <option value="40">40 s</option>
487
+ <option value="45">45 s</option>
488
+ <option value="50">50 s</option>
489
+ <option value="55">55 s</option>
490
+ <option value="60">60 s</option>
491
+ <option value="65">65 s</option>
492
+ <option value="70">70 s</option>
493
+ <option value="75">75 s</option>
494
+ <option value="80">80 s</option>
495
+ </select>
496
+ </div>
497
+ <div class="form-tips SUBMIT HmIP-WRCD" style="margin-bottom: 12px;" data-i18n="ccu-display.wrcd.tip"></div>
367
498
  <div class="form-row">
368
499
  <label for="node-input-name"><i class="icon-bookmark"></i> Name</label>
369
500
  <input type="text" id="node-input-name">
@@ -2,6 +2,7 @@ const path = require('path');
2
2
 
3
3
  const statusHelper = require(path.join(__dirname, '/lib/status.js'));
4
4
  const {effectiveConfig} = require(path.join(__dirname, '/lib/dynconfig.js'));
5
+ const {wrcdCommand, LINES: WRCD_LINES} = require(path.join(__dirname, '/lib/wrcd.js'));
5
6
 
6
7
  /** Everything a message may override through msg.config (B-2, #80 #185). */
7
8
  const DYNAMIC_KEYS = [
@@ -13,8 +14,44 @@ const DYNAMIC_KEYS = [
13
14
  'pause',
14
15
  'signal',
15
16
  ...[1, 2, 3, 4, 5, 6].flatMap((i) => ['line' + i, 'color' + i, 'icon' + i, 'disable' + i]),
17
+ // HmIP-WRCD (#144)
18
+ 'wrcdSound',
19
+ 'wrcdRepeat',
20
+ 'wrcdInterval',
21
+ ...[1, 2, 3, 4, 5].flatMap((i) => ['wrcdIcon' + i, 'wrcdAlign' + i, 'wrcdColor' + i, 'wrcdBackground' + i]),
16
22
  ];
17
23
 
24
+ /**
25
+ * The HmIP-WRCD's command of one message: the lines that are not left as they are, and the sound.
26
+ * `msg.lineX`, `msg.iconX`, `msg.colorX`, `msg.alignX` and `msg.backgroundX` win over the configuration.
27
+ * @param {object} effective the node's effective configuration
28
+ * @param {object} message
29
+ * @returns {string} the COMBINED_PARAMETER text, empty when there is nothing to send
30
+ */
31
+ function wrcdPayload(effective, message) {
32
+ const pick = (name, key) => (message[name] === undefined ? effective[key] : message[name]);
33
+ const lines = {};
34
+ for (let i = 1; i <= WRCD_LINES; i++) {
35
+ if (message['disable' + i] || effective['disable' + i]) {
36
+ continue;
37
+ }
38
+
39
+ lines[i] = {
40
+ text: pick('line' + i, 'line' + i),
41
+ icon: pick('icon' + i, 'wrcdIcon' + i),
42
+ align: pick('align' + i, 'wrcdAlign' + i),
43
+ color: pick('color' + i, 'wrcdColor' + i),
44
+ background: pick('background' + i, 'wrcdBackground' + i),
45
+ };
46
+ }
47
+
48
+ return wrcdCommand(lines, {
49
+ sound: effective.wrcdSound,
50
+ repeat: effective.wrcdRepeat,
51
+ interval: effective.wrcdInterval,
52
+ });
53
+ }
54
+
18
55
  module.exports = function (RED) {
19
56
  class CcuDisplay {
20
57
  constructor(config) {
@@ -159,6 +196,25 @@ module.exports = function (RED) {
159
196
  // msg.line1 & co. keep working as before; msg.config
160
197
  // additionally reaches the channel and the EP-WM55 settings
161
198
  const {config: effective} = effectiveConfig(config, message, DYNAMIC_KEYS);
199
+
200
+ if (effective.channelType === 'HmIP-WRCD') {
201
+ const command = wrcdPayload(effective, message);
202
+ if (!command) {
203
+ done(new Error('nothing to send: every line is left as it is and no sound is chosen'));
204
+ return;
205
+ }
206
+
207
+ this.ccu
208
+ .setValue(effective.iface, effective.channel, 'COMBINED_PARAMETER', command)
209
+ .then(() => {
210
+ done();
211
+ })
212
+ .catch((error) => {
213
+ done(error);
214
+ });
215
+ return;
216
+ }
217
+
162
218
  let payload = '0x02';
163
219
 
164
220
  let countLines = 6; // HM-Dis-WM55
@@ -90,6 +90,7 @@
90
90
  rampTimeValueType: {value: 'num'},
91
91
  repetitions: {value: 0},
92
92
  dimmerColor: {value: 0},
93
+ colorBehaviour: {value: 1},
93
94
  dimmerLevel: {value: 100},
94
95
  dimmerList: {value: []},
95
96
  soundLevel: {value: 50},
@@ -389,12 +390,17 @@
389
390
  this.dimmerList.forEach(item => {
390
391
  $('#node-input-dimmer-container').editableList('addItem', item);
391
392
  });
392
- } else if (this.channelType === 'BSL_DIMMER_VIRTUAL_RECEIVER') {
393
+ } else if (this.channelType === 'BSL_DIMMER_VIRTUAL_RECEIVER' || this.channelType === 'OPTICAL_SIGNAL_RECEIVER') {
393
394
  // ...
394
395
  } else {
395
396
  console.error('unknown channelType', this.channelType);
396
397
  }
397
398
 
399
+ // a node saved before the option existed has none: show what it sends, the steady light
400
+ if (this.colorBehaviour === undefined || this.colorBehaviour === null || this.colorBehaviour === '') {
401
+ $('#node-input-colorBehaviour').val('1');
402
+ }
403
+
398
404
  $('.SUBMIT').hide();
399
405
  $('.SUBMIT.' + $nodeInputChannelType.val()).show();
400
406
  },
@@ -495,6 +501,7 @@
495
501
  <option value="ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER">ACOUSTIC_SIGNAL (HmIP-MP3P)</option>
496
502
  <option value="DIMMER_VIRTUAL_RECEIVER">DIMMER (HmIP-MP3P)</option>
497
503
  <option value="BSL_DIMMER_VIRTUAL_RECEIVER">DIMMER (HmIP-BSL)</option>
504
+ <option value="OPTICAL_SIGNAL_RECEIVER">OPTICAL_SIGNAL (HmIPW-WRC6)</option>
498
505
  </select>
499
506
  </div>
500
507
 
@@ -597,7 +604,7 @@
597
604
  <input id="node-input-soundLevelType" type="hidden">
598
605
  </div>
599
606
 
600
- <div class="form-row SUBMIT BSL_DIMMER_VIRTUAL_RECEIVER">
607
+ <div class="form-row SUBMIT BSL_DIMMER_VIRTUAL_RECEIVER OPTICAL_SIGNAL_RECEIVER">
601
608
  <label for="node-input-dimmerColor"><i class=""></i> Farbe </label>
602
609
  <select id="node-input-dimmerColor" class="ccu-dropdown">
603
610
  <option value="0">Aus</option>
@@ -611,13 +618,33 @@
611
618
  </select>
612
619
  </div>
613
620
 
614
- <div class="form-row SUBMIT DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER">
621
+ <div class="form-row SUBMIT BSL_DIMMER_VIRTUAL_RECEIVER OPTICAL_SIGNAL_RECEIVER">
622
+ <label for="node-input-colorBehaviour"><i class=""></i> <span data-i18n="ccu-signal.behaviour"></span></label>
623
+ <select id="node-input-colorBehaviour" class="ccu-dropdown">
624
+ <option value="1" data-i18n="ccu-signal.behaviourOn"></option>
625
+ <option value="2" data-i18n="ccu-signal.behaviourBlinkingSlow"></option>
626
+ <option value="3" data-i18n="ccu-signal.behaviourBlinkingMiddle"></option>
627
+ <option value="4" data-i18n="ccu-signal.behaviourBlinkingFast"></option>
628
+ <option value="5" data-i18n="ccu-signal.behaviourFlashSlow"></option>
629
+ <option value="6" data-i18n="ccu-signal.behaviourFlashMiddle"></option>
630
+ <option value="7" data-i18n="ccu-signal.behaviourFlashFast"></option>
631
+ <option value="8" data-i18n="ccu-signal.behaviourBillowSlow"></option>
632
+ <option value="9" data-i18n="ccu-signal.behaviourBillowMiddle"></option>
633
+ <option value="10" data-i18n="ccu-signal.behaviourBillowFast"></option>
634
+ <option value="0" data-i18n="ccu-signal.behaviourOff"></option>
635
+ <option value="11" data-i18n="ccu-signal.behaviourOldValue"></option>
636
+ </select>
637
+ </div>
638
+
639
+ <div class="form-tips SUBMIT BSL_DIMMER_VIRTUAL_RECEIVER" style="margin-bottom: 12px;" data-i18n="ccu-signal.behaviourTip"></div>
640
+
641
+ <div class="form-row SUBMIT DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER OPTICAL_SIGNAL_RECEIVER">
615
642
  <label for="node-input-dimmerLevel"><i class=""></i> Helligkeit </label>
616
643
  <input id="node-input-dimmerLevel" type="number" min="0" max="100">
617
644
  <input id="node-input-dimmerLevelType" type="hidden">
618
645
  </div>
619
646
 
620
- <div class="form-row SUBMIT ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER">
647
+ <div class="form-row SUBMIT ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER OPTICAL_SIGNAL_RECEIVER">
621
648
  <label for="node-input-rampTimeUnit"><i class=""></i> Rampenzeit </label>
622
649
  <select id="node-input-rampTimeUnit" style="width: calc(35% - 5px)">
623
650
  <option value="S">Sekunden</option>
@@ -628,7 +655,7 @@
628
655
  <input id="node-input-rampTimeValueType" type="hidden">
629
656
  </div>
630
657
 
631
- <div class="form-row SUBMIT ALARM_SWITCH_VIRTUAL_RECEIVER ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER">
658
+ <div class="form-row SUBMIT ALARM_SWITCH_VIRTUAL_RECEIVER ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER DIMMER_VIRTUAL_RECEIVER BSL_DIMMER_VIRTUAL_RECEIVER OPTICAL_SIGNAL_RECEIVER">
632
659
  <label for="node-input-durationUnit"><i class=""></i> Dauer </label>
633
660
  <select id="node-input-durationUnit" style="width: calc(35% - 5px)">
634
661
  <option value="S">Sekunden</option>