node-red-contrib-ccu 4.15.0 → 4.17.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 +53 -0
- package/README.md +12 -10
- package/docs/paramsets.md +22 -0
- package/nodes/ccu-connection.js +72 -6
- package/nodes/ccu-display.html +134 -3
- package/nodes/ccu-display.js +56 -0
- package/nodes/ccu-program.html +1 -1
- package/nodes/ccu-signal.html +32 -5
- package/nodes/ccu-signal.js +25 -88
- package/nodes/ccu-sysvar.html +1 -1
- package/nodes/lib/signal.js +175 -0
- package/nodes/lib/wrcd.js +197 -0
- package/nodes/locales/de/ccu-display.html +6 -0
- package/nodes/locales/de/ccu-display.json +76 -16
- package/nodes/locales/de/ccu-program.html +5 -0
- package/nodes/locales/de/ccu-signal.html +1 -0
- package/nodes/locales/de/ccu-signal.json +15 -2
- package/nodes/locales/de/ccu-sysvar.html +6 -1
- package/nodes/locales/en-US/ccu-display.html +6 -0
- package/nodes/locales/en-US/ccu-display.json +77 -17
- package/nodes/locales/en-US/ccu-program.html +5 -0
- package/nodes/locales/en-US/ccu-signal.html +1 -0
- package/nodes/locales/en-US/ccu-signal.json +15 -2
- package/nodes/locales/en-US/ccu-sysvar.html +6 -1
- package/package.json +1 -1
- package/paramsets.json +254105 -182493
package/nodes/ccu-signal.js
CHANGED
|
@@ -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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
166
|
-
|
|
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) {
|
package/nodes/ccu-sysvar.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
defaults: {
|
|
6
6
|
name: {value: ''},
|
|
7
7
|
ccuConfig: {value: 'localhost', type: 'ccu-connection', required: true},
|
|
8
|
-
topic: {value: '
|
|
8
|
+
topic: {value: 'hm/status/sysvar/${Name}'},
|
|
9
9
|
change: {value: true},
|
|
10
10
|
cache: {value: true},
|
|
11
11
|
property: {value: 'payload'},
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/* The signal node's commands, by channel type (pure: no connection, no Node-RED).
|
|
2
|
+
|
|
3
|
+
COLOR_BEHAVIOUR (#177): the HmIP-BSL with firmware 2.x and the channel type
|
|
4
|
+
OPTICAL_SIGNAL_RECEIVER (HmIPW-WRC6) have a datapoint beside COLOR and LEVEL that
|
|
5
|
+
says how the LED lights - on, blinking, flashing, billowing. Its default is OFF,
|
|
6
|
+
so a command without it leaves the LED dark. The channel's description decides
|
|
7
|
+
whether it is sent: a BSL 2.x keeps the channel type DIMMER_VIRTUAL_RECEIVER of
|
|
8
|
+
the 1.x, which does not have the datapoint. */
|
|
9
|
+
|
|
10
|
+
/** COLOR_BEHAVIOUR's entries, in the order of the devices' VALUE_LIST */
|
|
11
|
+
const COLOR_BEHAVIOURS = [
|
|
12
|
+
'OFF',
|
|
13
|
+
'ON',
|
|
14
|
+
'BLINKING_SLOW',
|
|
15
|
+
'BLINKING_MIDDLE',
|
|
16
|
+
'BLINKING_FAST',
|
|
17
|
+
'FLASH_SLOW',
|
|
18
|
+
'FLASH_MIDDLE',
|
|
19
|
+
'FLASH_FAST',
|
|
20
|
+
'BILLOW_SLOW',
|
|
21
|
+
'BILLOW_MIDDLE',
|
|
22
|
+
'BILLOW_FAST',
|
|
23
|
+
'OLD_VALUE',
|
|
24
|
+
'DO_NOT_CARE',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/** what a node without the setting sends: the LED lights steadily */
|
|
28
|
+
const DEFAULT_COLOR_BEHAVIOUR = 1;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Accept both the editor's list shape and a plain array of values, so a
|
|
32
|
+
* flow can send `msg.config.soundList = [1, 2]` instead of building
|
|
33
|
+
* `[{sound: 1}, {sound: 2}]` by hand (#148).
|
|
34
|
+
* @param {*} list
|
|
35
|
+
* @param {string} key 'sound' or 'color'
|
|
36
|
+
* @returns {object[]}
|
|
37
|
+
*/
|
|
38
|
+
function normalizeList(list, key) {
|
|
39
|
+
if (!Array.isArray(list)) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return list.map((item) => (item !== null && typeof item === 'object' ? item : {[key]: item}));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The COLOR_BEHAVIOUR to send, as the entry's number.
|
|
48
|
+
* @param {*} value the setting: a number, a number as text or an entry's name; empty = the default
|
|
49
|
+
* @param {string[]} [list] the channel's VALUE_LIST
|
|
50
|
+
* @returns {number}
|
|
51
|
+
* @throws {Error} a value the list does not have
|
|
52
|
+
*/
|
|
53
|
+
function colorBehaviourValue(value, list) {
|
|
54
|
+
const entries = Array.isArray(list) && list.length > 0 ? list : COLOR_BEHAVIOURS;
|
|
55
|
+
if (value === undefined || value === null || value === '') {
|
|
56
|
+
return DEFAULT_COLOR_BEHAVIOUR;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const number = typeof value === 'number' ? value : /^\d+$/.test(String(value).trim()) ? Number(value) : -1;
|
|
60
|
+
const index = number === -1 ? entries.indexOf(String(value).trim().toUpperCase()) : number;
|
|
61
|
+
if (!Number.isInteger(index) || index < 0 || index >= entries.length) {
|
|
62
|
+
throw new Error(`colorBehaviour ${value} unknown`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return index;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Whether a coloured-LED channel takes COLOR_BEHAVIOUR.
|
|
70
|
+
* @param {string} channelType
|
|
71
|
+
* @param {object} [description] the channel's VALUES description, if known
|
|
72
|
+
* @returns {boolean}
|
|
73
|
+
*/
|
|
74
|
+
function hasColorBehaviour(channelType, description) {
|
|
75
|
+
if (description && Object.keys(description).length > 0) {
|
|
76
|
+
const dp = description.COLOR_BEHAVIOUR;
|
|
77
|
+
return Boolean(dp && dp.OPERATIONS & 2);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// no description at hand: the channel type OPTICAL_SIGNAL_RECEIVER always has it, a BSL only from 2.x
|
|
81
|
+
return channelType === 'OPTICAL_SIGNAL_RECEIVER';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The command for one message.
|
|
86
|
+
* @param {object} config the node's effective configuration
|
|
87
|
+
* @param {object} [description] the channel's VALUES description, if known
|
|
88
|
+
* @returns {{datapoint: string, value: *}|{paramset: object}} a setValue or a putParamset on VALUES
|
|
89
|
+
* @throws {Error} an unknown channel type or setting
|
|
90
|
+
*/
|
|
91
|
+
function signalCommand(config, description) {
|
|
92
|
+
switch (config.channelType) {
|
|
93
|
+
case 'SIGNAL_CHIME':
|
|
94
|
+
return {
|
|
95
|
+
datapoint: 'SUBMIT',
|
|
96
|
+
value: [config.volume / 100, config.repeat, 108000, ...String(config.chime).split(',')],
|
|
97
|
+
};
|
|
98
|
+
case 'SIGNAL_LED':
|
|
99
|
+
return {datapoint: 'SUBMIT', value: ['1', config.repeat, 108000, ...String(config.led).split(',')]};
|
|
100
|
+
case 'ALARM_SWITCH_VIRTUAL_RECEIVER':
|
|
101
|
+
return {
|
|
102
|
+
paramset: {
|
|
103
|
+
ACOUSTIC_ALARM_SELECTION: config.acousticAlarmSelection,
|
|
104
|
+
DURATION_UNIT: config.durationUnit,
|
|
105
|
+
DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
|
|
106
|
+
OPTICAL_ALARM_SELECTION: config.opticalAlarmSelection,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
case 'DIMMER_VIRTUAL_RECEIVER': {
|
|
110
|
+
const dimmerList = normalizeList(config.dimmerList, 'color');
|
|
111
|
+
const paramset = {
|
|
112
|
+
LEVEL: config.dimmerLevel / 100,
|
|
113
|
+
RAMP_TIME_UNIT: config.rampTimeUnit,
|
|
114
|
+
RAMP_TIME_VALUE: Number(config.rampTimeValue),
|
|
115
|
+
DURATION_UNIT: config.durationUnit,
|
|
116
|
+
DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
|
|
117
|
+
REPETITIONS: Number(config.repetitions),
|
|
118
|
+
OUTPUT_SELECT_SIZE: dimmerList.length,
|
|
119
|
+
};
|
|
120
|
+
dimmerList.forEach((item, i) => {
|
|
121
|
+
const index = i + 1;
|
|
122
|
+
paramset['COLOR_LIST_' + index] = Number(item.color);
|
|
123
|
+
paramset['ON_TIME_LIST_' + index] = Number(item.ontime);
|
|
124
|
+
});
|
|
125
|
+
return {paramset};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
case 'BSL_DIMMER_VIRTUAL_RECEIVER':
|
|
129
|
+
case 'OPTICAL_SIGNAL_RECEIVER': {
|
|
130
|
+
const paramset = {
|
|
131
|
+
LEVEL: config.dimmerLevel / 100,
|
|
132
|
+
RAMP_TIME_UNIT: config.rampTimeUnit,
|
|
133
|
+
RAMP_TIME_VALUE: Number(config.rampTimeValue),
|
|
134
|
+
DURATION_UNIT: config.durationUnit,
|
|
135
|
+
DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
|
|
136
|
+
COLOR: Number(config.dimmerColor),
|
|
137
|
+
};
|
|
138
|
+
if (hasColorBehaviour(config.channelType, description)) {
|
|
139
|
+
const list = description && description.COLOR_BEHAVIOUR && description.COLOR_BEHAVIOUR.VALUE_LIST;
|
|
140
|
+
paramset.COLOR_BEHAVIOUR = colorBehaviourValue(config.colorBehaviour, list);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {paramset};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
case 'ACOUSTIC_SIGNAL_VIRTUAL_RECEIVER': {
|
|
147
|
+
const soundList = normalizeList(config.soundList, 'sound');
|
|
148
|
+
const paramset = {
|
|
149
|
+
LEVEL: config.soundLevel / 100,
|
|
150
|
+
RAMP_TIME_UNIT: config.rampTimeUnit,
|
|
151
|
+
RAMP_TIME_VALUE: Number(config.rampTimeValue),
|
|
152
|
+
DURATION_UNIT: config.durationUnit,
|
|
153
|
+
DURATION_VALUE: Number.parseInt(config.durationValue, 10) || 0,
|
|
154
|
+
REPETITIONS: Number(config.repetitions),
|
|
155
|
+
OUTPUT_SELECT_SIZE: soundList.length,
|
|
156
|
+
};
|
|
157
|
+
soundList.forEach((item, i) => {
|
|
158
|
+
paramset['SOUNDFILE_LIST_' + (i + 1)] = Number(item.sound);
|
|
159
|
+
});
|
|
160
|
+
return {paramset};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
default:
|
|
164
|
+
throw new Error(`channelType ${config.channelType} unknown`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
module.exports = {
|
|
169
|
+
COLOR_BEHAVIOURS,
|
|
170
|
+
DEFAULT_COLOR_BEHAVIOUR,
|
|
171
|
+
colorBehaviourValue,
|
|
172
|
+
hasColorBehaviour,
|
|
173
|
+
normalizeList,
|
|
174
|
+
signalCommand,
|
|
175
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/* The HmIP-WRCD's display command (#144), pure: no connection, no Node-RED.
|
|
2
|
+
|
|
3
|
+
Channel 3 (ACOUSTIC_DISPLAY_RECEIVER) takes the five lines of the display and a
|
|
4
|
+
sound in one write of COMBINED_PARAMETER - a block in braces per line, the commit
|
|
5
|
+
in the last one, then a block for the sound:
|
|
6
|
+
|
|
7
|
+
{DDBC=WHITE,DDTC=BLACK,DDI=2,DDA=CENTER,DDS=Kitchen,DDID=1},
|
|
8
|
+
{DDBC=WHITE,DDTC=BLACK,DDI=0,DDA=LEFT,DDS=21.5 C,DDID=2,DDC=true},{R=1,IN=5,ANS=6}
|
|
9
|
+
|
|
10
|
+
DDBC/DDTC = background and text colour, DDI = the icon's number, DDA = alignment,
|
|
11
|
+
DDS = the text, DDID = the line, DDC = commit; R = repetitions, IN = seconds between
|
|
12
|
+
them, ANS = the sound's number. It is the text the CCU's own program dialog writes;
|
|
13
|
+
the entries are those of the channel's description (DISPLAY_DATA_ICON,
|
|
14
|
+
ACOUSTIC_NOTIFICATION_SELECTION). */
|
|
15
|
+
|
|
16
|
+
const LINES = 5;
|
|
17
|
+
const TEXT_LENGTH = 16;
|
|
18
|
+
|
|
19
|
+
/** DISPLAY_DATA_ICON's entries; the number sent is the index */
|
|
20
|
+
const ICONS = [
|
|
21
|
+
'NO_ICON',
|
|
22
|
+
'LAMP_OFF',
|
|
23
|
+
'LAMP_ON',
|
|
24
|
+
'PADLOCK_OPEN',
|
|
25
|
+
'PADLOCK_CLOSED',
|
|
26
|
+
'ERROR',
|
|
27
|
+
'EVERYTHING_OKAY',
|
|
28
|
+
'INFORMATION',
|
|
29
|
+
'NEW_MESSAGE',
|
|
30
|
+
'SERVICE_MESSAGE',
|
|
31
|
+
'SUN',
|
|
32
|
+
'MOON',
|
|
33
|
+
'WIND',
|
|
34
|
+
'CLOUD',
|
|
35
|
+
'THUNDERSTORM',
|
|
36
|
+
'DRIZZLE',
|
|
37
|
+
'CLOUD_AND_MOOON',
|
|
38
|
+
'RAIN',
|
|
39
|
+
'SNOW',
|
|
40
|
+
'CLOUD_AND_SUN',
|
|
41
|
+
'CLOUD_SUN_AND_RAIN',
|
|
42
|
+
'SNOWFLAKE',
|
|
43
|
+
'RAINDROP',
|
|
44
|
+
'FLAME',
|
|
45
|
+
'WINDOW_OPEN',
|
|
46
|
+
'SHUTTERS',
|
|
47
|
+
'ECO',
|
|
48
|
+
'PROTECTION_DEACTIVATED',
|
|
49
|
+
'EXTERNAL_PROTECTION',
|
|
50
|
+
'INTERNAL_PROTECTION',
|
|
51
|
+
'BELL',
|
|
52
|
+
'CLOCK',
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
/** ACOUSTIC_NOTIFICATION_SELECTION's entries; the number sent is the index */
|
|
56
|
+
const SOUNDS = [
|
|
57
|
+
'LOW_BATTERY',
|
|
58
|
+
'DISARMED',
|
|
59
|
+
'INTERNALLY_ARMED',
|
|
60
|
+
'EXTERNALLY_ARMED',
|
|
61
|
+
'DELAYED_INTERNALLY_ARMED',
|
|
62
|
+
'DELAYED_EXTERNALLY_ARMED',
|
|
63
|
+
'EVENT',
|
|
64
|
+
'ERROR',
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const ALIGNMENTS = {
|
|
68
|
+
LEFT: 'LEFT',
|
|
69
|
+
LINKS: 'LEFT',
|
|
70
|
+
CENTER: 'CENTER',
|
|
71
|
+
CENTRE: 'CENTER',
|
|
72
|
+
MITTE: 'CENTER',
|
|
73
|
+
ZENTRIERT: 'CENTER',
|
|
74
|
+
RIGHT: 'RIGHT',
|
|
75
|
+
RECHTS: 'RIGHT',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const COLORS = {
|
|
79
|
+
WHITE: 'WHITE',
|
|
80
|
+
WEISS: 'WHITE',
|
|
81
|
+
WEIß: 'WHITE',
|
|
82
|
+
BLACK: 'BLACK',
|
|
83
|
+
SCHWARZ: 'BLACK',
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** the display's stand-ins for the characters its table has in other places */
|
|
87
|
+
const CHARACTERS = {
|
|
88
|
+
Ä: '[',
|
|
89
|
+
Ö: '#',
|
|
90
|
+
Ü: '$',
|
|
91
|
+
ä: '²',
|
|
92
|
+
ö: '|',
|
|
93
|
+
ü: '³',
|
|
94
|
+
ß: '_',
|
|
95
|
+
'&': ']',
|
|
96
|
+
"'": 'µ',
|
|
97
|
+
// the command's own punctuation cannot be part of a text
|
|
98
|
+
',': '.',
|
|
99
|
+
'=': ':',
|
|
100
|
+
'{': '(',
|
|
101
|
+
'}': ')',
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** the stand-ins as text would otherwise show them: the characters they displace */
|
|
105
|
+
const DISPLACED = new Set(['[', ']', '#', '$', '|', '_']);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A line's text as the display takes it: sixteen characters of its table.
|
|
109
|
+
* @param {*} text
|
|
110
|
+
* @returns {string}
|
|
111
|
+
*/
|
|
112
|
+
function wrcdText(text) {
|
|
113
|
+
let out = '';
|
|
114
|
+
for (const c of String(text === undefined || text === null ? '' : text)) {
|
|
115
|
+
if (CHARACTERS[c]) {
|
|
116
|
+
out += CHARACTERS[c];
|
|
117
|
+
} else if (c >= ' ' && c <= '~' && !DISPLACED.has(c)) {
|
|
118
|
+
out += c;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return out.slice(0, TEXT_LENGTH);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* An entry's number from a number, a number as text or a name.
|
|
127
|
+
* @param {*} value
|
|
128
|
+
* @param {string[]} entries
|
|
129
|
+
* @returns {number} -1 = none of them
|
|
130
|
+
*/
|
|
131
|
+
function entryIndex(value, entries) {
|
|
132
|
+
if (value === undefined || value === null || value === '') {
|
|
133
|
+
return -1;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const text = String(value).trim();
|
|
137
|
+
const index = /^\d+$/.test(text) ? Number(text) : entries.indexOf(text.toUpperCase().replace(/[\s-]+/g, '_'));
|
|
138
|
+
return index >= 0 && index < entries.length ? index : -1;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function clamp(value, min, max, fallback) {
|
|
142
|
+
const number = Number.parseInt(value, 10);
|
|
143
|
+
if (Number.isNaN(number)) {
|
|
144
|
+
return fallback;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return Math.min(max, Math.max(min, number));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The COMBINED_PARAMETER text of one message.
|
|
152
|
+
* @param {object} lines per line (1 to 5) what to show: `{text, icon, align, color, background}`;
|
|
153
|
+
* a line that is missing stays as it is on the display
|
|
154
|
+
* @param {object} [sound] `{sound, repeat, interval}`; without a sound nothing is played
|
|
155
|
+
* @returns {string} empty when there is neither a line nor a sound
|
|
156
|
+
*/
|
|
157
|
+
function wrcdCommand(lines, sound) {
|
|
158
|
+
const blocks = [];
|
|
159
|
+
for (let i = 1; i <= LINES; i++) {
|
|
160
|
+
const line = lines && lines[i];
|
|
161
|
+
if (!line) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const upper = (value) => String(value === undefined || value === null ? '' : value).toUpperCase();
|
|
166
|
+
blocks.push(
|
|
167
|
+
[
|
|
168
|
+
'DDBC=' + (COLORS[upper(line.background).trim()] || 'WHITE'),
|
|
169
|
+
'DDTC=' + (COLORS[upper(line.color).trim()] || 'BLACK'),
|
|
170
|
+
'DDI=' + Math.max(0, entryIndex(line.icon, ICONS)),
|
|
171
|
+
'DDA=' + (ALIGNMENTS[upper(line.align).trim()] || 'CENTER'),
|
|
172
|
+
'DDS=' + wrcdText(line.text),
|
|
173
|
+
'DDID=' + i,
|
|
174
|
+
].join(','),
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (blocks.length > 0) {
|
|
179
|
+
blocks[blocks.length - 1] += ',DDC=true';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const number = sound ? entryIndex(sound.sound, SOUNDS) : -1;
|
|
183
|
+
if (number !== -1) {
|
|
184
|
+
blocks.push(
|
|
185
|
+
[
|
|
186
|
+
'R=' + clamp(sound.repeat, 0, 15, 0),
|
|
187
|
+
// seconds, in the steps of five the CCU's dialog offers
|
|
188
|
+
'IN=' + Math.round(clamp(sound.interval, 5, 80, 5) / 5) * 5,
|
|
189
|
+
'ANS=' + number,
|
|
190
|
+
].join(','),
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return blocks.map((block) => '{' + block + '}').join(',');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
module.exports = {ICONS, SOUNDS, LINES, TEXT_LENGTH, wrcdText, wrcdCommand};
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
anstelle der Konfiguration genutzt.</p>
|
|
6
6
|
<p>Mit <code>msg.disbleX</code> kann explizit gesetzt werden, dass keine Daten für die Zeile übertragen werden.</p>
|
|
7
7
|
|
|
8
|
+
<h3>HmIP-WRCD</h3>
|
|
9
|
+
<p>Der Wandtaster mit E-Paper-Display hat fünf Zeilen mit je 16 Zeichen, je Zeile ein Icon, die Ausrichtung, Textfarbe und Hintergrund (schwarz oder weiß), dazu einen Ton mit Wiederholungen und Abstand. Der Node schreibt alles in einem Befehl auf <code>COMBINED_PARAMETER</code> des Kanals 3. Eine Zeile mit „nicht verändern“ bleibt, wie sie ist.</p>
|
|
10
|
+
<p>Aus der Nachricht: <code>msg.lineX</code> (Text), <code>msg.iconX</code> (Nummer 0 bis 31 oder Name aus <code>DISPLAY_DATA_ICON</code>, z.B. <code>LAMP_ON</code>), <code>msg.colorX</code> und <code>msg.backgroundX</code> (<code>BLACK</code> oder <code>WHITE</code>), <code>msg.alignX</code> (<code>LEFT</code>, <code>CENTER</code>, <code>RIGHT</code>), <code>msg.disableX</code>.</p>
|
|
11
|
+
<p>Umlaute und ß werden für das Display umgesetzt. Komma, Gleichheitszeichen und geschweifte Klammern gehören zum Befehl selbst und werden als Punkt, Doppelpunkt und runde Klammern gesendet; Zeichen, die das Display nicht kennt, entfallen. Der HmIP-WRCD ist noch nicht an einem Gerät erprobt.</p>
|
|
12
|
+
|
|
8
13
|
<h3>Dynamische Konfiguration</h3>
|
|
9
14
|
<p><code>msg.config</code> ist ein Objekt, dessen Eigenschaften die Konfiguration dieses Nodes für genau diese Nachricht überschreiben. Die gespeicherte Konfiguration bleibt unverändert.</p>
|
|
10
15
|
<ul>
|
|
@@ -19,6 +24,7 @@
|
|
|
19
24
|
<li><code>color1 ... color6</code></li>
|
|
20
25
|
<li><code>icon1 ... icon6</code></li>
|
|
21
26
|
<li><code>disable1 ... disable6</code></li>
|
|
27
|
+
<li>HmIP-WRCD: <code>wrcdIcon1 ... wrcdIcon5</code>, <code>wrcdAlign1 ... wrcdAlign5</code>, <code>wrcdColor1 ... wrcdColor5</code>, <code>wrcdBackground1 ... wrcdBackground5</code>, <code>wrcdSound</code> (Nummer 0 bis 7 oder Name aus <code>ACOUSTIC_NOTIFICATION_SELECTION</code>), <code>wrcdRepeat</code> (0 bis 15), <code>wrcdInterval</code> (5 bis 80 Sekunden)</li>
|
|
22
28
|
</ul>
|
|
23
29
|
<p><code>msg.line1</code> usw. funktionieren unverändert weiter.</p>
|
|
24
30
|
</script>
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"repeat": "Wiederholungen",
|
|
10
10
|
"infinity": "Unendlich",
|
|
11
11
|
"off": "Aus",
|
|
12
|
-
"long_long":"Lang Lang",
|
|
13
|
-
"long_short":"Lang Kurz",
|
|
14
|
-
"long_short_short":"Lang Kurz Kurz",
|
|
15
|
-
"short":"Kurz",
|
|
16
|
-
"short_short":"Kurz Kurz",
|
|
17
|
-
"long":"Lang",
|
|
12
|
+
"long_long": "Lang Lang",
|
|
13
|
+
"long_short": "Lang Kurz",
|
|
14
|
+
"long_short_short": "Lang Kurz Kurz",
|
|
15
|
+
"short": "Kurz",
|
|
16
|
+
"short_short": "Kurz Kurz",
|
|
17
|
+
"long": "Lang",
|
|
18
18
|
"seconds": "Sekunden",
|
|
19
19
|
"red": "Rot",
|
|
20
20
|
"green": "Grün",
|
|
@@ -23,15 +23,75 @@
|
|
|
23
23
|
"yellow": "Gelb",
|
|
24
24
|
"blue": "Blau",
|
|
25
25
|
"on": "Ein",
|
|
26
|
-
"open":"Offen",
|
|
27
|
-
"close":"Geschlossen",
|
|
28
|
-
"error":"Fehler",
|
|
29
|
-
"ok":"Ok",
|
|
30
|
-
"information":"Information",
|
|
31
|
-
"new_message":"Neue Nachricht",
|
|
26
|
+
"open": "Offen",
|
|
27
|
+
"close": "Geschlossen",
|
|
28
|
+
"error": "Fehler",
|
|
29
|
+
"ok": "Ok",
|
|
30
|
+
"information": "Information",
|
|
31
|
+
"new_message": "Neue Nachricht",
|
|
32
32
|
"service_message": "Servicemeldung",
|
|
33
|
-
"signal_green":"Signal Grün",
|
|
34
|
-
"signal_yellow":"Signal Gelb",
|
|
35
|
-
"signal_red":"Signal Rot"
|
|
33
|
+
"signal_green": "Signal Grün",
|
|
34
|
+
"signal_yellow": "Signal Gelb",
|
|
35
|
+
"signal_red": "Signal Rot",
|
|
36
|
+
"wrcd": {
|
|
37
|
+
"style": "Darstellung",
|
|
38
|
+
"align": "Ausrichtung",
|
|
39
|
+
"left": "Links",
|
|
40
|
+
"center": "Mitte",
|
|
41
|
+
"right": "Rechts",
|
|
42
|
+
"textColor": "Textfarbe",
|
|
43
|
+
"textBlack": "Text schwarz",
|
|
44
|
+
"textWhite": "Text weiß",
|
|
45
|
+
"background": "Hintergrund",
|
|
46
|
+
"onWhite": "auf Weiß",
|
|
47
|
+
"onBlack": "auf Schwarz",
|
|
48
|
+
"noRepeat": "Keine",
|
|
49
|
+
"interval": "Abstand",
|
|
50
|
+
"tip": "HmIP-WRCD: je Zeile 16 Zeichen. Eine Zeile mit „nicht verändern“ bleibt, wie sie ist. Noch nicht an einem Gerät erprobt.",
|
|
51
|
+
"icon": {
|
|
52
|
+
"NO_ICON": "Kein Icon",
|
|
53
|
+
"LAMP_OFF": "Lampe aus",
|
|
54
|
+
"LAMP_ON": "Lampe ein",
|
|
55
|
+
"PADLOCK_OPEN": "Schloss offen",
|
|
56
|
+
"PADLOCK_CLOSED": "Schloss geschlossen",
|
|
57
|
+
"ERROR": "Fehler",
|
|
58
|
+
"EVERYTHING_OKAY": "Alles in Ordnung",
|
|
59
|
+
"INFORMATION": "Information",
|
|
60
|
+
"NEW_MESSAGE": "Neue Nachricht",
|
|
61
|
+
"SERVICE_MESSAGE": "Servicemeldung",
|
|
62
|
+
"SUN": "Sonne",
|
|
63
|
+
"MOON": "Mond",
|
|
64
|
+
"WIND": "Wind",
|
|
65
|
+
"CLOUD": "Wolke",
|
|
66
|
+
"THUNDERSTORM": "Gewitter",
|
|
67
|
+
"DRIZZLE": "Nieselregen",
|
|
68
|
+
"CLOUD_AND_MOOON": "Wolke und Mond",
|
|
69
|
+
"RAIN": "Regen",
|
|
70
|
+
"SNOW": "Schnee",
|
|
71
|
+
"CLOUD_AND_SUN": "Wolke und Sonne",
|
|
72
|
+
"CLOUD_SUN_AND_RAIN": "Wolke, Sonne und Regen",
|
|
73
|
+
"SNOWFLAKE": "Schneeflocke",
|
|
74
|
+
"RAINDROP": "Regentropfen",
|
|
75
|
+
"FLAME": "Flamme",
|
|
76
|
+
"WINDOW_OPEN": "Fenster offen",
|
|
77
|
+
"SHUTTERS": "Rollladen",
|
|
78
|
+
"ECO": "Eco",
|
|
79
|
+
"PROTECTION_DEACTIVATED": "Schutz aus",
|
|
80
|
+
"EXTERNAL_PROTECTION": "Außenschutz",
|
|
81
|
+
"INTERNAL_PROTECTION": "Innenschutz",
|
|
82
|
+
"BELL": "Glocke",
|
|
83
|
+
"CLOCK": "Uhr"
|
|
84
|
+
},
|
|
85
|
+
"sound": {
|
|
86
|
+
"LOW_BATTERY": "Batterie leer",
|
|
87
|
+
"DISARMED": "Unscharf",
|
|
88
|
+
"INTERNALLY_ARMED": "Intern scharf",
|
|
89
|
+
"EXTERNALLY_ARMED": "Extern scharf",
|
|
90
|
+
"DELAYED_INTERNALLY_ARMED": "Verzögert intern scharf",
|
|
91
|
+
"DELAYED_EXTERNALLY_ARMED": "Verzögert extern scharf",
|
|
92
|
+
"EVENT": "Ereignis",
|
|
93
|
+
"ERROR": "Fehler"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
36
96
|
}
|
|
37
|
-
}
|
|
97
|
+
}
|
|
@@ -28,4 +28,9 @@
|
|
|
28
28
|
</dl>
|
|
29
29
|
</li>
|
|
30
30
|
</ol>
|
|
31
|
+
|
|
32
|
+
<h3>Topic</h3>
|
|
33
|
+
<p><code>msg.topic</code> wird aus dem Feld <i>Topic</i> gebildet; <code>${Name}</code> steht für den Namen des Programms.
|
|
34
|
+
Ein neu platzierter Node hat <code>hm/status/program/${Name}</code>; ein schon vorhandener Node behält sein Topic
|
|
35
|
+
(<code>ReGaHSS/${Name}</code> bis 4.16.0).</p>
|
|
31
36
|
</script>
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<li><code>opticalAlarmSelection</code></li>
|
|
22
22
|
<li><code>dimmerLevel</code></li>
|
|
23
23
|
<li><code>dimmerColor</code></li>
|
|
24
|
+
<li><code>colorBehaviour</code>: wie die LED eines HmIP-BSL ab Firmware 2.x oder eines HmIPW-WRC6 leuchtet, als Zahl oder Name aus <code>COLOR_BEHAVIOUR</code> (<code>0</code>/<code>OFF</code>, <code>1</code>/<code>ON</code>, <code>BLINKING_SLOW</code>, <code>BLINKING_MIDDLE</code>, <code>BLINKING_FAST</code>, <code>FLASH_SLOW</code>, <code>FLASH_MIDDLE</code>, <code>FLASH_FAST</code>, <code>BILLOW_SLOW</code>, <code>BILLOW_MIDDLE</code>, <code>BILLOW_FAST</code>, <code>OLD_VALUE</code>). Ohne Angabe: <code>ON</code>. An einen HmIP-BSL mit Firmware 1.x wird es nicht gesendet.</li>
|
|
24
25
|
<li><code>dimmerList</code></li>
|
|
25
26
|
<li><code>soundLevel</code></li>
|
|
26
27
|
<li><code>soundList</code></li>
|