hm-simulator 1.1.0 → 1.3.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 +124 -0
- package/README.md +651 -242
- package/data/fixtures/lab-2026-09.json +45956 -0
- package/index.js +260 -47
- package/lib/control.js +133 -0
- package/lib/faults.d.ts +48 -0
- package/lib/method-help.js +18 -0
- package/lib/paramset-index.js +107 -0
- package/lib/servers.js +262 -13
- package/lib/sim.js +1307 -65
- package/lib/validate.js +4 -0
- package/package.json +11 -4
- package/sim.d.mts +5 -0
- package/sim.d.ts +443 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes of hm-simulator. The release workflow takes each version's section from here for the
|
|
4
|
+
GitHub release notes.
|
|
5
|
+
|
|
6
|
+
## 1.3.0
|
|
7
|
+
|
|
8
|
+
- The calls Homematic Manager makes, measured on rfd and hmipserver of firmware 3.89.11:
|
|
9
|
+
`getKeyMismatchDevice` with the scenario call `scriptKeyMismatch` (a device that holds another
|
|
10
|
+
system's key: heard at the next install mode, paired once `setTempKey` offers its key) and rfd's
|
|
11
|
+
`addDevice(serial)`; `suppressServiceMessages` and `getSuppressedServiceMessages` on hmipserver
|
|
12
|
+
(a suppressed message is left out of `getServiceMessages` and reports the value that raises
|
|
13
|
+
none); `getMetadata`, `setMetadata` and rfd's `getAllMetadata`, seeded with the new `metadata`
|
|
14
|
+
option; `listReplaceableDevices`; `getVersion` (`interfaces.<iface>.version`); `getLGWStatus`
|
|
15
|
+
(only with `interfaces.<iface>.lgwStatus` - rfd 3.89.11 does not know it); `setInterfaceClock`
|
|
16
|
+
(recorded in `sim.interfaceClocks`).
|
|
17
|
+
- TypeScript declarations: `sim.d.ts` (the `types` of the package), `sim.d.mts` for `sim.mjs` and
|
|
18
|
+
`lib/faults.d.ts`, covering the options, the scenario API, the introspection calls and the
|
|
19
|
+
description types. `npm test` type-checks them against a file that uses every export
|
|
20
|
+
(`test/types/`), and a test fails when an option or scenario call is missing from them.
|
|
21
|
+
- `interfaces.<iface>.getServiceMessagesFault: true` answers `getServiceMessages` with
|
|
22
|
+
`Invalid XML-RPC message`, as VirtualDevices, CUxD and hmipserver were seen to on 3.89.x.
|
|
23
|
+
|
|
24
|
+
## 1.2.0
|
|
25
|
+
|
|
26
|
+
- The README is rewritten for the test author (quick start, connecting a client, the scenario API
|
|
27
|
+
grouped, recipes, the fixtures, what is measured and what is the simulator's model), and the
|
|
28
|
+
changelog moved into this file.
|
|
29
|
+
- `data/fixtures/lab-2026-09.json`: the devices of four test systems with the paramset
|
|
30
|
+
descriptions of their exact firmware, their direct links and radio modules - the CCU centrals,
|
|
31
|
+
RPI-RF-MOD, HmIP-RFUSB, HmIP-HAP, HmIP-BBL, HMIP-WRC2, HmIP-PDT, HmIPW-DRAP/-DRI16/-DRS8,
|
|
32
|
+
HM-CC-TC, HM-Sec-SC, HM-LC-Sw1-Pl-2 - anonymised. `tools/dump-ccu.js` makes such a fixture from
|
|
33
|
+
any CCU (read only, anonymised unless told otherwise). A device file given to `--devices` brings
|
|
34
|
+
its `links` and `bidcosInterfaces` along.
|
|
35
|
+
- The calls openccu-lite's daemon makes: `logLevel` (rfd and hs485d answer the level, 5 until set;
|
|
36
|
+
hmipserver an empty string), `changeKey` (rfd, hmipserver; recorded in `sim.keyChanges`) and
|
|
37
|
+
`refreshDeployedDeviceFirmwareList` (rfd, hmipserver; recorded in
|
|
38
|
+
`sim.firmwareListRefreshes`), with the interfaces measured on a CCU with firmware 3.89.x.
|
|
39
|
+
- `init` keeps the path of an XML-RPC callback url (`http://host:port/cb/BidCos-RF`; the path used
|
|
40
|
+
to end up in the port), takes `https://`, and identifies a registration by its url exactly, scheme
|
|
41
|
+
included, as the interface processes do - an `init(url, '')` with another scheme no longer removes
|
|
42
|
+
it. A url that is none is a fault.
|
|
43
|
+
- An XML-RPC request declared ISO-8859-1 is read as ISO-8859-1 instead of UTF-8.
|
|
44
|
+
- Device and radio health: `setReachable` (UNREACH, and STICKY_UNREACH on BidCos until a client
|
|
45
|
+
clears it; `unreachWrites: 'fault'` answers writes with notReachable), `setLowBattery`,
|
|
46
|
+
`setDutyCycle` and `setCarrierSense` (in `listBidcosInterfaces` and, on hmip, as the radio
|
|
47
|
+
module's `DUTY_CYCLE_LEVEL`/`CARRIER_SENSE_LEVEL`), `offerFirmware` with the update states
|
|
48
|
+
`updateFirmware`/`installFirmware` then walk through, and `schedule` for a timeline of scenario
|
|
49
|
+
calls.
|
|
50
|
+
- Interface processes that misbehave: `stopInterface`, `startInterface` and `restartInterface`
|
|
51
|
+
(forgetting the registered clients, or calling them back as rfd does after a restart),
|
|
52
|
+
`interfaces.<iface>.startDelay`, `pong` and `pingDelay`, `injectFault` (delay, hang, fault,
|
|
53
|
+
closed connection, for the next calls of a method) and `clearFaults`, and
|
|
54
|
+
`listenerModel: 'measured'`: what hmipserver and rfd do with a callback server that hangs
|
|
55
|
+
(hmipserver holds every client's events back, rfd stops answering). `getCallbackLog()` records
|
|
56
|
+
every call to a client with its timing, `fireEvents()` sends bursts as `system.multicall` batches.
|
|
57
|
+
- The command line is usable out of process: every port may be `0`, `--ports-json <file|->`
|
|
58
|
+
reports the ports once every server listens, `--config` and `--devices` load options and device
|
|
59
|
+
files, `--wired-port`, `--tls` with `--tls-cert-out`, `--auth`, `--behavior-path`,
|
|
60
|
+
`--no-behaviors`, and `--control-port` serves the scenario API over HTTP on the loopback. A taken
|
|
61
|
+
port exits 1 with the address in the message. `behaviorPath: false` starts no behaviour scripts.
|
|
62
|
+
- An ENUM whose description gives `DEFAULT` as the index (1088 of the 5624 ENUMs in the bundled
|
|
63
|
+
descriptions) started at `-1` instead of that index, so a thermostat's `FAULT_REPORTING` was a
|
|
64
|
+
service message from the start.
|
|
65
|
+
- rfd and BidCos-Wired answer BIN-RPC and XML-RPC on the same port, as on a CCU, so a client
|
|
66
|
+
that talks XML-RPC to rfd can be tested too; the callbacks follow the URL a client registered
|
|
67
|
+
with, whichever protocol it registered over. With `tls` the XML-RPC half is HTTPS, BIN-RPC stays
|
|
68
|
+
plain. `interfaces.<iface>.protocols` narrows a port to one of them.
|
|
69
|
+
- A device whose firmware has no paramset description uses the description of the nearest
|
|
70
|
+
firmware of the same type and `VERSION` instead of answering `-2 Invalid device` for every
|
|
71
|
+
channel `listDevices` reports; the bundled CCU virtual remote (`HM-RCV-50` 2.27.8,
|
|
72
|
+
`BidCoS-RF:1..50`) works again. `paramsetFallback: false` switches it off,
|
|
73
|
+
`sim.getMissingParamsetDescriptions()` lists what is not matched exactly (reported in #1 by
|
|
74
|
+
@Hypnos3, cause found by @foxriver76).
|
|
75
|
+
|
|
76
|
+
## 1.1.0
|
|
77
|
+
|
|
78
|
+
- `setTempKey` on the BidCos interfaces: the passphrase a device is taught in with, applied to
|
|
79
|
+
the pairings that follow; `sim.getTempKey(iface)` reads back what was set, an empty string
|
|
80
|
+
clears it. No cryptography. hmipserver has no such method, so it faults with unknown-method
|
|
81
|
+
there (Homematic Manager issue #20).
|
|
82
|
+
- Smoke detector teams on the BidCos interfaces: `listTeams` and `setTeam`. A channel with a
|
|
83
|
+
`TEAM_TAG` is in the team its `TEAM` names, a pseudo device `*<serial>` whose team channel lists
|
|
84
|
+
the members in `TEAM_CHANNELS`; `setTeam(channel, team)` moves it and deletes a team nobody is
|
|
85
|
+
left in, `setTeam(channel, '')` puts it back into a team of its own, created like the one it
|
|
86
|
+
left (`newDevices`, `deleteDevices`, `updateDevice` to the logic layers). The shape is rfd's
|
|
87
|
+
as Homematic Manager task 58 read it from a CCU3; when rfd deletes and creates the team devices
|
|
88
|
+
is the simulator's model, not a measurement.
|
|
89
|
+
|
|
90
|
+
## 1.0.0
|
|
91
|
+
|
|
92
|
+
- Node >= 20.19, `binrpc` ^4.2, `homematic-xmlrpc` ^2.0; `express`, `body-parser`, `request`,
|
|
93
|
+
`async` and `yalm` removed. The ReGa mock runs on `node:http`, the CLI logs through `console`.
|
|
94
|
+
- Paramset state per device and channel for MASTER, VALUES, SERVICE and the link paramsets, with
|
|
95
|
+
type, range, `VALUE_LIST` and `OPERATIONS` checks on every write.
|
|
96
|
+
- `CONFIG_PENDING` semantics, configurable per interface: `'hmip'` and `'bidcos'` are what the
|
|
97
|
+
two interface processes of a CCU on firmware 3.89.8 were measured to do (Homematic Manager task
|
|
98
|
+
6, 2026-09-05), `'strict'` and `'pending'` are the two hypotheses that measurement replaced.
|
|
99
|
+
`getPoisonedChannels()` for the channel an unknown parameter destroyed.
|
|
100
|
+
- Fault codes and strings measured on the same firmware, hmipserver's as the default table and
|
|
101
|
+
rfd's as `BIDCOS_FAULTS`.
|
|
102
|
+
- `data/fixtures/lab-devices.json`: an anonymised real `listDevices` of two CCUs, and the channel
|
|
103
|
+
layouts in `tools/device-layouts.json` corrected from it.
|
|
104
|
+
- Links: `getLinks`, `getLinkPeers`, `getLinkInfo`, `setLinkInfo`, `addLink`, `removeLink`,
|
|
105
|
+
`activateLinkParamset`, and link paramsets addressed by the peer's address.
|
|
106
|
+
- Interface and service methods: `rssiInfo`, `listBidcosInterfaces`, `setBidcosInterface`,
|
|
107
|
+
`getServiceMessages`, `setInstallMode`/`getInstallMode` with scripted `newDevices`,
|
|
108
|
+
`deleteDevice`, `replaceDevice`, `reportValueUsage`, `updateFirmware`, `installFirmware`,
|
|
109
|
+
`clearConfigCache`, `restoreConfigToDevice`, `determineParameter`, `getDeviceDescription`,
|
|
110
|
+
`getValue`, `system.methodHelp`, `system.multicall`.
|
|
111
|
+
- Fault responses on both transports, with an overridable fault table.
|
|
112
|
+
- VirtualDevices and CUxD servers, BidCos-Wired, optional TLS with a generated certificate and
|
|
113
|
+
optional HTTP basic auth.
|
|
114
|
+
- ReGa mock with `getChannels`, `getValues`, rename/program scripts and a script log.
|
|
115
|
+
- Scenario API: `addDevice`, `removeDevice`, `fireEvent`, `setServiceMessage`, `scriptNewDevices`,
|
|
116
|
+
`dropConnection`, `getWriteLog`, `getConfigPending`.
|
|
117
|
+
- `whenReady()`, port `0` support and `sim.ports`.
|
|
118
|
+
- Fixture generator `tools/fixtures-from-paramsets.js` and generated real device fixtures.
|
|
119
|
+
- ESLint 9 + Prettier, `node --test`, GitHub Actions on Node 20/22/24.
|
|
120
|
+
|
|
121
|
+
## 0.1.1 and earlier
|
|
122
|
+
|
|
123
|
+
`init`, `ping`, `system.listMethods`, `getParamsetDescription`, `listDevices`, `setValue`, events
|
|
124
|
+
through behaviour scripts, ReGa mock.
|