node-red-contrib-ccu 3.4.1 → 4.0.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.
Files changed (49) hide show
  1. package/.prettierignore +10 -0
  2. package/.prettierrc +14 -0
  3. package/AGENTS.md +96 -0
  4. package/CHANGELOG.md +66 -0
  5. package/README.md +17 -21
  6. package/ROADMAP.md +402 -0
  7. package/eslint.config.js +45 -0
  8. package/examples/rpc-events.json +65 -0
  9. package/examples/switch-datapoint.json +86 -0
  10. package/examples/system-variable.json +60 -0
  11. package/nodes/ccu-alexa.html +12 -7
  12. package/nodes/ccu-alexa.js +43 -15
  13. package/nodes/ccu-connection.html +9 -1
  14. package/nodes/ccu-connection.js +602 -337
  15. package/nodes/ccu-display.html +11 -4
  16. package/nodes/ccu-display.js +26 -9
  17. package/nodes/ccu-get-value.html +23 -14
  18. package/nodes/ccu-get-value.js +10 -5
  19. package/nodes/ccu-mqtt.html +9 -10
  20. package/nodes/ccu-mqtt.js +55 -29
  21. package/nodes/ccu-program.html +1 -1
  22. package/nodes/ccu-program.js +9 -7
  23. package/nodes/ccu-rpc-event.html +12 -7
  24. package/nodes/ccu-rpc-event.js +4 -5
  25. package/nodes/ccu-rpc.html +12 -5
  26. package/nodes/ccu-rpc.js +8 -6
  27. package/nodes/ccu-script.html +1 -1
  28. package/nodes/ccu-script.js +4 -3
  29. package/nodes/ccu-set-value.html +11 -7
  30. package/nodes/ccu-set-value.js +47 -16
  31. package/nodes/ccu-signal.html +11 -5
  32. package/nodes/ccu-signal.js +34 -23
  33. package/nodes/ccu-switch.html +23 -13
  34. package/nodes/ccu-sysvar.html +1 -1
  35. package/nodes/ccu-sysvar.js +11 -7
  36. package/nodes/ccu-value.html +12 -7
  37. package/nodes/ccu-value.js +36 -13
  38. package/nodes/lib/base62.js +22 -0
  39. package/nodes/lib/discover.js +127 -0
  40. package/nodes/lib/nextport.js +30 -0
  41. package/nodes/lib/similarity.js +51 -0
  42. package/nodes/lib/status.js +1 -1
  43. package/package.json +105 -144
  44. package/roadmap-archive/README.md +20 -0
  45. package/roadmap-archive/phase-1.md +48 -0
  46. package/roadmap-archive/todo-history.md +39 -0
  47. package/TODO.md +0 -41
  48. package/ccu_rega_localhost.json +0 -1
  49. package/ccu_values_localhost.json +0 -1
@@ -0,0 +1,10 @@
1
+ node_modules
2
+ coverage
3
+ package-lock.json
4
+ paramsets.json
5
+ nodes/**/*.html
6
+ nodes/locales
7
+ nodes/ccu-switch.js
8
+ tools/paramsets-join.js
9
+ test/simulator-data
10
+ docs
package/.prettierrc ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "tabWidth": 4,
3
+ "singleQuote": true,
4
+ "bracketSpacing": false,
5
+ "printWidth": 120,
6
+ "overrides": [
7
+ {
8
+ "files": ["*.json", "*.yml", "*.yaml", "*.md"],
9
+ "options": {
10
+ "tabWidth": 2
11
+ }
12
+ }
13
+ ]
14
+ }
package/AGENTS.md ADDED
@@ -0,0 +1,96 @@
1
+ # Agent Instructions
2
+
3
+ Instructions for AI coding agents (Claude Code, etc.) working in this repository.
4
+
5
+ ## Project overview
6
+
7
+ `node-red-contrib-ccu` provides Node-RED nodes to connect to a Homematic CCU
8
+ (BidCos/HmIP/CUxD home automation hardware from eQ-3). It talks to the CCU
9
+ via BINRPC/XMLRPC (`nodes/ccu-connection.js` holds the bulk of the connection
10
+ and RPC logic) and via ReGaHSS remote scripts.
11
+
12
+ Layout:
13
+
14
+ - `nodes/` — one `.js` (server-side logic) + `.html` (editor UI/registration)
15
+ pair per node type. `nodes/lib/` has shared helpers, `nodes/icons/` and
16
+ `nodes/locales/` are editor assets/i18n.
17
+ - `test/` — mocha specs (`*_spec.js`), plus `test/simulator-data` and
18
+ `test/simulator-behaviors` used with `hm-simulator` to fake a CCU for tests.
19
+ - `tools/` — one-off scripts, not part of the published package.
20
+ - `paramsets.json` — large generated/vendored data file describing CCU device
21
+ paramsets (datapoints). Treat as data, not something to hand-edit.
22
+ - `docs/` — images referenced from README.md.
23
+
24
+ ## Roadmap
25
+
26
+ Planned work lives in ROADMAP.md (stable IDs: `D-n` decisions, `B-n`
27
+ backlog, `OQ-n` open questions — never reuse an ID). When an item is
28
+ completed, move its content to `roadmap-archive/<ID>.md` (one file per
29
+ item), list it in `roadmap-archive/README.md`, and mark its line in the
30
+ ROADMAP.md contents with ✅ linking to the archive file. Read ROADMAP.md
31
+ before starting work that might overlap with a decision recorded there.
32
+
33
+ ## Reference documentation
34
+
35
+ For anything involving HomematicIP (HmIP) devices, channels, or datapoints
36
+ (paramset names, value ranges, units, ENUM meanings, which channel a
37
+ datapoint belongs to, etc.), consult the official eQ-3 documentation:
38
+
39
+ https://www.eq-3.de/Downloads/eq3/download%20bereich/hm_web_ui_doku/HmIP_Device_Documentation.pdf
40
+
41
+ This PDF is the authoritative source for HmIP device/channel/datapoint
42
+ definitions — prefer it over guessing when adding or fixing paramset
43
+ handling, value casting, or device-specific logic.
44
+
45
+ For CUxD-specific devices/channels/datapoints, consult the docs in the
46
+ cuxd project itself:
47
+
48
+ https://github.com/jens-maus/cuxd/tree/master/docs
49
+
50
+ ## Related fork worth checking
51
+
52
+ https://github.com/ptweety/node-red-contrib-ccu is an active fork of this
53
+ repo (currently at v3.6.2 vs. our v3.4.2). Not all of its direction is
54
+ necessarily wanted here, but it has diverged with changes that may be worth
55
+ cherry-picking individually — evaluate case by case rather than bulk-merging.
56
+ Known differences as of 2026-07:
57
+
58
+ - Added CCU-Jack as a supported interface.
59
+ - Dropped dependencies: `mqtt-wildcard`, `nextport`, `hm-discover`, and a
60
+ `promise.prototype.finally` polyfill.
61
+ - Split build into separate JS/HTML build steps; moved node help texts into
62
+ a restructured `locales/` layout.
63
+ - Tooling churn: `nyc` → `c8` for coverage, bumped `xo`/`eslint`/`mocha`/
64
+ `husky`/`node-red` devDependency versions, added `auto-changelog`.
65
+ - Added `MIGRATION.md`/contribution guidelines docs.
66
+
67
+ When a task here touches an area also changed upstream in that fork (e.g.
68
+ interface handling, build/lint tooling, locale structure), check what they
69
+ did before implementing from scratch — but confirm it still fits this
70
+ repo's compatibility floors (Node >= 20, Node-RED >= 4.0) before porting.
71
+
72
+ ## Conventions
73
+
74
+ - Code style: ESLint 9 (flat config, `eslint.config.js`) + Prettier
75
+ (`.prettierrc`, 4-space, 120 cols). `npm run lint` checks both,
76
+ `npm run format` auto-fixes. Let a failing lint stop you.
77
+ - Tests: `npm run test:unit` runs mocha over `test/**/*_spec.js` against
78
+ `hm-simulator`; `npm test` = lint + tests; `npm run test:cov` adds c8
79
+ coverage.
80
+ - Each node's `.js` and `.html` files must stay in sync — the `.html`
81
+ defines the editor palette entry, config form, and help text; the `.js`
82
+ registers the runtime node type with the same name.
83
+ - `nodes/ccu-switch.js`/`.html` and `tools/paramsets-join.js` are excluded
84
+ from linting (see `eslint.config.js` ignores and `.prettierignore`) —
85
+ legacy exclusions to burn down.
86
+
87
+ ## Working here
88
+
89
+ - Do not hand-edit `paramsets.json`; if it needs updating, look at how
90
+ `tools/paramsets-join.js` produces it.
91
+ - This addon is also shipped inside RedMatic (a Node-RED distribution for
92
+ CCU3/RaspberryMatic) — avoid breaking changes to node config schemas
93
+ without considering migration for existing flows.
94
+ - Supported floors as of 4.0: Node.js >= 20, Node-RED >= 4.0; the primary
95
+ target is Node-RED 5 on Node 24 (see ROADMAP.md D-1). Stay CommonJS
96
+ (D-2).
package/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Changelog
2
+
3
+ Notable changes to node-red-contrib-ccu. Format follows
4
+ [Keep a Changelog](https://keepachangelog.com/); entries describe the
5
+ user-visible symptom and the cause, not the commit list (the release notes
6
+ append commits automatically).
7
+
8
+ ## 4.0.0 (2026-09-02)
9
+
10
+ ### Breaking
11
+
12
+ - Requires Node.js >= 20 and Node-RED >= 4.0 (previously Node 10 /
13
+ Node-RED 1.0). The primary supported target is Node-RED 5 on Node 24.
14
+ Flows and node configurations are unchanged — existing flows import as
15
+ before.
16
+
17
+ ### Added
18
+
19
+ - Importable example flows (`examples/`, shown in the editor's import
20
+ dialog): switching a datapoint, receiving RPC events, reading and
21
+ setting a system variable.
22
+ - CCU-Jack can be enabled as an additional interface on the connection
23
+ node (XMLRPC on port 2121, or 2122 with TLS; port configurable). CCU
24
+ discovery now probes for CCU-Jack as well. Based on PR #162, closes
25
+ #164.
26
+
27
+ ### Changed
28
+
29
+ - `homematic-rega` 1.5 -> 2.0 and `homematic-xmlrpc` 1.0 -> 2.0. This
30
+ removes the long-deprecated `request` package and the fragile
31
+ xmlbuilder GitHub-tarball reference from the dependency tree; ReGa
32
+ timestamps are now converted inside the library, and the "uncertain
33
+ value" detection (ReGa reporting 1970-01-01) works on the timestamp
34
+ itself instead of a locale-dependent string compare. Requires Node
35
+ 20.19+/22.12+ (`require(esm)`).
36
+ - Runtime dependencies reduced from 10 to 4: the deprecated
37
+ `string-similarity` package was replaced by an internal implementation
38
+ with identical results, `hm-discover`, `nextport` and `buffer-base62`
39
+ were vendored (the latter two rewritten without their abandoned
40
+ transitive dependencies), the `promise.prototype.finally` polyfill
41
+ (a no-op since Node 10) was dropped, and `obj-ease` moved to
42
+ devDependencies. Fewer install warnings, smaller install. (#176)
43
+ - Tooling modernized: ESLint 9 + Prettier replace xo, c8 replaces
44
+ nyc/coveralls, mocha 11 and node-red-node-test-helper 0.3.6 run the
45
+ test suite against Node-RED 4.x, GitHub Actions CI covers Node
46
+ 20/22/24 x Node-RED 4/5, releases publish to npm via OIDC trusted
47
+ publishing with provenance.
48
+
49
+ ### Fixed
50
+
51
+ - Node-RED no longer crashes when the CCU connection drops at an
52
+ unfortunate moment: binrpc 3.3.2 adds the missing socket error
53
+ listener (a response arriving after a timeout killed the whole
54
+ process) and stops the methodCall callback from firing twice on
55
+ failed connections. (#160)
56
+ - The value node no longer writes to the CCU when the incoming message
57
+ has no `payload` (previously `undefined` was passed to setValue).
58
+ From PR #173.
59
+ - On Node-RED 4.x, node configuration dialogs had to be opened several
60
+ times before the interface/device/channel/datapoint selects populated.
61
+ The editor now triggers the initial load itself instead of relying on
62
+ a change event Node-RED 4 no longer fires reliably, retries when the
63
+ config node is not yet available in the runtime, and no longer wedges
64
+ itself when the request fails or the config node is still unsaved.
65
+ - Removed 46 debug `console.log` statements that the node configuration
66
+ dialogs wrote to the browser console.
package/README.md CHANGED
@@ -1,35 +1,32 @@
1
1
  # node-red-contrib-ccu
2
2
 
3
- [![NPM version](https://badge.fury.io/js/node-red-contrib-ccu.svg)](http://badge.fury.io/js/node-red-contrib-ccu)
4
- [![Dependencies Status](https://david-dm.org/rdmtc/node-red-contrib-ccu/status.svg)](https://david-dm.org/rdmtc/node-red-contrib-ccu)
5
- [![Build Status](https://travis-ci.org/rdmtc/node-red-contrib-ccu.svg?branch=master)](https://travis-ci.org/rdmtc/node-red-contrib-ccu)
6
- [![Coverage Status](https://coveralls.io/repos/github/rdmtc/node-red-contrib-ccu/badge.svg?branch=master)](https://coveralls.io/github/rdmtc/node-red-contrib-ccu?branch=master)
7
- [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
3
+ [![NPM version](https://img.shields.io/npm/v/node-red-contrib-ccu.svg)](https://www.npmjs.com/package/node-red-contrib-ccu)
4
+ [![CI](https://github.com/rdmtc/node-red-contrib-ccu/actions/workflows/ci.yml/badge.svg)](https://github.com/rdmtc/node-red-contrib-ccu/actions/workflows/ci.yml)
8
5
  [![License][mit-badge]][mit-url]
9
6
 
10
7
  > Node-RED Nodes for the Homematic CCU
11
8
 
12
- With these Nodes you can connect [Homematic](https://github.com/hobbyquaker/awesome-homematic) and
13
- [Node-RED](https://nodered.org/). Homematic is a series of smart home automation hardware from the manufacturer
9
+ With these Nodes you can connect [Homematic](https://github.com/hobbyquaker/awesome-homematic) and
10
+ [Node-RED](https://nodered.org/). Homematic is a series of smart home automation hardware from the manufacturer
14
11
  [eQ-3](http://www.eq-3.de/), popular especially in Germany.
15
12
 
16
- **⚠️ node-red-contrib-ccu >= 3.0 needs Node-RED >= 1.0.** If you're still on Node-RED 0.20 or lower you should use the
17
- latest 2.x version of node-red-contrib-ccu.
13
+ **⚠️ node-red-contrib-ccu >= 4.0 needs Node-RED >= 4.0 and Node.js >= 20** (primary target: Node-RED 5 on Node 24).
14
+ On older Node-RED versions use the latest 3.x release of node-red-contrib-ccu.
18
15
 
19
- For the communication with the CCU both RPC and ReGaHSS remote script are used. It's possible to connect to multiple
16
+ For the communication with the CCU both RPC and ReGaHSS remote script are used. It's possible to connect to multiple
20
17
  CCUs from one Node-RED instance. RPC setValue calls can be comfortably complemented with ON_TIME and RAMP_TIME values
21
- and special nodes ease the control of displays and mp3 actuators. RPC events can be filtered comprehensively (even
22
- through regular expressions and also by rooms and functions). It's possible to start rega-programs and set
18
+ and special nodes ease the control of displays and mp3 actuators. RPC events can be filtered comprehensively (even
19
+ through regular expressions and also by rooms and functions). It's possible to start rega-programs and set
23
20
  rega-variables and last but not least there are nodes to execute arbitrary rega-scripts and RPC calls.
24
21
 
25
- These nodes are included in [RedMatic](https://github.com/rdmtc/RedMatic) which ships Node-RED as an addon package
22
+ These nodes are included in [RedMatic](https://github.com/rdmtc/RedMatic) which ships Node-RED as an addon package
26
23
  for installation on a Homematic CCU3 or RaspberryMatic.
27
24
 
28
25
  Some example flows can be found in the [RedMatic Wiki](https://github.com/rdmtc/RedMatic/wiki) (German language).
29
26
 
30
- __A modern Browser is required, Internet Explorer won't work.__
27
+ **A modern Browser is required, Internet Explorer won't work.**
31
28
 
32
- __Starting with Version 3.x these Nodes need Node-RED >= 1.0 to work correctly__
29
+ **Starting with Version 3.x these Nodes need Node-RED >= 1.0 to work correctly**
33
30
 
34
31
  ## Configuration Examples
35
32
 
@@ -37,13 +34,13 @@ The communication with the Homematic CCU needs independent connections in two di
37
34
 
38
35
  ### NAT'd network
39
36
 
40
- If Node-RED/node-red-contrib-ccu runs inside a Container or a VM with NAT'd network it's necessary to forward/expose the ports for connections _from_ the CCU _to_ node-red-contrib-ccu's callback listeners (example below for a Docker container: use options `-p 2048:2048 -p 2049:2049`in the docker run command).
37
+ If Node-RED/node-red-contrib-ccu runs inside a Container or a VM with NAT'd network it's necessary to forward/expose the ports for connections _from_ the CCU _to_ node-red-contrib-ccu's callback listeners (example below for a Docker container: use options `-p 2048:2048 -p 2049:2049`in the docker run command).
41
38
 
42
39
  ![schema-docker](docs/schema-docker.png)
43
40
 
44
41
  ![ccu-config-docker](docs/ccu-config-docker.png)
45
42
 
46
- The config option `Init address`will be used to tell the CCU on which Address node-red-contrib-ccu is reachable. As 172.17.0.20 is not reachable for the CCU the Hosts IP Address and port forwarding/exposal has to be used. As `Listen address` setting also `0.0.0.0` (which tells node-red-contrib-ccu to bind it's listeners to all available interfaces) would be possible.
43
+ The config option `Init address`will be used to tell the CCU on which Address node-red-contrib-ccu is reachable. As 172.17.0.20 is not reachable for the CCU the Hosts IP Address and port forwarding/exposal has to be used. As `Listen address` setting also `0.0.0.0` (which tells node-red-contrib-ccu to bind it's listeners to all available interfaces) would be possible.
47
44
 
48
45
  ### piVCCU
49
46
 
@@ -68,10 +65,9 @@ This will require two individual configuration nodes, in which the respective co
68
65
 
69
66
  ![schema-multiCCU](docs/schema-multiCCU.png)
70
67
 
71
- - `Listen address` typically is the same for both Configurations as it is determined by the host that is running Node-RED
72
- - `BINRPC listening port` and `XMLRPC listening port` need to be different across the two configurations. One configuration can use the defaults (2048/tcp and 2049/tcp), the other needs to use two new ports. node-red-contrib-ccu will make a proposal, but this can be modified, e.g. if the proposed ports are already used.
73
- - The examples for [NAT'd network](#NAT'd-network), [piVCCU](#piVCCU) and [debmatic](#debmatic) will apply likewise for multiple CCUs. This means, for running Node-RED within a docker, all BINRPC and XMLRPC ports must be forwarded, e.g. `-p 2048:2048 -p 2049:2049 -p 2061:2061 -p 2062:2062`
74
-
68
+ - `Listen address` typically is the same for both Configurations as it is determined by the host that is running Node-RED
69
+ - `BINRPC listening port` and `XMLRPC listening port` need to be different across the two configurations. One configuration can use the defaults (2048/tcp and 2049/tcp), the other needs to use two new ports. node-red-contrib-ccu will make a proposal, but this can be modified, e.g. if the proposed ports are already used.
70
+ - The examples for [NAT'd network](#NAT'd-network), [piVCCU](#piVCCU) and [debmatic](#debmatic) will apply likewise for multiple CCUs. This means, for running Node-RED within a docker, all BINRPC and XMLRPC ports must be forwarded, e.g. `-p 2048:2048 -p 2049:2049 -p 2061:2061 -p 2062:2062`
75
71
 
76
72
  ## License
77
73