homematic-manager 3.4.2 → 3.5.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.
Files changed (46) hide show
  1. package/data/cross-validations.json +14 -0
  2. package/data/easymode-time-selectors.json +1 -1
  3. package/data/manifest.json +12 -12
  4. package/data/master-forms.json +245 -24
  5. package/data/master-metadata.json +323 -9
  6. package/data/translations/de.json +12 -1
  7. package/data/translations/en.json +11 -0
  8. package/node_modules/@homematic-manager/backend/README.md +8 -1
  9. package/node_modules/@homematic-manager/backend/dist/api/backend.js +28 -5
  10. package/node_modules/@homematic-manager/backend/dist/cache/descriptions.d.ts +21 -2
  11. package/node_modules/@homematic-manager/backend/dist/cache/descriptions.js +50 -16
  12. package/node_modules/@homematic-manager/backend/dist/cache/store.d.ts +12 -2
  13. package/node_modules/@homematic-manager/backend/dist/cache/store.js +126 -11
  14. package/node_modules/@homematic-manager/backend/dist/meta/occuliteProvider.d.ts +8 -0
  15. package/node_modules/@homematic-manager/backend/dist/meta/occuliteProvider.js +20 -17
  16. package/node_modules/@homematic-manager/backend/dist/rega/scripts.d.ts +12 -6
  17. package/node_modules/@homematic-manager/backend/dist/rega/scripts.js +17 -8
  18. package/node_modules/@homematic-manager/backend/dist/util/jsonFile.d.ts +9 -2
  19. package/node_modules/@homematic-manager/backend/dist/util/jsonFile.js +39 -2
  20. package/node_modules/@homematic-manager/backend/dist/write/paramset.d.ts +10 -0
  21. package/node_modules/@homematic-manager/backend/dist/write/paramset.js +22 -1
  22. package/node_modules/@homematic-manager/backend/dist/write/repair.d.ts +7 -7
  23. package/node_modules/@homematic-manager/backend/dist/write/repair.js +5 -14
  24. package/node_modules/@homematic-manager/backend/package.json +1 -1
  25. package/node_modules/@homematic-manager/core/dist/api/types.d.ts +15 -0
  26. package/node_modules/@homematic-manager/core/dist/index.d.ts +2 -0
  27. package/node_modules/@homematic-manager/core/dist/index.js +2 -0
  28. package/node_modules/@homematic-manager/core/dist/interfaces/table.d.ts +14 -0
  29. package/node_modules/@homematic-manager/core/dist/interfaces/table.js +20 -0
  30. package/node_modules/@homematic-manager/core/dist/links/partnerFilter.d.ts +55 -0
  31. package/node_modules/@homematic-manager/core/dist/links/partnerFilter.js +235 -0
  32. package/node_modules/@homematic-manager/core/dist/paramset/cast.d.ts +37 -0
  33. package/node_modules/@homematic-manager/core/dist/paramset/cast.js +61 -1
  34. package/node_modules/@homematic-manager/core/dist/paramset/diff.d.ts +15 -0
  35. package/node_modules/@homematic-manager/core/dist/paramset/diff.js +16 -2
  36. package/node_modules/@homematic-manager/core/dist/paramset/powerMeter.d.ts +40 -0
  37. package/node_modules/@homematic-manager/core/dist/paramset/powerMeter.js +47 -0
  38. package/node_modules/@homematic-manager/core/dist/paramset/units.d.ts +11 -0
  39. package/node_modules/@homematic-manager/core/dist/paramset/units.js +19 -0
  40. package/node_modules/@homematic-manager/core/package.json +1 -1
  41. package/package.json +3 -3
  42. package/ui/assets/index-BGYochtr.js +21 -0
  43. package/ui/assets/index-Cd-Vx9ge.css +1 -0
  44. package/ui/index.html +2 -2
  45. package/ui/assets/index-BOEXCG42.css +0 -1
  46. package/ui/assets/index-Fj6yr6EG.js +0 -21
@@ -135,7 +135,12 @@ Write(iDone);
135
135
  * B-74 (#150): an alarm stays oncoming until it is receipted, whatever the interface process
136
136
  * reports meanwhile - rfd forgets a `STICKY_UNREACH` at a restart, ReGa does not - so the
137
137
  * WebUI lists messages `getServiceMessages` does not. The value is what such a message is shown
138
- * with.
138
+ * with. *
139
+ * Task 119: the name and the value go out through `WriteURL()`, like every other name this
140
+ * application reads from ReGa, so a tab or a line break in either cannot shift the fields or split
141
+ * the line (the CCU WebUI's lists broke on such names, OpenCCU-Base #304 and others). The value is
142
+ * `Value().ToString()`, which prints what `Write(Value())` printed: `true`/`false`, `21.500000`,
143
+ * an ENUM's index (checked on the lab's stock OpenCCU 3.89.8).
139
144
  */
140
145
  export const REGA_ALARMS_SCRIPT = `string sId;
141
146
  foreach (sId, dom.GetObject(ID_SERVICES).EnumIDs()) {
@@ -144,23 +149,27 @@ foreach (sId, dom.GetObject(ID_SERVICES).EnumIDs()) {
144
149
  if (oAlarm.IsTypeOf(OT_ALARMDP) && (oAlarm.Used() == true) && (oAlarm.Enabled() == true) && (oAlarm.AlState() == asOncoming)) {
145
150
  object oTrigger = dom.GetObject(oAlarm.AlTriggerDP());
146
151
  if (oTrigger) {
147
- Write(oTrigger.Name() # "\\t" # oAlarm.AlOccurrenceTime().ToInteger() # "\\t" # oAlarm.Timestamp().ToInteger() # "\\t" # oTrigger.Value() # "\\n");
152
+ WriteURL(oTrigger.Name());
153
+ Write("\\t" # oAlarm.AlOccurrenceTime().ToInteger() # "\\t" # oAlarm.Timestamp().ToInteger() # "\\t");
154
+ WriteURL(oTrigger.Value().ToString());
155
+ Write("\\n");
148
156
  }
149
157
  }
150
158
  }
151
159
  }
152
160
  `;
153
161
  /**
154
- * Reads what {@link REGA_ALARMS_SCRIPT} wrote. A line whose name is not `<interface>.<channel>.<datapoint>`
155
- * (a system alarm, a CUxD name with more dots) or whose time is no positive number is skipped. The
156
- * value column is ReGa's text of the value: `true`/`false`, a number as it prints it (an ENUM by
157
- * its index), anything else stays a string; a line without it means `true`.
162
+ * Reads what {@link REGA_ALARMS_SCRIPT} wrote. Name and value are `WriteURL()`-escaped and decoded
163
+ * here (task 119). A line whose name is not `<interface>.<channel>.<datapoint>` (a system alarm, a
164
+ * CUxD name with more dots) or whose time is no positive number is skipped. The value column is
165
+ * ReGa's text of the value: `true`/`false`, a number as it prints it (an ENUM by its index),
166
+ * anything else stays a string; a line without it means `true`.
158
167
  */
159
168
  export function parseRegaAlarms(output) {
160
169
  const alarms = [];
161
170
  for (const line of output.split('\n')) {
162
171
  const [name, first, last, value] = line.split('\t');
163
- const match = /^([^.\s]+)\.([^.\s]+)\.([^.\s]+)$/u.exec(name?.trim() ?? '');
172
+ const match = /^([^.\s]+)\.([^.\s]+)\.([^.\s]+)$/u.exec(unescapeRegaUrl(name?.trim() ?? ''));
164
173
  const firstSeconds = Number(first);
165
174
  const lastSeconds = Number(last);
166
175
  if (!match || !Number.isFinite(firstSeconds) || firstSeconds <= 0) {
@@ -170,7 +179,7 @@ export function parseRegaAlarms(output) {
170
179
  interfaceName: match[1] ?? '',
171
180
  address: match[2] ?? '',
172
181
  datapoint: match[3] ?? '',
173
- value: parseRegaValue(value),
182
+ value: parseRegaValue(value === undefined ? undefined : unescapeRegaUrl(value)),
174
183
  first: firstSeconds * 1000,
175
184
  last: Number.isFinite(lastSeconds) && lastSeconds > 0 ? lastSeconds * 1000 : firstSeconds * 1000,
176
185
  });
@@ -9,6 +9,12 @@
9
9
  * rewrote the whole device cache on every `newDevices` callback; a CCU that reports 400 devices in
10
10
  * a burst wrote the file 400 times.
11
11
  *
12
+ * **Unchanged content is not written again.** On the addon the data directory is the CCU's SD
13
+ * card, and most saves repeat what is there already: the device list after every `init`, the names
14
+ * and the configuration at every start, the metadata snapshot after every reconnect. The hash of
15
+ * what was last read or written is kept per file, and a write whose text hashes the same - while
16
+ * the file is still there with that size - is skipped.
17
+ *
12
18
  * A read failure is never fatal: a missing or corrupt file means "no cache yet".
13
19
  */
14
20
  /** Reads and parses a JSON file; `undefined` when it is missing, unreadable or not JSON. */
@@ -16,9 +22,10 @@ export declare function readJsonFile<T>(file: string): Promise<T | undefined>;
16
22
  /**
17
23
  * Writes a JSON file atomically, creating the directory if it does not exist. Writes of the same
18
24
  * file run one after another in call order, so the last call's value is what stays; the value is
19
- * serialised at the call.
25
+ * serialised at the call. Resolves to `false` when the file already held exactly this text and
26
+ * nothing was written.
20
27
  */
21
- export declare function writeJsonFile(file: string, value: unknown): Promise<void>;
28
+ export declare function writeJsonFile(file: string, value: unknown): Promise<boolean>;
22
29
  /** Removes a file; a missing file is not an error. */
23
30
  export declare function removeFile(file: string): Promise<void>;
24
31
  export interface DebouncedJsonFileOptions {
@@ -9,10 +9,35 @@
9
9
  * rewrote the whole device cache on every `newDevices` callback; a CCU that reports 400 devices in
10
10
  * a burst wrote the file 400 times.
11
11
  *
12
+ * **Unchanged content is not written again.** On the addon the data directory is the CCU's SD
13
+ * card, and most saves repeat what is there already: the device list after every `init`, the names
14
+ * and the configuration at every start, the metadata snapshot after every reconnect. The hash of
15
+ * what was last read or written is kept per file, and a write whose text hashes the same - while
16
+ * the file is still there with that size - is skipped.
17
+ *
12
18
  * A read failure is never fatal: a missing or corrupt file means "no cache yet".
13
19
  */
20
+ import { createHash } from 'node:crypto';
14
21
  import fs from 'node:fs/promises';
15
22
  import path from 'node:path';
23
+ const knownContent = new Map();
24
+ function contentOf(text) {
25
+ return { hash: createHash('sha256').update(text).digest('base64'), bytes: Buffer.byteLength(text) };
26
+ }
27
+ /** Is the file on disk still the text that hashes to `content`? A missing file is not. */
28
+ async function holds(file, content) {
29
+ const known = knownContent.get(file);
30
+ if (known?.hash !== content.hash || known.bytes !== content.bytes) {
31
+ return false;
32
+ }
33
+ try {
34
+ // somebody may have deleted or replaced the file behind our back; the size is the cheap check
35
+ return (await fs.stat(file)).size === content.bytes;
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ }
16
41
  /** Reads and parses a JSON file; `undefined` when it is missing, unreadable or not JSON. */
17
42
  export async function readJsonFile(file) {
18
43
  let text;
@@ -20,8 +45,10 @@ export async function readJsonFile(file) {
20
45
  text = await fs.readFile(file, 'utf8');
21
46
  }
22
47
  catch {
48
+ knownContent.delete(file);
23
49
  return undefined;
24
50
  }
51
+ knownContent.set(file, contentOf(text));
25
52
  try {
26
53
  return JSON.parse(text);
27
54
  }
@@ -38,16 +65,24 @@ const writesInProgress = new Map();
38
65
  /**
39
66
  * Writes a JSON file atomically, creating the directory if it does not exist. Writes of the same
40
67
  * file run one after another in call order, so the last call's value is what stays; the value is
41
- * serialised at the call.
68
+ * serialised at the call. Resolves to `false` when the file already held exactly this text and
69
+ * nothing was written.
42
70
  */
43
71
  export async function writeJsonFile(file, value) {
44
72
  const text = `${JSON.stringify(value, null, 2)}\n`;
73
+ const content = contentOf(text);
45
74
  const previous = writesInProgress.get(file) ?? Promise.resolve();
46
75
  const write = previous.then(async () => {
76
+ if (await holds(file, content)) {
77
+ return false;
78
+ }
79
+ knownContent.delete(file);
47
80
  await fs.mkdir(path.dirname(file), { recursive: true });
48
81
  const temporary = `${file}.tmp`;
49
82
  await fs.writeFile(temporary, text, 'utf8');
50
83
  await fs.rename(temporary, file);
84
+ knownContent.set(file, content);
85
+ return true;
51
86
  });
52
87
  // the next write waits for this one whether it worked or not; the caller hears the error
53
88
  const settled = write.catch(() => undefined);
@@ -61,6 +96,7 @@ export async function writeJsonFile(file, value) {
61
96
  }
62
97
  /** Removes a file; a missing file is not an error. */
63
98
  export async function removeFile(file) {
99
+ knownContent.delete(file);
64
100
  try {
65
101
  await fs.rm(file, { force: true });
66
102
  }
@@ -137,8 +173,9 @@ export class DebouncedJsonFile {
137
173
  this.#timer = undefined;
138
174
  }
139
175
  this.#pending = undefined;
176
+ // in the same chain as the writes, so a save that follows the removal is not undone by it
177
+ this.#writing = this.#writing.then(() => removeFile(this.file));
140
178
  await this.#writing;
141
- await removeFile(this.file);
142
179
  }
143
180
  }
144
181
  //# sourceMappingURL=jsonFile.js.map
@@ -16,6 +16,11 @@
16
16
  * `NaN` never reaches the wire;
17
17
  * 4. the call goes through the paced write queue and into the write log.
18
18
  *
19
+ * A **link paramset is written whole** (task 113): once one of its parameters changed, every
20
+ * writable parameter goes out with the value just read, the edits on top. The CCU's WebUI went
21
+ * back to that in 2026, after sending only the changed link parameters had reset the others on
22
+ * devices in the field. `changedOnly` is the opt-out; MASTER and VALUES keep the changed-only rule.
23
+ *
19
24
  * Multi-apply is restricted to channels whose paramset description **identity** is equal
20
25
  * (`multiApplyEligibility()`, task 6.3). 2.x offered every channel with the same `TYPE` and never
21
26
  * compared descriptions, which is exactly what put more than 100 devices into `CONFIG_PENDING`.
@@ -72,6 +77,11 @@ export declare class ParamsetWriter {
72
77
  * A link paramset is addressed as `putParamset(<channel>, <peer address>, values)`, so
73
78
  * "sender to receiver" is written on the sender with the receiver as the key and the other way
74
79
  * round - exactly what `putLinkParamset()` of 2.x did.
80
+ *
81
+ * `values` are the edits. A direction none of whose parameters changed is not written at all;
82
+ * one that has a change is written whole unless `options.changedOnly` is set - per link from that
83
+ * link's own stored values, so applying an edit to several links never copies one link's other
84
+ * parameters to the next.
75
85
  */
76
86
  putLink(interfaceName: string, links: readonly LinkTarget[], values: {
77
87
  senderToReceiver?: ParamsetWrite;
@@ -16,6 +16,11 @@
16
16
  * `NaN` never reaches the wire;
17
17
  * 4. the call goes through the paced write queue and into the write log.
18
18
  *
19
+ * A **link paramset is written whole** (task 113): once one of its parameters changed, every
20
+ * writable parameter goes out with the value just read, the edits on top. The CCU's WebUI went
21
+ * back to that in 2026, after sending only the changed link parameters had reset the others on
22
+ * devices in the field. `changedOnly` is the opt-out; MASTER and VALUES keep the changed-only rule.
23
+ *
19
24
  * Multi-apply is restricted to channels whose paramset description **identity** is equal
20
25
  * (`multiApplyEligibility()`, task 6.3). 2.x offered every channel with the same `TYPE` and never
21
26
  * compared descriptions, which is exactly what put more than 100 devices into `CONFIG_PENDING`.
@@ -107,6 +112,11 @@ export class ParamsetWriter {
107
112
  * A link paramset is addressed as `putParamset(<channel>, <peer address>, values)`, so
108
113
  * "sender to receiver" is written on the sender with the receiver as the key and the other way
109
114
  * round - exactly what `putLinkParamset()` of 2.x did.
115
+ *
116
+ * `values` are the edits. A direction none of whose parameters changed is not written at all;
117
+ * one that has a change is written whole unless `options.changedOnly` is set - per link from that
118
+ * link's own stored values, so applying an edit to several links never copies one link's other
119
+ * parameters to the next.
110
120
  */
111
121
  async putLink(interfaceName, links, values, options = {}) {
112
122
  if (links.length === 0) {
@@ -140,6 +150,7 @@ export class ParamsetWriter {
140
150
  const result = await this.#putOne(interfaceName, owner, 'LINK', peer, direction.values, options, {
141
151
  peer,
142
152
  alwaysSend: ALWAYS_SENT_LINK_PARAMETERS,
153
+ full: options.changedOnly !== true && options.writeAll !== true,
143
154
  });
144
155
  results.push(result);
145
156
  done += 1;
@@ -227,7 +238,7 @@ export class ParamsetWriter {
227
238
  writeAll: options.writeAll === true,
228
239
  enumAs: enumEncodingFor(interfaceName),
229
240
  });
230
- const sent = { ...diff.values };
241
+ let sent = { ...diff.values };
231
242
  for (const parameter of extra.alwaysSend ?? []) {
232
243
  addAlwaysSent(sent, diff.values, values, description, parameter, interfaceName);
233
244
  }
@@ -238,6 +249,16 @@ export class ParamsetWriter {
238
249
  if (Object.keys(sent).length === 0) {
239
250
  return { ...base, sent, ok: true, skipped: true, problems: [] };
240
251
  }
252
+ if (extra.full === true) {
253
+ // something changed, so the paramset goes out whole: what was read, the edits on top.
254
+ // Only the payload is taken from this second pass - what is wrong with the edits the
255
+ // first one has already said, and a stored value that does not validate stays unsent.
256
+ const whole = diffParamset(original, values, description, {
257
+ full: true,
258
+ enumAs: enumEncodingFor(interfaceName),
259
+ });
260
+ sent = { ...whole.values, ...sent };
261
+ }
241
262
  if (options.dryRun === true) {
242
263
  return { ...base, sent, ok: true, skipped: true, problems: [] };
243
264
  }
@@ -24,7 +24,7 @@
24
24
  * channel with one is reported as `unrepairable`, and the dialog of task 8 has to explain what that
25
25
  * means for the device.
26
26
  */
27
- import { type DeviceIndex, type ParameterDescription, type ParamsetDescription, type RepairConfigOptions, type RepairConfigResult, type RpcValue, type RpcWriteValue, type WriteResult } from '@homematic-manager/core';
27
+ import { type ConfigMaintenanceMethod, type DeviceIndex, type ParameterDescription, type ParamsetDescription, type RepairConfigOptions, type RepairConfigResult, type RpcValue, type RpcWriteValue, type WriteResult } from '@homematic-manager/core';
28
28
  import type { RpcOutValue } from '../rpc/client.js';
29
29
  /** What the repair needs from the backend; the same shape the paramset writer uses. */
30
30
  export interface ConfigRepairDeps {
@@ -32,18 +32,18 @@ export interface ConfigRepairDeps {
32
32
  describe(interfaceName: string, address: string, paramset: string): Promise<ParamsetDescription>;
33
33
  read(interfaceName: string, method: string, params: readonly RpcOutValue[]): Promise<RpcValue>;
34
34
  write(interfaceName: string, method: string, params: readonly RpcOutValue[]): Promise<RpcValue>;
35
+ /**
36
+ * Task 115: does this interface offer `clearConfigCache` / `restoreConfigToDevice`? Never on
37
+ * hmipserver (it lists both and answers `-1 Generic error` to every call); elsewhere its own
38
+ * `system.listMethods` decides - hs485d of an eQ-3 CCU3 has neither (`offersConfigMaintenance`).
39
+ */
40
+ offers(interfaceName: string, method: ConfigMaintenanceMethod): Promise<boolean>;
35
41
  onProgress(progress: {
36
42
  done: number;
37
43
  total: number;
38
44
  last?: WriteResult;
39
45
  }): void;
40
46
  }
41
- /**
42
- * `clearConfigCache` and `restoreConfigToDevice` exist in hmipserver's `system.listMethods` and
43
- * answer `-1 Generic error` to every call: they are BidCos methods. Offering them for an HmIP
44
- * device would only produce a fault the user cannot act on.
45
- */
46
- export declare function supportsBidcosMaintenance(interfaceName: string): boolean;
47
47
  /** A value that is certainly valid for this parameter, for a stored one that is not. */
48
48
  export declare function fallbackValue(parameter: ParameterDescription): RpcWriteValue | undefined;
49
49
  export declare class ConfigRepair {
@@ -26,14 +26,6 @@
26
26
  */
27
27
  import { castValue, enumEncodingFor, isWritable, validateValue, } from '@homematic-manager/core';
28
28
  import { toApiError, validationError } from '../errors.js';
29
- /**
30
- * `clearConfigCache` and `restoreConfigToDevice` exist in hmipserver's `system.listMethods` and
31
- * answer `-1 Generic error` to every call: they are BidCos methods. Offering them for an HmIP
32
- * device would only produce a fault the user cannot act on.
33
- */
34
- export function supportsBidcosMaintenance(interfaceName) {
35
- return interfaceName !== 'HmIP-RF';
36
- }
37
29
  /** A value that is certainly valid for this parameter, for a stored one that is not. */
38
30
  export function fallbackValue(parameter) {
39
31
  const candidates = [];
@@ -111,13 +103,12 @@ export class ConfigRepair {
111
103
  done += 1;
112
104
  this.#deps.onProgress({ done, total: targets.length, last: channel.write });
113
105
  }
114
- if (options.bidcosRecovery !== undefined &&
115
- options.bidcosRecovery !== 'none' &&
116
- options.dryRun !== true &&
117
- supportsBidcosMaintenance(interfaceName)) {
106
+ if (options.bidcosRecovery !== undefined && options.bidcosRecovery !== 'none' && options.dryRun !== true) {
118
107
  const method = options.bidcosRecovery === 'clearConfigCache' ? 'clearConfigCache' : 'restoreConfigToDevice';
119
- await this.#deps.write(interfaceName, method, [deviceAddress]);
120
- result.bidcosRecovery = options.bidcosRecovery;
108
+ if (await this.#deps.offers(interfaceName, method)) {
109
+ await this.#deps.write(interfaceName, method, [deviceAddress]);
110
+ result.bidcosRecovery = options.bidcosRecovery;
111
+ }
121
112
  }
122
113
  const after = options.dryRun === true ? before : await this.#configPending(interfaceName, deviceAddress);
123
114
  if (after !== undefined) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homematic-manager/backend",
3
- "version": "3.4.2",
3
+ "version": "3.5.1",
4
4
  "type": "module",
5
5
  "description": "Homematic Manager backend: XML-RPC/BIN-RPC clients and callback servers, caches, optional ReGa",
6
6
  "license": "AGPL-3.0-or-later",
@@ -727,6 +727,12 @@ export interface BidcosInterfaceInfo {
727
727
  export interface WriteOptions {
728
728
  /** Send every writeable parameter, not only the changed ones (task 6, item 1). */
729
729
  writeAll?: boolean;
730
+ /**
731
+ * `paramset.putLink` only: send just the changed parameters of a link paramset. Without it a
732
+ * link paramset that has a change is written whole - every writable parameter as the interface
733
+ * returned it, the edits on top (task 113).
734
+ */
735
+ changedOnly?: boolean;
730
736
  /** Only validate and return what would be sent. */
731
737
  dryRun?: boolean;
732
738
  }
@@ -961,6 +967,15 @@ export interface ApiMethods {
961
967
  params: [interfaceName?: string];
962
968
  result: null;
963
969
  };
970
+ /**
971
+ * Task 115: what the interface lists in `system.listMethods`, asked once per subscription;
972
+ * `null` when it gave no usable list. The device menu offers `restoreConfigToDevice` and
973
+ * `clearConfigCache` only where they are listed (`offersConfigMaintenance`).
974
+ */
975
+ 'interfaces.methodNames': {
976
+ params: [interfaceName: string];
977
+ result: string[] | null;
978
+ };
964
979
  'rega.state': {
965
980
  params: [];
966
981
  result: RegaState;
@@ -18,6 +18,7 @@ export * from './devices/index.js';
18
18
  export * from './devices/smokeGroups.js';
19
19
  export * from './devices/hmipKey.js';
20
20
  export * from './links/roles.js';
21
+ export * from './links/partnerFilter.js';
21
22
  export * from './rpc/values.js';
22
23
  export * from './rpc/methods.js';
23
24
  export * from './rpc/text.js';
@@ -28,6 +29,7 @@ export * from './paramset/cast.js';
28
29
  export * from './paramset/validate.js';
29
30
  export * from './paramset/diff.js';
30
31
  export * from './paramset/multiApply.js';
32
+ export * from './paramset/powerMeter.js';
31
33
  export * from './easymodes/engine.js';
32
34
  export * from './easymodes/form.js';
33
35
  export * from './easymodes/linkTypes.js';
@@ -20,6 +20,7 @@ export * from './devices/index.js';
20
20
  export * from './devices/smokeGroups.js';
21
21
  export * from './devices/hmipKey.js';
22
22
  export * from './links/roles.js';
23
+ export * from './links/partnerFilter.js';
23
24
  // Values and the write path (task 6)
24
25
  export * from './rpc/values.js';
25
26
  export * from './rpc/methods.js';
@@ -31,6 +32,7 @@ export * from './paramset/cast.js';
31
32
  export * from './paramset/validate.js';
32
33
  export * from './paramset/diff.js';
33
34
  export * from './paramset/multiApply.js';
35
+ export * from './paramset/powerMeter.js';
34
36
  // Easy modes and the MASTER metadata layer
35
37
  export * from './easymodes/engine.js';
36
38
  export * from './easymodes/form.js';
@@ -225,6 +225,20 @@ export declare function interfaceDefinition(name: string): InterfaceDefinition |
225
225
  * type that is not known yet get the pairing dialog, and the process behind them has the last word.
226
226
  */
227
227
  export declare function canPairDevices(type: string): boolean;
228
+ /** The two BidCos maintenance calls of the device menu and the repair dialog (task 115). */
229
+ export type ConfigMaintenanceMethod = 'restoreConfigToDevice' | 'clearConfigCache';
230
+ /**
231
+ * Task 115: may `restoreConfigToDevice` or `clearConfigCache` be offered for this interface?
232
+ *
233
+ * - hmipserver lists both in `system.listMethods` and answers `-1 Generic error` to every call, so
234
+ * an HmIP interface never offers them, whatever its list says.
235
+ * - Elsewhere the interface's own `system.listMethods` decides, as the CCU WebUI's rule does since
236
+ * OpenCCU-Base restricted the button to the processes that have the method: hs485d of an eQ-3
237
+ * CCU3 has neither, rfd and openccu-lite's hs485d have both.
238
+ * - Without a usable list (`undefined`: the process has no `system.listMethods`, or it failed) the
239
+ * type decides as before: BidCos interfaces only.
240
+ */
241
+ export declare function offersConfigMaintenance(name: string, type: string, method: ConfigMaintenanceMethod, listed: readonly string[] | ReadonlySet<string> | undefined): boolean;
228
242
  /**
229
243
  * The identity string passed to `init(url, ident)` and sent back with every callback, which is how
230
244
  * the callback server tells the interfaces apart. `hmm_<name>` for everything except CUxD, which
@@ -113,6 +113,26 @@ export function interfaceDefinition(name) {
113
113
  export function canPairDevices(type) {
114
114
  return interfaceDefinition(type)?.installMode !== false;
115
115
  }
116
+ /**
117
+ * Task 115: may `restoreConfigToDevice` or `clearConfigCache` be offered for this interface?
118
+ *
119
+ * - hmipserver lists both in `system.listMethods` and answers `-1 Generic error` to every call, so
120
+ * an HmIP interface never offers them, whatever its list says.
121
+ * - Elsewhere the interface's own `system.listMethods` decides, as the CCU WebUI's rule does since
122
+ * OpenCCU-Base restricted the button to the processes that have the method: hs485d of an eQ-3
123
+ * CCU3 has neither, rfd and openccu-lite's hs485d have both.
124
+ * - Without a usable list (`undefined`: the process has no `system.listMethods`, or it failed) the
125
+ * type decides as before: BidCos interfaces only.
126
+ */
127
+ export function offersConfigMaintenance(name, type, method, listed) {
128
+ if (/hmip/i.test(name) || /hmip/i.test(type)) {
129
+ return false;
130
+ }
131
+ if (listed === undefined) {
132
+ return type.startsWith('BidCos') || (type === '' && name.startsWith('BidCos'));
133
+ }
134
+ return 'has' in listed ? listed.has(method) : listed.includes(method);
135
+ }
116
136
  /**
117
137
  * The identity string passed to `init(url, ident)` and sent back with every callback, which is how
118
138
  * the callback server tells the interfaces apart. `hmm_<name>` for everything except CUxD, which
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Which channels the "create link" dialog offers, beyond the role matrix.
3
+ *
4
+ * The roles (`roles.ts`) say which channels *can* be linked. The CCU's WebUI offers fewer: its
5
+ * channel list for a new link (`ic_selchannel.cgi`, `showHmIPChannel` and `linkIsExpertChannel`,
6
+ * read at OpenCCU 3.89.13) leaves out channels a link makes no sense for or must not be made
7
+ * with - a plug's own button as the sender of a link to another device, the channels a light
8
+ * controller does not use in its mode, the second and third virtual channel of every actuator
9
+ * channel. This module is those rules as data and a few predicates, so the dialog can offer what
10
+ * the CCU offers and still show everything on request.
11
+ *
12
+ * Pure: the rules that depend on how a device is set up need a MASTER paramset, and the caller
13
+ * reads those ({@link linkFilterMasters} says which) and hands them in. A paramset that was not
14
+ * read hides nothing - an unknown mode shows the channel, as the WebUI's rules fall through.
15
+ *
16
+ * Not ported: the display channels of the wall-mount glass displays (`*-WGD`, `*-WGD-PL`). The
17
+ * WebUI picks them by the order of the screens, which it keeps in ReGa's metadata of the device
18
+ * and nowhere on the device itself; there is nothing to read it from on a system without ReGa.
19
+ */
20
+ import { type DeviceDescription, type DeviceIndex } from '../devices/index.js';
21
+ import type { Paramset } from '../rpc/values.js';
22
+ /** Why a channel is not offered. */
23
+ export type LinkChannelHiddenReason =
24
+ /** The device's own key or sensor channel: linked inside the device, not offered to others. */
25
+ 'internal-sender'
26
+ /** A channel type no link is made with (the week program, an unused key, the KWL controller). */
27
+ | 'not-for-links'
28
+ /** Not in use in the mode or layout the device is set to. */
29
+ | 'device-mode'
30
+ /** The second and third virtual channel of an actuator channel, and the like: expert channels. */
31
+ | 'expert'
32
+ /** The interface marks the channel invisible (`FLAGS` without bit 0). */
33
+ | 'invisible';
34
+ /** The MASTER paramsets the rules were given, by address. */
35
+ export type LinkFilterMasters = ReadonlyMap<string, Paramset>;
36
+ /**
37
+ * Every channel of the interface the WebUI would not offer for a new link, with the reason.
38
+ *
39
+ * The order of the rules is the WebUI's: the device's own senders, the channel types never linked,
40
+ * the device's mode, the expert channels, and last the interface's own "invisible" flag.
41
+ */
42
+ export declare function hiddenLinkChannels(index: DeviceIndex, masters?: LinkFilterMasters): Map<string, LinkChannelHiddenReason>;
43
+ /**
44
+ * The MASTER paramsets {@link hiddenLinkChannels} needs to decide the mode rules: the maintenance
45
+ * channel of an HmIP-RGBW and of the glass switches, and every channel of a DALI gateway. Only
46
+ * for channels that take part in links at all; empty on an interface without such devices.
47
+ */
48
+ export declare function linkFilterMasters(index: DeviceIndex): string[];
49
+ /**
50
+ * A pair the WebUI does not offer although the roles match: a radiator thermostat's own
51
+ * `CLIMATECONTROL_RT_RECEIVER` as the receiver of its own sender channel. The two halves of an
52
+ * HM-CC-RT-DN are meant for the same channels of *other* thermostats.
53
+ */
54
+ export declare function isSameDeviceClimatePair(sender: DeviceDescription, receiver: DeviceDescription): boolean;
55
+ //# sourceMappingURL=partnerFilter.d.ts.map