node-red-contrib-ccu 4.15.0 → 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,39 @@ 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
+
8
41
  ## 4.15.0 (2026-11-27)
9
42
 
10
43
  ### Changed
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 |
@@ -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],
@@ -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>
@@ -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 {signalCommand} = require(path.join(__dirname, '/lib/signal.js'));
5
6
 
6
7
  /** Fields that already carry a typed input (`<name>Type`) in the editor. */
7
8
  const TYPED_VALUES = ['rampTimeValue', 'durationValue', 'repeat', 'volume', 'soundLevel'];
@@ -21,27 +22,12 @@ const DYNAMIC_KEYS = [
21
22
  'repetitions',
22
23
  'dimmerLevel',
23
24
  'dimmerColor',
25
+ 'colorBehaviour',
24
26
  'dimmerList',
25
27
  'soundList',
26
28
  ...TYPED_VALUES,
27
29
  ];
28
30
 
29
- /**
30
- * Accept both the editor's list shape and a plain array of values, so a
31
- * flow can send `msg.config.soundList = [1, 2]` instead of building
32
- * `[{sound: 1}, {sound: 2}]` by hand (#148).
33
- * @param {*} list
34
- * @param {string} key 'sound' or 'color'
35
- * @returns {object[]}
36
- */
37
- function normalizeList(list, key) {
38
- if (!Array.isArray(list)) {
39
- return [];
40
- }
41
-
42
- return list.map((item) => (item !== null && typeof item === 'object' ? item : {[key]: item}));
43
- }
44
-
45
31
  module.exports = function (RED) {
46
32
  class CcuSignal {
47
33
  constructor(config) {
@@ -88,83 +74,34 @@ module.exports = function (RED) {
88
74
  });
89
75
  }
90
76
 
77
+ /**
78
+ * The channel's VALUES description as far as it is known, without asking the interface.
79
+ * @param {string} iface
80
+ * @param {string} channel
81
+ * @returns {object|undefined}
82
+ */
83
+ valuesDescription(iface, channel) {
84
+ const devices = this.ccu.metadata && this.ccu.metadata.devices && this.ccu.metadata.devices[iface];
85
+ const device = devices && devices[String(channel).split(' ')[0]];
86
+ const key = device && this.ccu.paramsetName(iface, device, 'VALUES');
87
+ return key ? this.ccu.paramsetDescriptions[key] : undefined;
88
+ }
89
+
91
90
  sendCommand(config) {
92
- let payload;
93
91
  this.debug(config.channelType);
94
92
 
95
- switch (config.channelType) {
96
- case 'SIGNAL_CHIME':
97
- payload = [config.volume / 100, config.repeat, 108000, ...String(config.chime).split(',')];
98
- return this.ccu.setValue(config.iface, config.channel, 'SUBMIT', payload);
99
- case 'SIGNAL_LED':
100
- payload = ['1', config.repeat, 108000, ...String(config.led).split(',')];
101
- return this.ccu.setValue(config.iface, config.channel, 'SUBMIT', payload);
102
- case 'ALARM_SWITCH_VIRTUAL_RECEIVER':
103
- return this.ccu.methodCall(config.iface, 'putParamset', [
104
- config.channel,
105
- 'VALUES',
106
- {
107
- ACOUSTIC_ALARM_SELECTION: config.acousticAlarmSelection,
108
- DURATION_UNIT: config.durationUnit,
109
- DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
110
- OPTICAL_ALARM_SELECTION: config.opticalAlarmSelection,
111
- },
112
- ]);
113
- case 'DIMMER_VIRTUAL_RECEIVER': {
114
- const dimmerList = normalizeList(config.dimmerList, 'color');
115
- const parameters = {
116
- LEVEL: config.dimmerLevel / 100,
117
- RAMP_TIME_UNIT: config.rampTimeUnit,
118
- RAMP_TIME_VALUE: Number(config.rampTimeValue),
119
- DURATION_UNIT: config.durationUnit,
120
- DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
121
- REPETITIONS: Number(config.repetitions),
122
- OUTPUT_SELECT_SIZE: dimmerList.length,
123
- };
124
- dimmerList.forEach((item, i) => {
125
- const index = i + 1;
126
- parameters['COLOR_LIST_' + index] = Number(item.color);
127
- parameters['ON_TIME_LIST_' + index] = Number(item.ontime);
128
- });
129
- return this.ccu.methodCall(config.iface, 'putParamset', [config.channel, 'VALUES', parameters]);
130
- }
131
-
132
- case 'BSL_DIMMER_VIRTUAL_RECEIVER': {
133
- return this.ccu.methodCall(config.iface, 'putParamset', [
134
- config.channel,
135
- 'VALUES',
136
- {
137
- LEVEL: config.dimmerLevel / 100,
138
- RAMP_TIME_UNIT: config.rampTimeUnit,
139
- RAMP_TIME_VALUE: Number(config.rampTimeValue),
140
- DURATION_UNIT: config.durationUnit,
141
- DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
142
- COLOR: Number(config.dimmerColor),
143
- },
144
- ]);
145
- }
146
-
147
- case 'ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER': {
148
- const soundList = normalizeList(config.soundList, 'sound');
149
- const parameters = {
150
- LEVEL: config.soundLevel / 100,
151
- RAMP_TIME_UNIT: config.rampTimeUnit,
152
- RAMP_TIME_VALUE: Number(config.rampTimeValue),
153
- DURATION_UNIT: config.durationUnit,
154
- DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
155
- REPETITIONS: Number(config.repetitions),
156
- OUTPUT_SELECT_SIZE: soundList.length,
157
- };
158
- soundList.forEach((item, i) => {
159
- const index = i + 1;
160
- parameters['SOUNDFILE_LIST_' + index] = Number(item.sound);
161
- });
162
- return this.ccu.methodCall(config.iface, 'putParamset', [config.channel, 'VALUES', parameters]);
163
- }
93
+ let command;
94
+ try {
95
+ command = signalCommand(config, this.valuesDescription(config.iface, config.channel));
96
+ } catch (error) {
97
+ return Promise.reject(error);
98
+ }
164
99
 
165
- default:
166
- return Promise.reject(new Error(`channelType ${config.channelType} unknown`));
100
+ if (command.paramset) {
101
+ return this.ccu.methodCall(config.iface, 'putParamset', [config.channel, 'VALUES', command.paramset]);
167
102
  }
103
+
104
+ return this.ccu.setValue(config.iface, config.channel, command.datapoint, command.value);
168
105
  }
169
106
 
170
107
  setStatus(data) {