node-red-contrib-ccu 4.18.0 → 4.18.1
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 +35 -0
- package/nodes/ccu-connection.js +49 -0
- package/nodes/lib/cast.js +44 -1
- package/nodes/lib/hadiscovery.js +2 -1
- package/nodes/lib/haroles.js +9 -2
- package/nodes/lib/lite.js +19 -0
- package/nodes/lib/message.js +7 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,41 @@ 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.18.1 (2026-12-03)
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Text values from the virtual heating groups.** The CCU's interface of the
|
|
13
|
+
virtual heating groups (`VirtualDevices`) reports many datapoints as untyped
|
|
14
|
+
values, which arrived as text: `"false"` for a battery or reachability
|
|
15
|
+
state - which every flow and every node that tests the value takes as true -
|
|
16
|
+
and `"20.0"` for a temperature. A text value reported for a datapoint whose
|
|
17
|
+
description says BOOL, ACTION, FLOAT, INTEGER or ENUM is now converted to
|
|
18
|
+
that type before it reaches the value cache, the nodes and `msg.payload`.
|
|
19
|
+
Text that is no value of the type, and every datapoint of type STRING, stays
|
|
20
|
+
as it is.
|
|
21
|
+
- **openccu-lite: a value the system found without an event stayed
|
|
22
|
+
unknown until the next deploy.** The system's state store reports what it
|
|
23
|
+
reads itself - at its start, after a write to a virtual heating group
|
|
24
|
+
(which sends no event while it has no members), from a device's maintenance
|
|
25
|
+
channel - as a state message, not as a device's event. The connection took
|
|
26
|
+
such a message only into the picture it reads when it connects, never
|
|
27
|
+
afterwards. Now a state message whose value differs from the cached one
|
|
28
|
+
updates the value cache and reaches the nodes the way a cached value does
|
|
29
|
+
at start (`msg.cache` true): nodes that take cached values see it, flows
|
|
30
|
+
that only take events are not triggered by it. A key press is never taken
|
|
31
|
+
this way.
|
|
32
|
+
- **Home Assistant: the internal temperature of HmIP actuators is a
|
|
33
|
+
diagnostic entity.** HmIP actuators (HmIP-BROLL, -BSM, -FSM, -PS, -MOD-OC8
|
|
34
|
+
and others) report `ACTUAL_TEMPERATURE` on their maintenance channel 0: the
|
|
35
|
+
temperature inside the device, not the room's. The Home Assistant node
|
|
36
|
+
announced it as an ordinary temperature sensor, so Home Assistant and
|
|
37
|
+
whatever builds on its discovery could take it for a room temperature. It
|
|
38
|
+
now carries `entity_category: diagnostic`, like the other values of
|
|
39
|
+
channel 0. `ACTUAL_TEMPERATURE` of thermostats, wall thermostats and
|
|
40
|
+
temperature sensors is unchanged, and so are all topics, payloads and
|
|
41
|
+
entity IDs.
|
|
42
|
+
|
|
8
43
|
## 4.18.0 (2026-11-30)
|
|
9
44
|
|
|
10
45
|
### Added
|
package/nodes/ccu-connection.js
CHANGED
|
@@ -3037,6 +3037,7 @@ module.exports = function (RED) {
|
|
|
3037
3037
|
}
|
|
3038
3038
|
},
|
|
3039
3039
|
onValues: (values) => this.applyLiteValues(values),
|
|
3040
|
+
onState: (event) => this.applyLiteState(event),
|
|
3040
3041
|
});
|
|
3041
3042
|
this.logger.info(
|
|
3042
3043
|
'lite-rpc: ' + ifaces.join(', ') + ' through ' + url + ' (occulite-client), no callback server',
|
|
@@ -5424,6 +5425,54 @@ module.exports = function (RED) {
|
|
|
5424
5425
|
return false;
|
|
5425
5426
|
}
|
|
5426
5427
|
|
|
5428
|
+
/**
|
|
5429
|
+
* One value of the state store's picture that changed after it was taken: the store's sweep,
|
|
5430
|
+
* its re-read of a virtual heating group after a write, or a maintenance read found a value
|
|
5431
|
+
* no event announced. It goes into the values cache and to the nodes as the picture does -
|
|
5432
|
+
* a cached value (`cache: true`), not a device's event - and only when it differs from what
|
|
5433
|
+
* the cache holds: a confirmation of the same value is nothing new.
|
|
5434
|
+
* @param {{interface: string, address: string, key: string, value: *, ts?: number, lc?: number, confirmed?: boolean}} event
|
|
5435
|
+
*/
|
|
5436
|
+
applyLiteState(event) {
|
|
5437
|
+
const {interface: iface, address: channel, key: datapoint} = event || {};
|
|
5438
|
+
if (
|
|
5439
|
+
!this.litePictured ||
|
|
5440
|
+
!channel ||
|
|
5441
|
+
!datapoint ||
|
|
5442
|
+
!this.liteWants(iface) ||
|
|
5443
|
+
iface === this.logicIface ||
|
|
5444
|
+
datapoint.startsWith('PRESS_')
|
|
5445
|
+
) {
|
|
5446
|
+
return;
|
|
5447
|
+
}
|
|
5448
|
+
|
|
5449
|
+
const datapointName = iface + '.' + channel + '.' + datapoint;
|
|
5450
|
+
const cached = this.values[datapointName];
|
|
5451
|
+
const ts = event.ts || now();
|
|
5452
|
+
const message = this.createMessage(iface, channel, datapoint, event.value, {
|
|
5453
|
+
cache: true,
|
|
5454
|
+
change: false,
|
|
5455
|
+
working: false,
|
|
5456
|
+
uncertain: event.confirmed === false,
|
|
5457
|
+
ts,
|
|
5458
|
+
lc: event.lc || ts,
|
|
5459
|
+
});
|
|
5460
|
+
if (cached && cached.value === message.value) {
|
|
5461
|
+
if (cached.uncertain && !message.uncertain) {
|
|
5462
|
+
// confirmed: the same value, now a certain one
|
|
5463
|
+
this.values[datapointName] = message;
|
|
5464
|
+
}
|
|
5465
|
+
|
|
5466
|
+
return;
|
|
5467
|
+
}
|
|
5468
|
+
|
|
5469
|
+
this.logger.debug(
|
|
5470
|
+
'lite-rpc: the state store reports ' + datapointName + ' = ' + JSON.stringify(message.value),
|
|
5471
|
+
);
|
|
5472
|
+
this.values[datapointName] = message;
|
|
5473
|
+
this.callCallbacks(message);
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5427
5476
|
/**
|
|
5428
5477
|
*
|
|
5429
5478
|
* @param filter
|
package/nodes/lib/cast.js
CHANGED
|
@@ -148,4 +148,47 @@ function castSysvar(value, sysvar) {
|
|
|
148
148
|
return value;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
/**
|
|
152
|
+
* A value an interface process reported, as its paramset type. hmipserver's interface of the
|
|
153
|
+
* virtual heating groups (VirtualDevices) answers many datapoints as untyped XML-RPC values, which
|
|
154
|
+
* arrive as strings: `"false"` for a BOOL - truthy in every flow that takes it as it comes -,
|
|
155
|
+
* `"20.0"` for a FLOAT. Only a string is ever changed, and only where it is a value of the type
|
|
156
|
+
* (BOOL, ACTION, FLOAT, INTEGER, ENUM); everything else comes back as it is.
|
|
157
|
+
* @param {*} value
|
|
158
|
+
* @param {string} [type] the description's TYPE
|
|
159
|
+
* @returns {*}
|
|
160
|
+
*/
|
|
161
|
+
function castReported(value, type) {
|
|
162
|
+
if (typeof value !== 'string') {
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const text = value.trim();
|
|
167
|
+
if (type === 'BOOL' || type === 'ACTION') {
|
|
168
|
+
if (text === 'true' || text === '1') {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (text === 'false' || text === '0') {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return value;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (text === '' || !Number.isFinite(Number(text))) {
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (type === 'FLOAT') {
|
|
184
|
+
return Number(text);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if ((type === 'INTEGER' || type === 'ENUM') && Number.isInteger(Number(text))) {
|
|
188
|
+
return Number(text);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
module.exports = {castValue, castReported, castSysvar, enumList};
|
package/nodes/lib/hadiscovery.js
CHANGED
|
@@ -843,9 +843,10 @@ function deviceBlock(ctx, iface, device) {
|
|
|
843
843
|
const writable = Boolean(ops & 2);
|
|
844
844
|
const dpLabel = ch.index === 0 && ch.role === 'maintenance' ? prettify(dp) : `${label} ${prettify(dp)}`;
|
|
845
845
|
const enabled = facts.enabled === true;
|
|
846
|
+
const entCat = facts.ent_cat || (ch.index === 0 && facts.ent_cat_ch0);
|
|
846
847
|
const common = {
|
|
847
848
|
...(facts.dev_cla && {dev_cla: facts.dev_cla}),
|
|
848
|
-
...(
|
|
849
|
+
...(entCat && {ent_cat: entCat}),
|
|
849
850
|
...(!enabled && {en: false}),
|
|
850
851
|
};
|
|
851
852
|
// sensor/number accept only their own device classes, select none at all
|
package/nodes/lib/haroles.js
CHANGED
|
@@ -137,10 +137,17 @@ function isFraction(description) {
|
|
|
137
137
|
/**
|
|
138
138
|
* Home Assistant facts of a datapoint by name: device class, state class, unit override,
|
|
139
139
|
* entity category, enabled by default. Anything not listed is a plain sensor / binary_sensor,
|
|
140
|
-
* disabled by default.
|
|
140
|
+
* disabled by default. `ent_cat_ch0` is the entity category the datapoint has on channel 0
|
|
141
|
+
* only: there ACTUAL_TEMPERATURE is the temperature inside an HmIP actuator, not a room's.
|
|
141
142
|
*/
|
|
142
143
|
const PARAMETERS = {
|
|
143
|
-
ACTUAL_TEMPERATURE: {
|
|
144
|
+
ACTUAL_TEMPERATURE: {
|
|
145
|
+
dev_cla: 'temperature',
|
|
146
|
+
stat_cla: 'measurement',
|
|
147
|
+
unit: '°C',
|
|
148
|
+
enabled: true,
|
|
149
|
+
ent_cat_ch0: 'diagnostic',
|
|
150
|
+
},
|
|
144
151
|
TEMPERATURE: {dev_cla: 'temperature', stat_cla: 'measurement', unit: '°C', enabled: true},
|
|
145
152
|
SET_POINT_TEMPERATURE: {dev_cla: 'temperature', unit: '°C'},
|
|
146
153
|
SET_TEMPERATURE: {dev_cla: 'temperature', unit: '°C'},
|
package/nodes/lib/lite.js
CHANGED
|
@@ -284,6 +284,9 @@ class LiteConnection {
|
|
|
284
284
|
* @param {function(string, string)} options.onInterface (iface, state): up | down | restarted | added | removed
|
|
285
285
|
* @param {function(string)} options.onStatus the client's state: connecting | ready | degraded | offline | closed
|
|
286
286
|
* @param {function(Map)} [options.onValues] box.values once ready (the state store's picture)
|
|
287
|
+
* @param {function(object)} [options.onState] one value of the picture the state store reported after the
|
|
288
|
+
* picture was taken ({interface, address, key, value, ts, lc, confirmed, source}): its sweep or a re-read
|
|
289
|
+
* found it, no event of a device announced it
|
|
287
290
|
* @param {object} options.logger {debug, info, warn, error}
|
|
288
291
|
* @param {number} [options.timeout] per request, ms
|
|
289
292
|
* @param {Function} [options.createClient] for tests, in place of new OccuLite()
|
|
@@ -404,6 +407,22 @@ class LiteConnection {
|
|
|
404
407
|
this.options.onInterface(event.interface, event.state);
|
|
405
408
|
}
|
|
406
409
|
});
|
|
410
|
+
// The state store's own reports (source sweep or restored: its sweep, the re-read after a write to
|
|
411
|
+
// a virtual heating group, a maintenance read) are no device events - the callback table does not
|
|
412
|
+
// get them - but they are the picture changing: a group without members never sends an event for
|
|
413
|
+
// its set point, the store reads it again and says so.
|
|
414
|
+
box.on('value', (event) => {
|
|
415
|
+
if (
|
|
416
|
+
!this.closed &&
|
|
417
|
+
this.box === box &&
|
|
418
|
+
this.ready &&
|
|
419
|
+
this.options.onState &&
|
|
420
|
+
event &&
|
|
421
|
+
(event.source === 'sweep' || event.source === 'restored')
|
|
422
|
+
) {
|
|
423
|
+
this.options.onState(event);
|
|
424
|
+
}
|
|
425
|
+
});
|
|
407
426
|
box.on('resync', () => {
|
|
408
427
|
if (!this.closed && this.box === box && this.options.onValues) {
|
|
409
428
|
this.options.onValues(box.values);
|
package/nodes/lib/message.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @param {object} [additions] merged into the message (cache, working, uncertain, ts, lc, ...)
|
|
19
19
|
* @returns {object} the message
|
|
20
20
|
*/
|
|
21
|
-
const {enumList} = require('./cast.js');
|
|
21
|
+
const {enumList, castReported} = require('./cast.js');
|
|
22
22
|
|
|
23
23
|
function createMessage(ccu, iface, channel, datapoint, payload, additions) {
|
|
24
24
|
const datapointName = iface + '.' + channel + '.' + datapoint;
|
|
@@ -33,14 +33,18 @@ function createMessage(ccu, iface, channel, datapoint, payload, additions) {
|
|
|
33
33
|
const ts = Date.now();
|
|
34
34
|
let change = false;
|
|
35
35
|
|
|
36
|
-
const valueStable = additions && additions.working ? ccu.values[datapointName].valueStable : payload;
|
|
37
|
-
|
|
38
36
|
let description = {};
|
|
39
37
|
if (ccu.metadata.devices[iface] && ccu.metadata.devices[iface][channel]) {
|
|
40
38
|
description =
|
|
41
39
|
ccu.getParamsetDescription(iface, ccu.metadata.devices[iface][channel], 'VALUES', datapoint) || {};
|
|
42
40
|
}
|
|
43
41
|
|
|
42
|
+
// the virtual heating groups' interface reports untyped values, which arrive as strings
|
|
43
|
+
// ("false", "20.0"): the message carries them as the datapoint's type
|
|
44
|
+
payload = castReported(payload, description.TYPE);
|
|
45
|
+
|
|
46
|
+
const valueStable = additions && additions.working ? ccu.values[datapointName].valueStable : payload;
|
|
47
|
+
|
|
44
48
|
if (
|
|
45
49
|
description.TYPE === 'ACTION' ||
|
|
46
50
|
ccu.values[datapointName].cache ||
|