homematic-manager 3.5.1 → 3.6.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/data/device-icons.json +1 -0
- package/node_modules/@homematic-manager/backend/dist/api/backend.js +12 -0
- package/node_modules/@homematic-manager/backend/dist/images/deviceImages.d.ts +7 -2
- package/node_modules/@homematic-manager/backend/dist/images/deviceImages.js +18 -7
- package/node_modules/@homematic-manager/backend/dist/meta/service.d.ts +19 -1
- package/node_modules/@homematic-manager/backend/dist/meta/service.js +50 -1
- package/node_modules/@homematic-manager/backend/dist/meta/system.d.ts +17 -1
- package/node_modules/@homematic-manager/backend/dist/meta/system.js +86 -0
- package/node_modules/@homematic-manager/backend/package.json +1 -1
- package/node_modules/@homematic-manager/core/dist/api/types.d.ts +20 -1
- package/node_modules/@homematic-manager/core/dist/data/types.d.ts +8 -0
- package/node_modules/@homematic-manager/core/dist/data/types.js +10 -0
- package/node_modules/@homematic-manager/core/dist/devices/index.d.ts +15 -0
- package/node_modules/@homematic-manager/core/dist/devices/index.js +24 -0
- package/node_modules/@homematic-manager/core/dist/easymodes/linkTypes.d.ts +4 -1
- package/node_modules/@homematic-manager/core/dist/easymodes/linkTypes.js +17 -4
- package/node_modules/@homematic-manager/core/dist/i18n/lookup.d.ts +1 -1
- package/node_modules/@homematic-manager/core/dist/i18n/lookup.js +6 -2
- package/node_modules/@homematic-manager/core/dist/meta/paths.d.ts +2 -2
- package/node_modules/@homematic-manager/core/dist/meta/paths.js +2 -2
- package/node_modules/@homematic-manager/core/dist/meta/types.d.ts +55 -0
- package/node_modules/@homematic-manager/core/package.json +1 -1
- package/package.json +3 -3
- package/ui/assets/{index-Cd-Vx9ge.css → index-Ae1fKFy1.css} +1 -1
- package/ui/assets/index-B6GtwELI.js +21 -0
- package/ui/index.html +2 -2
- package/ui/assets/index-BGYochtr.js +0 -21
package/data/device-icons.json
CHANGED
|
@@ -482,6 +482,18 @@ export class Backend {
|
|
|
482
482
|
await this.#metaReady?.catch(() => undefined);
|
|
483
483
|
return (await this.#meta?.hmipPairing()) ?? null;
|
|
484
484
|
}
|
|
485
|
+
case 'meta.keyDeclines': {
|
|
486
|
+
// task 88: as `meta.pairing` - no store yet, or not the system's, has nothing to say
|
|
487
|
+
await this.#metaReady?.catch(() => undefined);
|
|
488
|
+
return (await this.#meta?.hmipKeyDeclines()) ?? null;
|
|
489
|
+
}
|
|
490
|
+
case 'meta.pairingAttempts': {
|
|
491
|
+
// task 88: as `meta.keyDeclines`
|
|
492
|
+
await this.#metaReady?.catch(() => undefined);
|
|
493
|
+
// a `since` that is no string is ignored rather than sent: the system answers `400` for it
|
|
494
|
+
const since = typeof params[0] === 'string' ? params[0] : undefined;
|
|
495
|
+
return (await this.#meta?.hmipPairingAttempts(since)) ?? null;
|
|
496
|
+
}
|
|
485
497
|
case 'meta.export':
|
|
486
498
|
return (await this.#requireMeta()).document();
|
|
487
499
|
case 'meta.import':
|
|
@@ -77,8 +77,13 @@ export interface ImageUpstream {
|
|
|
77
77
|
}
|
|
78
78
|
/** The URL of the CCU's web server, or `undefined` when no host is configured. */
|
|
79
79
|
export declare function ccuOrigin(upstream: ImageUpstream | undefined): string | undefined;
|
|
80
|
-
/**
|
|
81
|
-
|
|
80
|
+
/**
|
|
81
|
+
* The cache file of a picture: named after the CCU's file, not after the device type (B-103). The
|
|
82
|
+
* cache used to be keyed by the type, so a type the mapping missed stored the "unknown device"
|
|
83
|
+
* picture under its own name, and that copy would have outlived the fix of the lookup forever.
|
|
84
|
+
* Types that share a picture now share the file, too. Cannot escape the cache directory.
|
|
85
|
+
*/
|
|
86
|
+
export declare function cacheFileName(iconFile: string): string;
|
|
82
87
|
/** Where a picture came from; `memory` and `disk` are the two cache levels. */
|
|
83
88
|
export type DeviceImageSource = 'memory' | 'disk' | 'ccu' | 'bundled';
|
|
84
89
|
export interface DeviceImage {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
*/
|
|
38
38
|
import fs from 'node:fs/promises';
|
|
39
39
|
import path from 'node:path';
|
|
40
|
+
import { dataKey } from '@homematic-manager/core';
|
|
40
41
|
/** Where the CCU keeps its device pictures, in one directory per size. */
|
|
41
42
|
export const CCU_IMAGE_BASE = '/config/img/devices';
|
|
42
43
|
/** The key `device-icons.json` uses for "no idea what this is". */
|
|
@@ -112,10 +113,19 @@ export function ccuOrigin(upstream) {
|
|
|
112
113
|
}
|
|
113
114
|
return `${upstream.tls === true ? 'https' : 'http'}://${upstream.host}`;
|
|
114
115
|
}
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
/**
|
|
117
|
+
* The cache file of a picture: named after the CCU's file, not after the device type (B-103). The
|
|
118
|
+
* cache used to be keyed by the type, so a type the mapping missed stored the "unknown device"
|
|
119
|
+
* picture under its own name, and that copy would have outlived the fix of the lookup forever.
|
|
120
|
+
* Types that share a picture now share the file, too. Cannot escape the cache directory.
|
|
121
|
+
*/
|
|
122
|
+
export function cacheFileName(iconFile) {
|
|
123
|
+
const parsed = path.parse(iconFile);
|
|
124
|
+
const extension = parsed.ext || '.png';
|
|
125
|
+
return `${parsed.name
|
|
126
|
+
.replace(/[^A-Za-z0-9._-]/g, '_')
|
|
127
|
+
.replace(/^\.+/, '_')
|
|
128
|
+
.slice(0, 120)}${extension}`;
|
|
119
129
|
}
|
|
120
130
|
const silentLog = { warn: () => undefined, debug: () => undefined };
|
|
121
131
|
/**
|
|
@@ -155,8 +165,9 @@ export class DeviceImageService {
|
|
|
155
165
|
/** The file name the CCU knows this device type under, or `undefined`. */
|
|
156
166
|
async fileFor(deviceType) {
|
|
157
167
|
const icons = await this.icons();
|
|
158
|
-
//
|
|
159
|
-
|
|
168
|
+
// the pipeline keys the mapping by the upper-cased type with spaces as `_`; the CCU reports
|
|
169
|
+
// `HM-LC-Sw1-Pl` and `HmIP-eTRV-B-2 R4M` (B-103)
|
|
170
|
+
const file = icons[deviceType] ?? icons[dataKey(deviceType)] ?? icons[UNKNOWN_DEVICE_KEY];
|
|
160
171
|
if (file === undefined) {
|
|
161
172
|
return undefined;
|
|
162
173
|
}
|
|
@@ -185,7 +196,7 @@ export class DeviceImageService {
|
|
|
185
196
|
if (iconFile === undefined) {
|
|
186
197
|
return undefined;
|
|
187
198
|
}
|
|
188
|
-
const cacheFile = path.join(this.#options.cacheDir, cacheFileName(
|
|
199
|
+
const cacheFile = path.join(this.#options.cacheDir, cacheFileName(iconFile));
|
|
189
200
|
let fromDisk = await readIfPresent(cacheFile);
|
|
190
201
|
if (fromDisk && !looksLikeImage(fromDisk)) {
|
|
191
202
|
// B-57: an earlier version cached what the box answered, a page included
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* So the ref is resolved here, in one place, from the device caches - and never guessed anywhere
|
|
17
17
|
* else.
|
|
18
18
|
*/
|
|
19
|
-
import { type ConnectionConfig, type MetaDocument, type MetaEnum, type MetaHmipPairing, type MetaImportMode, type MetaNodePatch, type MetaObjectView, type MetaState, type MetaVersion, type SystemCertificateProblem } from '@homematic-manager/core';
|
|
19
|
+
import { type ConnectionConfig, type MetaDocument, type MetaEnum, type MetaHmipKeyDecline, type MetaHmipPairing, type MetaHmipPairingAttempts, type MetaImportMode, type MetaNodePatch, type MetaObjectView, type MetaState, type MetaVersion, type SystemCertificateProblem } from '@homematic-manager/core';
|
|
20
20
|
import type { NameStore } from '../cache/names.js';
|
|
21
21
|
import { type RegaScriptRunner } from './regaProvider.js';
|
|
22
22
|
import { SystemLink } from './system.js';
|
|
@@ -184,6 +184,24 @@ export declare class MetaService {
|
|
|
184
184
|
* pairing dialog then offers what it always offered. Never throws.
|
|
185
185
|
*/
|
|
186
186
|
hmipPairing(): Promise<MetaHmipPairing | undefined>;
|
|
187
|
+
/**
|
|
188
|
+
* Task 88: the devices whose HmIP inclusion the system declined for a wrong key - its warning
|
|
189
|
+
* `hmip-key-declined` (openccu-lite task 201), read afresh from `GET /api/system/v1/warnings`
|
|
190
|
+
* with the system API's credential (the person's session, else the profile's token; the
|
|
191
|
+
* addon's local token is refused there, and that is "nothing to say" as well). `undefined` on
|
|
192
|
+
* every connection without a system, on a system without the route and on one that does not
|
|
193
|
+
* answer: the pairing dialog then says what it always said. Never throws.
|
|
194
|
+
*/
|
|
195
|
+
hmipKeyDeclines(): Promise<MetaHmipKeyDecline[] | undefined>;
|
|
196
|
+
/**
|
|
197
|
+
* Task 88: why the system's HmIP pairings went the way they did - `GET
|
|
198
|
+
* /api/system/v1/radio/hmip/pairing[?since=]` (occulited task 158, `system:read`), with the
|
|
199
|
+
* system API's credential as the warnings. `since` is the `now` of an earlier answer.
|
|
200
|
+
* `undefined` on every connection without a system, on a system without the route (404: an
|
|
201
|
+
* openccu-lite before 2.0.0-beta.11), on a refused credential and on no answer: the pairing
|
|
202
|
+
* dialog then asks the warnings, and after them says what it always said. Never throws.
|
|
203
|
+
*/
|
|
204
|
+
hmipPairingAttempts(since?: string): Promise<MetaHmipPairingAttempts | undefined>;
|
|
187
205
|
/**
|
|
188
206
|
* Task 57: the box's base URL while the store is the box's - where its other APIs live too.
|
|
189
207
|
* `undefined` on every connection without a box, which is what keeps the heating groups off a
|
|
@@ -23,7 +23,13 @@ import { validationError } from '../errors.js';
|
|
|
23
23
|
import { LocalMetaProvider } from './localProvider.js';
|
|
24
24
|
import { OcculiteProvider } from './occuliteProvider.js';
|
|
25
25
|
import { RegaMetaProvider } from './regaProvider.js';
|
|
26
|
-
import { DETECT_TIMEOUT_MS, SystemLink, detectSystem, transportFor } from './system.js';
|
|
26
|
+
import { DETECT_TIMEOUT_MS, SystemLink, detectSystem, hmipKeyDeclinesOf, hmipPairingAttemptsOf, transportFor, } from './system.js';
|
|
27
|
+
/** Task 88: openccu-lite's Status page warnings, where `hmip-key-declined` is one. */
|
|
28
|
+
const WARNINGS_PATH = '/api/system/v1/warnings';
|
|
29
|
+
/** Task 88: the pairing dialog asks every five seconds; an answer later than that is no use to it. */
|
|
30
|
+
const WARNINGS_TIMEOUT_MS = 5_000;
|
|
31
|
+
/** Task 88: openccu-lite's HmIP pairing attempts, read from hmipserver's lines (occulited task 158). */
|
|
32
|
+
const PAIRING_ATTEMPTS_PATH = '/api/system/v1/radio/hmip/pairing';
|
|
27
33
|
/**
|
|
28
34
|
* A session id as the box hands it over: `@xxxxxxxxxx@`, the CCU convention, or bare.
|
|
29
35
|
*
|
|
@@ -452,6 +458,49 @@ export class MetaService {
|
|
|
452
458
|
const found = await detectSystem(this.#transport, baseUrl, this.#options.detectTimeoutMs ?? DETECT_TIMEOUT_MS);
|
|
453
459
|
return found.version?.hmip;
|
|
454
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* Task 88: the devices whose HmIP inclusion the system declined for a wrong key - its warning
|
|
463
|
+
* `hmip-key-declined` (openccu-lite task 201), read afresh from `GET /api/system/v1/warnings`
|
|
464
|
+
* with the system API's credential (the person's session, else the profile's token; the
|
|
465
|
+
* addon's local token is refused there, and that is "nothing to say" as well). `undefined` on
|
|
466
|
+
* every connection without a system, on a system without the route and on one that does not
|
|
467
|
+
* answer: the pairing dialog then says what it always said. Never throws.
|
|
468
|
+
*/
|
|
469
|
+
async hmipKeyDeclines() {
|
|
470
|
+
const link = this.boxLink();
|
|
471
|
+
if (link === undefined) {
|
|
472
|
+
return undefined;
|
|
473
|
+
}
|
|
474
|
+
try {
|
|
475
|
+
return hmipKeyDeclinesOf(await link.client('write').request('GET', WARNINGS_PATH, undefined, { timeout: WARNINGS_TIMEOUT_MS }));
|
|
476
|
+
}
|
|
477
|
+
catch {
|
|
478
|
+
return undefined;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Task 88: why the system's HmIP pairings went the way they did - `GET
|
|
483
|
+
* /api/system/v1/radio/hmip/pairing[?since=]` (occulited task 158, `system:read`), with the
|
|
484
|
+
* system API's credential as the warnings. `since` is the `now` of an earlier answer.
|
|
485
|
+
* `undefined` on every connection without a system, on a system without the route (404: an
|
|
486
|
+
* openccu-lite before 2.0.0-beta.11), on a refused credential and on no answer: the pairing
|
|
487
|
+
* dialog then asks the warnings, and after them says what it always said. Never throws.
|
|
488
|
+
*/
|
|
489
|
+
async hmipPairingAttempts(since) {
|
|
490
|
+
const link = this.boxLink();
|
|
491
|
+
if (link === undefined) {
|
|
492
|
+
return undefined;
|
|
493
|
+
}
|
|
494
|
+
const path = since === undefined || since === ''
|
|
495
|
+
? PAIRING_ATTEMPTS_PATH
|
|
496
|
+
: `${PAIRING_ATTEMPTS_PATH}?since=${encodeURIComponent(since)}`;
|
|
497
|
+
try {
|
|
498
|
+
return hmipPairingAttemptsOf(await link.client('write').request('GET', path, undefined, { timeout: WARNINGS_TIMEOUT_MS }));
|
|
499
|
+
}
|
|
500
|
+
catch {
|
|
501
|
+
return undefined;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
455
504
|
/**
|
|
456
505
|
* Task 57: the box's base URL while the store is the box's - where its other APIs live too.
|
|
457
506
|
* `undefined` on every connection without a box, which is what keeps the heating groups off a
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import type { MetaCopy, Transport, WriteResult } from 'occulite-client';
|
|
30
30
|
import { OccuLite, type Auth } from 'occulite-client';
|
|
31
31
|
import { type Paired, type PairOptions } from 'occulite-client/node';
|
|
32
|
-
import { MetaError, type ConnectionTest, type MetaDocument, type MetaEvent, type MetaHmipPairing, type MetaVersion, type SystemCertificateProblem, type SystemTrust } from '@homematic-manager/core';
|
|
32
|
+
import { MetaError, type ConnectionTest, type MetaDocument, type MetaEvent, type MetaHmipKeyDecline, type MetaHmipPairing, type MetaHmipPairingAttempts, type MetaVersion, type SystemCertificateProblem, type SystemTrust } from '@homematic-manager/core';
|
|
33
33
|
/** How long a plain request may take. The system is on the LAN or on the loopback. */
|
|
34
34
|
export declare const DEFAULT_TIMEOUT_MS = 10000;
|
|
35
35
|
/**
|
|
@@ -107,6 +107,22 @@ export declare function httpsRedirectTarget(location: string | undefined, reques
|
|
|
107
107
|
} | undefined;
|
|
108
108
|
/** The `hmip` object of the version answer when it has the defined shape, else `undefined`. */
|
|
109
109
|
export declare function hmipPairingOf(value: unknown): MetaHmipPairing | undefined;
|
|
110
|
+
/** Task 88: the id of openccu-lite's warning for an HmIP inclusion declined for a wrong key (task 201). */
|
|
111
|
+
export declare const HMIP_KEY_DECLINED = "hmip-key-declined";
|
|
112
|
+
/**
|
|
113
|
+
* Task 88: the `hmip-key-declined` entries of a `GET /api/system/v1/warnings` answer, or
|
|
114
|
+
* `undefined` when the body is not that answer at all (then the system says nothing, which the
|
|
115
|
+
* pairing dialog treats like a CCU). An entry without a usable SGTIN is skipped, not fatal; `at`
|
|
116
|
+
* and `address` are kept only as strings.
|
|
117
|
+
*/
|
|
118
|
+
export declare function hmipKeyDeclinesOf(body: unknown): MetaHmipKeyDecline[] | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Task 88: openccu-lite's `GET /api/system/v1/radio/hmip/pairing` answer (occulited task 158), or
|
|
121
|
+
* `undefined` when the body is not that answer (the pairing dialog then falls back to the
|
|
122
|
+
* warnings). An attempt without a usable SGTIN or outcome is skipped, not fatal; the optional
|
|
123
|
+
* fields are kept only in their own type.
|
|
124
|
+
*/
|
|
125
|
+
export declare function hmipPairingAttemptsOf(body: unknown): MetaHmipPairingAttempts | undefined;
|
|
110
126
|
/**
|
|
111
127
|
* `GET /api/meta/v1/version` - the runtime detection, and the only call that needs no credential.
|
|
112
128
|
*
|
|
@@ -262,6 +262,92 @@ export function hmipPairingOf(value) {
|
|
|
262
262
|
}
|
|
263
263
|
return { keyserver_mode: keyserver_mode, device_keys, offline_pairing };
|
|
264
264
|
}
|
|
265
|
+
/** Task 88: the id of openccu-lite's warning for an HmIP inclusion declined for a wrong key (task 201). */
|
|
266
|
+
export const HMIP_KEY_DECLINED = 'hmip-key-declined';
|
|
267
|
+
/**
|
|
268
|
+
* Task 88: the `hmip-key-declined` entries of a `GET /api/system/v1/warnings` answer, or
|
|
269
|
+
* `undefined` when the body is not that answer at all (then the system says nothing, which the
|
|
270
|
+
* pairing dialog treats like a CCU). An entry without a usable SGTIN is skipped, not fatal; `at`
|
|
271
|
+
* and `address` are kept only as strings.
|
|
272
|
+
*/
|
|
273
|
+
export function hmipKeyDeclinesOf(body) {
|
|
274
|
+
if (typeof body !== 'object' || body === null) {
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
const { warnings } = body;
|
|
278
|
+
if (!Array.isArray(warnings)) {
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
const declines = [];
|
|
282
|
+
for (const warning of warnings) {
|
|
283
|
+
if (typeof warning !== 'object' || warning === null) {
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const { id, variant, params } = warning;
|
|
287
|
+
if (id !== HMIP_KEY_DECLINED || typeof params !== 'object' || params === null) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
const { sgtin, address, at } = params;
|
|
291
|
+
if (typeof sgtin !== 'string' || sgtin === '') {
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
const when = typeof at === 'string' && at !== '' ? at : undefined;
|
|
295
|
+
declines.push({
|
|
296
|
+
sgtin,
|
|
297
|
+
...(typeof address === 'string' && address !== '' ? { address } : {}),
|
|
298
|
+
...(when === undefined ? {} : { at: when }),
|
|
299
|
+
variant: typeof variant === 'string' && variant !== '' ? variant : `${sgtin}@${when ?? ''}`,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
return declines;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Task 88: openccu-lite's `GET /api/system/v1/radio/hmip/pairing` answer (occulited task 158), or
|
|
306
|
+
* `undefined` when the body is not that answer (the pairing dialog then falls back to the
|
|
307
|
+
* warnings). An attempt without a usable SGTIN or outcome is skipped, not fatal; the optional
|
|
308
|
+
* fields are kept only in their own type.
|
|
309
|
+
*/
|
|
310
|
+
export function hmipPairingAttemptsOf(body) {
|
|
311
|
+
if (typeof body !== 'object' || body === null) {
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
const { now, attempts } = body;
|
|
315
|
+
if (typeof now !== 'string' || now === '' || !Array.isArray(attempts)) {
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
const out = [];
|
|
319
|
+
for (const attempt of attempts) {
|
|
320
|
+
if (typeof attempt !== 'object' || attempt === null) {
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const { sgtin, address, outcome, reason, failed, at, http_status, message } = attempt;
|
|
324
|
+
if (typeof sgtin !== 'string' || sgtin === '' || typeof outcome !== 'string' || outcome === '') {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
const text = messageOf(message);
|
|
328
|
+
out.push({
|
|
329
|
+
sgtin,
|
|
330
|
+
...(typeof address === 'string' && address !== '' ? { address } : {}),
|
|
331
|
+
outcome,
|
|
332
|
+
...(typeof reason === 'string' && reason !== '' ? { reason } : {}),
|
|
333
|
+
failed: failed === true,
|
|
334
|
+
...(typeof at === 'string' && at !== '' ? { at } : {}),
|
|
335
|
+
...(typeof http_status === 'number' && Number.isInteger(http_status) && http_status > 0
|
|
336
|
+
? { http_status }
|
|
337
|
+
: {}),
|
|
338
|
+
...(text === undefined ? {} : { message: text }),
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return { now, attempts: out };
|
|
342
|
+
}
|
|
343
|
+
/** Task 88: an attempt's `{en, de}` sentence, when both are strings. */
|
|
344
|
+
function messageOf(value) {
|
|
345
|
+
if (typeof value !== 'object' || value === null) {
|
|
346
|
+
return undefined;
|
|
347
|
+
}
|
|
348
|
+
const { en, de } = value;
|
|
349
|
+
return typeof en === 'string' && typeof de === 'string' ? { en, de } : undefined;
|
|
350
|
+
}
|
|
265
351
|
/** The version answer in a response body, when it is one. */
|
|
266
352
|
function versionOf(status, body) {
|
|
267
353
|
if (status < 200 || status > 299) {
|
|
@@ -11,7 +11,7 @@ import type { RpcProtocol, UserDefinedInterface } from '../interfaces/table.js';
|
|
|
11
11
|
import type { ParamsetDescription } from '../paramset/description.js';
|
|
12
12
|
import type { Paramset, ParamsetWrite, RpcWriteValue } from '../rpc/values.js';
|
|
13
13
|
import type { LanguageChoice } from '../data/types.js';
|
|
14
|
-
import type { MetaDocument, MetaEnum, MetaHmipPairing, MetaImportMode, MetaNodePatch } from '../meta/types.js';
|
|
14
|
+
import type { MetaDocument, MetaEnum, MetaHmipKeyDecline, MetaHmipPairing, MetaHmipPairingAttempts, MetaImportMode, MetaNodePatch } from '../meta/types.js';
|
|
15
15
|
/** Any value an interface process returns: XML-RPC / BIN-RPC scalars, arrays and structs. */
|
|
16
16
|
export type RpcValue = boolean | number | string | RpcValue[] | {
|
|
17
17
|
[key: string]: RpcValue;
|
|
@@ -1201,6 +1201,25 @@ export interface ApiMethods {
|
|
|
1201
1201
|
params: [];
|
|
1202
1202
|
result: MetaHmipPairing | null;
|
|
1203
1203
|
};
|
|
1204
|
+
/**
|
|
1205
|
+
* Task 88: the devices whose HmIP inclusion the system declined for a wrong key (openccu-lite's
|
|
1206
|
+
* warning `hmip-key-declined`), asked afresh each time. `null` wherever nothing can say it: a
|
|
1207
|
+
* CCU, no connection, a system without the warnings API, a credential it refuses, no answer.
|
|
1208
|
+
*/
|
|
1209
|
+
'meta.keyDeclines': {
|
|
1210
|
+
params: [];
|
|
1211
|
+
result: MetaHmipKeyDecline[] | null;
|
|
1212
|
+
};
|
|
1213
|
+
/**
|
|
1214
|
+
* Task 88: the HmIP pairing attempts the system read from hmipserver's lines (openccu-lite's
|
|
1215
|
+
* `GET /api/system/v1/radio/hmip/pairing`), all of this boot or those since `since` - the `now`
|
|
1216
|
+
* of an earlier answer. `null` wherever nothing can say it: a CCU, no connection, a system
|
|
1217
|
+
* without the route (the dialog then asks `meta.keyDeclines`), a credential it refuses, no answer.
|
|
1218
|
+
*/
|
|
1219
|
+
'meta.pairingAttempts': {
|
|
1220
|
+
params: [since?: string];
|
|
1221
|
+
result: MetaHmipPairingAttempts | null;
|
|
1222
|
+
};
|
|
1204
1223
|
/** The whole document, for a backup or a move between installations. */
|
|
1205
1224
|
'meta.export': {
|
|
1206
1225
|
params: [];
|
|
@@ -262,6 +262,14 @@ export interface Translations {
|
|
|
262
262
|
}
|
|
263
263
|
/** device type -> image file name (relative, no directory), as the CCU serves it under /config/img/devices/<size>/. */
|
|
264
264
|
export type DeviceIcons = Record<string, string>;
|
|
265
|
+
/**
|
|
266
|
+
* The key the data pipeline files an identifier under (`data/scripts/lib/translations.mjs`'s
|
|
267
|
+
* `identifierKey`): spaces become `_`, everything upper case. A device type is reported mixed case
|
|
268
|
+
* and may contain a space - `HmIP-eTRV-B-2 R4M`, `ZEL STG RM FWT` - while `device-icons.json` and the
|
|
269
|
+
* `deviceModels` of the translations hold `HMIP-ETRV-B-2_R4M` and `ZEL_STG_RM_FWT` (B-103): a lookup
|
|
270
|
+
* that only upper-cases misses every type with a space in it.
|
|
271
|
+
*/
|
|
272
|
+
export declare function dataKey(identifier: string): string;
|
|
265
273
|
/** Where the data came from; written by the pipeline, shown in the About dialog. */
|
|
266
274
|
export interface DataManifest {
|
|
267
275
|
generatedAt: string;
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Field names are camelCase and stable; extend with optional fields, never rename or repurpose.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* The key the data pipeline files an identifier under (`data/scripts/lib/translations.mjs`'s
|
|
12
|
+
* `identifierKey`): spaces become `_`, everything upper case. A device type is reported mixed case
|
|
13
|
+
* and may contain a space - `HmIP-eTRV-B-2 R4M`, `ZEL STG RM FWT` - while `device-icons.json` and the
|
|
14
|
+
* `deviceModels` of the translations hold `HMIP-ETRV-B-2_R4M` and `ZEL_STG_RM_FWT` (B-103): a lookup
|
|
15
|
+
* that only upper-cases misses every type with a space in it.
|
|
16
|
+
*/
|
|
17
|
+
export function dataKey(identifier) {
|
|
18
|
+
return identifier.replaceAll(' ', '_').toUpperCase();
|
|
19
|
+
}
|
|
10
20
|
/**
|
|
11
21
|
* File layout the pipeline writes under `data/dist/` and every `DataSource` reads:
|
|
12
22
|
*
|
|
@@ -103,6 +103,19 @@ export declare function decodeDirection(direction: number | undefined): (typeof
|
|
|
103
103
|
export declare const CENTRAL_DEVICE_TYPES: readonly string[];
|
|
104
104
|
/** Is this the CCU's own virtual device rather than real hardware? */
|
|
105
105
|
export declare function isCentralDeviceType(type: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The device types of the central's own radio module over HmIP-RF: the HmIP-CCU3's, the RPI-RF-MOD's
|
|
108
|
+
* and the HmIP-RFUSB's. hmipserver lists it as a device of `SUBTYPE` `CCU` with a `:0` that carries
|
|
109
|
+
* the duty cycle and the carrier sense level. Unlike {@link CENTRAL_DEVICE_TYPES} it is hardware -
|
|
110
|
+
* firmware, live values - so it is no central type; it is only never deleted, replaced or given
|
|
111
|
+
* settings, as the WebUI does since OpenCCU-Base #210.
|
|
112
|
+
*/
|
|
113
|
+
export declare const RADIO_MODULE_DEVICE_TYPES: readonly string[];
|
|
114
|
+
/** Is this device description the central's radio module (by its type, or hmipserver's `SUBTYPE` `CCU`)? */
|
|
115
|
+
export declare function isRadioModuleDevice(device: {
|
|
116
|
+
readonly TYPE?: string | undefined;
|
|
117
|
+
readonly SUBTYPE?: string | undefined;
|
|
118
|
+
}): boolean;
|
|
106
119
|
/**
|
|
107
120
|
* Is this description a channel (rather than a device)? Narrows PARENT to a string, which is
|
|
108
121
|
* what makes the parent lookups below total.
|
|
@@ -154,6 +167,8 @@ export declare class DeviceIndex {
|
|
|
154
167
|
maintenanceChannelOf(address: string): DeviceDescription | undefined;
|
|
155
168
|
/** Is this address one of the CCU's own virtual devices (or a channel of one)? */
|
|
156
169
|
isCentral(address: string): boolean;
|
|
170
|
+
/** Is this address the central's radio module (or one of its channels)? See {@link isRadioModuleDevice}. */
|
|
171
|
+
isRadioModule(address: string): boolean;
|
|
157
172
|
/** The CCU's own virtual devices on this interface. */
|
|
158
173
|
centralDevices(): DeviceDescription[];
|
|
159
174
|
/** Channel addresses that can send to the given link role. */
|
|
@@ -124,6 +124,19 @@ export const CENTRAL_DEVICE_TYPES = ['HM-RCV-50', 'HMW-RCV-50', 'HmIP-RCV-50', '
|
|
|
124
124
|
export function isCentralDeviceType(type) {
|
|
125
125
|
return CENTRAL_DEVICE_TYPES.includes(type);
|
|
126
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* The device types of the central's own radio module over HmIP-RF: the HmIP-CCU3's, the RPI-RF-MOD's
|
|
129
|
+
* and the HmIP-RFUSB's. hmipserver lists it as a device of `SUBTYPE` `CCU` with a `:0` that carries
|
|
130
|
+
* the duty cycle and the carrier sense level. Unlike {@link CENTRAL_DEVICE_TYPES} it is hardware -
|
|
131
|
+
* firmware, live values - so it is no central type; it is only never deleted, replaced or given
|
|
132
|
+
* settings, as the WebUI does since OpenCCU-Base #210.
|
|
133
|
+
*/
|
|
134
|
+
export const RADIO_MODULE_DEVICE_TYPES = ['HmIP-CCU3', 'RPI-RF-MOD', 'HmIP-RFUSB'];
|
|
135
|
+
const RADIO_MODULE_TYPES_UPPER = new Set(RADIO_MODULE_DEVICE_TYPES.map((type) => type.toUpperCase()));
|
|
136
|
+
/** Is this device description the central's radio module (by its type, or hmipserver's `SUBTYPE` `CCU`)? */
|
|
137
|
+
export function isRadioModuleDevice(device) {
|
|
138
|
+
return RADIO_MODULE_TYPES_UPPER.has((device.TYPE ?? '').toUpperCase()) || device.SUBTYPE === 'CCU';
|
|
139
|
+
}
|
|
127
140
|
/**
|
|
128
141
|
* Is this description a channel (rather than a device)? Narrows PARENT to a string, which is
|
|
129
142
|
* what makes the parent lookups below total.
|
|
@@ -280,6 +293,17 @@ export class DeviceIndex {
|
|
|
280
293
|
const parentType = description.PARENT_TYPE ?? this.parentOf(address)?.TYPE;
|
|
281
294
|
return parentType !== undefined && isCentralDeviceType(parentType);
|
|
282
295
|
}
|
|
296
|
+
/** Is this address the central's radio module (or one of its channels)? See {@link isRadioModuleDevice}. */
|
|
297
|
+
isRadioModule(address) {
|
|
298
|
+
const description = this.#byAddress.get(address);
|
|
299
|
+
if (!description) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
if (!isChannelDescription(description)) {
|
|
303
|
+
return isRadioModuleDevice(description);
|
|
304
|
+
}
|
|
305
|
+
return isRadioModuleDevice(this.parentOf(address) ?? { TYPE: description.PARENT_TYPE });
|
|
306
|
+
}
|
|
283
307
|
/** The CCU's own virtual devices on this interface. */
|
|
284
308
|
centralDevices() {
|
|
285
309
|
return this.devices().filter((device) => isCentralDeviceType(device.TYPE));
|
|
@@ -109,10 +109,13 @@ export declare function isHmipInterface(interfaceName: string): boolean;
|
|
|
109
109
|
* index, a name is looked up in the description's `VALUE_LIST`. `undefined` when neither works.
|
|
110
110
|
*/
|
|
111
111
|
export declare function enumValueIndex(value: ParamsetValue | undefined, values: readonly string[] | undefined): number | undefined;
|
|
112
|
+
/** No profile folder at all: the link dialog offers the expert view only (B-101). */
|
|
113
|
+
export declare const NO_PROFILES: LinkProfileTypes;
|
|
112
114
|
/**
|
|
113
115
|
* The receiver folder and sender file the WebUI takes a link's profiles from. Without the reads a
|
|
114
116
|
* rule needs (a query missing, failing or answering nothing), the rule leaves the type as it is,
|
|
115
|
-
* which is what hmm did before
|
|
117
|
+
* which is what hmm did before - except on BidCos-Wired, where that would be a radio folder and the
|
|
118
|
+
* answer is {@link NO_PROFILES} (B-101).
|
|
116
119
|
*/
|
|
117
120
|
export declare function linkProfileTypes(interfaceName: string, receiver: LinkEnd, sender: LinkEnd, queries?: LinkTypeQueries): Promise<LinkProfileTypes>;
|
|
118
121
|
//# sourceMappingURL=linkTypes.d.ts.map
|
|
@@ -272,7 +272,11 @@ async function dispatch(folder, senderType, receiver, sender, master) {
|
|
|
272
272
|
: '';
|
|
273
273
|
return { receiverType: dispatcher.folder, senderType: `${senderType}_${String(mode)}${variant}` };
|
|
274
274
|
}
|
|
275
|
-
|
|
275
|
+
/** hs485d's interface: its links take their profiles from the `HMW_` folders only (B-101). */
|
|
276
|
+
const WIRED_INTERFACE = 'BidCos-Wired';
|
|
277
|
+
/** No profile folder at all: the link dialog offers the expert view only (B-101). */
|
|
278
|
+
export const NO_PROFILES = { receiverType: '', senderType: '' };
|
|
279
|
+
async function bidcosTypes(interfaceName, receiver, sender, queries, master) {
|
|
276
280
|
const answer = await ask(() => queries.linkParamsetId?.(receiver.address) ?? Promise.resolve(''), '');
|
|
277
281
|
// the WebUI's getExistingParamId: the first id of the (Tcl) list it has a file for
|
|
278
282
|
const paramid = answer
|
|
@@ -281,8 +285,16 @@ async function bidcosTypes(receiver, sender, queries, master) {
|
|
|
281
285
|
.map((word) => (word.includes('=') ? (word.split('=')[1] ?? '') : word))
|
|
282
286
|
.find((id) => Object.prototype.hasOwnProperty.call(BIDCOS_LINK_FILES, id));
|
|
283
287
|
const rules = paramid === undefined ? undefined : BIDCOS_LINK_FILES[paramid];
|
|
284
|
-
if (!rules)
|
|
288
|
+
if (!rules) {
|
|
289
|
+
// B-101: a wired channel's types are the radio ones (a HMW-LC-Dim1L-DR is DIMMER and KEY), so
|
|
290
|
+
// the plain folder holds BidCos-RF's profiles - with RF's jump-table numbers (0 = no jump, one
|
|
291
|
+
// higher than hs485d's) and RF's "not used" time 111600 s instead of the wired 16383000 s.
|
|
292
|
+
// Written to a wired dimmer, they left it in a running on-timer and ignoring presses. Without
|
|
293
|
+
// the `hmw_*_ch_link` id there is no wired profile to pick: no easy mode, the expert view only.
|
|
294
|
+
if (interfaceName === WIRED_INTERFACE)
|
|
295
|
+
return NO_PROFILES;
|
|
285
296
|
return { receiverType: receiver.type, senderType: sender.type };
|
|
297
|
+
}
|
|
286
298
|
let receiverType = receiver.type;
|
|
287
299
|
if (rules.receiver === 'HMW_')
|
|
288
300
|
receiverType = `HMW_${receiver.type}`;
|
|
@@ -311,12 +323,13 @@ async function bidcosTypes(receiver, sender, queries, master) {
|
|
|
311
323
|
/**
|
|
312
324
|
* The receiver folder and sender file the WebUI takes a link's profiles from. Without the reads a
|
|
313
325
|
* rule needs (a query missing, failing or answering nothing), the rule leaves the type as it is,
|
|
314
|
-
* which is what hmm did before
|
|
326
|
+
* which is what hmm did before - except on BidCos-Wired, where that would be a radio folder and the
|
|
327
|
+
* answer is {@link NO_PROFILES} (B-101).
|
|
315
328
|
*/
|
|
316
329
|
export async function linkProfileTypes(interfaceName, receiver, sender, queries = {}) {
|
|
317
330
|
const master = cachedMaster(queries);
|
|
318
331
|
if (!isHmipInterface(interfaceName)) {
|
|
319
|
-
return bidcosTypes(receiver, sender, queries, master);
|
|
332
|
+
return bidcosTypes(interfaceName, receiver, sender, queries, master);
|
|
320
333
|
}
|
|
321
334
|
const folder = await hmipReceiver(receiver, queries, master);
|
|
322
335
|
const senderType = await hmipSender(receiver, sender, master);
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* second - and now the same two steps again in the fallback language, so a missing German string
|
|
20
20
|
* shows the English one instead of the raw identifier.
|
|
21
21
|
*/
|
|
22
|
-
import type
|
|
22
|
+
import { type Language, type Translations } from '../data/types.js';
|
|
23
23
|
/** The order in which languages are consulted; the first that has the key wins. */
|
|
24
24
|
export type TranslationChain = readonly Translations[];
|
|
25
25
|
/** Reads labels and help texts out of one or more `Translations`. */
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* second - and now the same two steps again in the fallback language, so a missing German string
|
|
20
20
|
* shows the English one instead of the raw identifier.
|
|
21
21
|
*/
|
|
22
|
+
import { dataKey } from '../data/types.js';
|
|
22
23
|
/** Reads labels and help texts out of one or more `Translations`. */
|
|
23
24
|
export class TranslationLookup {
|
|
24
25
|
#chain;
|
|
@@ -114,9 +115,12 @@ function keys(suffix, channelType) {
|
|
|
114
115
|
return [...qualified, ...qualified.map((key) => key.toUpperCase()), ...bare];
|
|
115
116
|
}));
|
|
116
117
|
}
|
|
117
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* The key as it was given, its upper-case form, and the pipeline's own key form with spaces as `_`
|
|
120
|
+
* (B-103: `HmIP-eTRV-B-2 R4M` is filed as `HMIP-ETRV-B-2_R4M`), where these differ.
|
|
121
|
+
*/
|
|
118
122
|
function identifiers(value) {
|
|
119
|
-
return dedupe([value, value.toUpperCase()]);
|
|
123
|
+
return dedupe([value, value.toUpperCase(), dataKey(value)]);
|
|
120
124
|
}
|
|
121
125
|
function dedupe(values) {
|
|
122
126
|
return [...new Set(values)];
|
|
@@ -15,8 +15,8 @@ export interface MetaRef {
|
|
|
15
15
|
* `<interface>.<address>` split at the **first** dot, or `undefined`.
|
|
16
16
|
*
|
|
17
17
|
* The interface name never contains a dot; the address may (it does not today, but the rule is the
|
|
18
|
-
* separator, not the shape of what follows it). `BidCos-RF.
|
|
19
|
-
* `BidCos-RF.
|
|
18
|
+
* separator, not the shape of what follows it). `BidCos-RF.XEQ0000001:1` is a channel,
|
|
19
|
+
* `BidCos-RF.XEQ0000001` the device it belongs to.
|
|
20
20
|
*/
|
|
21
21
|
export declare function parseRef(ref: string): MetaRef | undefined;
|
|
22
22
|
/** The ref of an address on an interface. The inverse of {@link parseRef}. */
|
|
@@ -14,8 +14,8 @@ const ICON_PATTERN = /^[a-z0-9-]+$/;
|
|
|
14
14
|
* `<interface>.<address>` split at the **first** dot, or `undefined`.
|
|
15
15
|
*
|
|
16
16
|
* The interface name never contains a dot; the address may (it does not today, but the rule is the
|
|
17
|
-
* separator, not the shape of what follows it). `BidCos-RF.
|
|
18
|
-
* `BidCos-RF.
|
|
17
|
+
* separator, not the shape of what follows it). `BidCos-RF.XEQ0000001:1` is a channel,
|
|
18
|
+
* `BidCos-RF.XEQ0000001` the device it belongs to.
|
|
19
19
|
*/
|
|
20
20
|
export function parseRef(ref) {
|
|
21
21
|
const dot = ref.indexOf('.');
|