homematic-manager 3.6.0 → 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/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/package.json +1 -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/i18n/lookup.d.ts +1 -1
- package/node_modules/@homematic-manager/core/dist/i18n/lookup.js +6 -2
- package/node_modules/@homematic-manager/core/package.json +1 -1
- package/package.json +3 -3
- package/ui/assets/index-B6GtwELI.js +21 -0
- package/ui/index.html +1 -1
- package/ui/assets/index-C1lKPyuT.js +0 -21
|
@@ -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
|
|
@@ -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
|
*
|
|
@@ -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)];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homematic-manager",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Configure and administer Homematic and HomematicIP devices - devices and channels, direct links, paramsets, RSSI, service messages, events and an RPC console - from a local HTTP/WebSocket server that also serves the web UI",
|
|
6
6
|
"keywords": [
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"hm-simulator": "^1.5.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@homematic-manager/backend": "3.6.
|
|
71
|
-
"@homematic-manager/core": "3.6.
|
|
70
|
+
"@homematic-manager/backend": "3.6.1",
|
|
71
|
+
"@homematic-manager/core": "3.6.1",
|
|
72
72
|
"binrpc": "^4.2.0",
|
|
73
73
|
"homematic-rega": "^2.0.0",
|
|
74
74
|
"homematic-xmlrpc": "^2.0.0",
|