iobroker.zigbee2mqtt 3.0.0 → 3.0.2
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/README.md +6 -0
- package/io-package.json +27 -14
- package/lib/deviceController.js +3 -5
- package/lib/imageController.js +43 -30
- package/lib/websocketController.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -22,6 +22,12 @@ This adapter allows to control the data points of the devices of a Zigbee2MQTT i
|
|
|
22
22
|
[Adapter Documentation](https://github.com/arteck/ioBroker.zigbee2mqtt/blob/main/docs/wiki.md)
|
|
23
23
|
|
|
24
24
|
## Changelog
|
|
25
|
+
### 3.0.2 (2025-01-06)
|
|
26
|
+
- (simateck) corr WebSocket connection
|
|
27
|
+
|
|
28
|
+
### 3.0.1 (2025-01-04)
|
|
29
|
+
- (arteck) corr icon download
|
|
30
|
+
|
|
25
31
|
### 3.0.0 (2025-01-04)
|
|
26
32
|
- (arteck) adaptation z2m 2.x
|
|
27
33
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "zigbee2mqtt",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"3.0.2": {
|
|
7
|
+
"en": "corr WebSocket connection",
|
|
8
|
+
"de": "korr WebSocket Verbindung",
|
|
9
|
+
"ru": "гофровое соединение WebSocket",
|
|
10
|
+
"pt": "conexão da WebSocket",
|
|
11
|
+
"nl": "corr WebSocket-verbinding",
|
|
12
|
+
"fr": "corr Connexion WebSocket",
|
|
13
|
+
"it": "collegamento corr WebSocket",
|
|
14
|
+
"es": "corr WebSocket connection",
|
|
15
|
+
"pl": "połączenie corr WebSocket",
|
|
16
|
+
"uk": "корр WebSocket підключення",
|
|
17
|
+
"zh-cn": "corr WebSocket 连接"
|
|
18
|
+
},
|
|
19
|
+
"3.0.1": {
|
|
20
|
+
"en": "corr icon download",
|
|
21
|
+
"de": "corr icon herunterladen",
|
|
22
|
+
"ru": "скачать значок",
|
|
23
|
+
"pt": "corrimento ícone download",
|
|
24
|
+
"nl": "corr pictogramdownload",
|
|
25
|
+
"fr": "corr icon télécharger",
|
|
26
|
+
"it": "icona corr scaricare",
|
|
27
|
+
"es": "corr icono descargar",
|
|
28
|
+
"pl": "pobierz ikonę corr",
|
|
29
|
+
"uk": "cкачати ігру corr",
|
|
30
|
+
"zh-cn": "corr 图标下载"
|
|
31
|
+
},
|
|
6
32
|
"3.0.0": {
|
|
7
33
|
"en": "adaptation z2m 2.x",
|
|
8
34
|
"de": "anpassung z2m 2.x",
|
|
@@ -67,19 +93,6 @@
|
|
|
67
93
|
"pl": "naprawić ścieżkę ikon",
|
|
68
94
|
"uk": "фіксувати шлях іконки",
|
|
69
95
|
"zh-cn": "修补图标路径"
|
|
70
|
-
},
|
|
71
|
-
"2.13.7": {
|
|
72
|
-
"en": "core dependecy\nupdate dependecy\nEnable occupancy to be always updated if true",
|
|
73
|
-
"de": "kernabhängigkeit\naktualisierung abhängigkeit\nErmöglichen Sie die Belegung immer aktualisieren, wenn zutreffend",
|
|
74
|
-
"ru": "основополагающая зависимость\nобновление\nВозможность всегда обновляться, если это правда",
|
|
75
|
-
"pt": "dependência do núcleo\natualização\nPermite que a ocupação seja sempre atualizada se for verdade",
|
|
76
|
-
"nl": "core afhankelijkheid\nafhankelijkheid bijwerken\nDe bezetting wordt altijd bijgewerkt indien deze waar is",
|
|
77
|
-
"fr": "dépendance du noyau\nmettre à jour la dépendance\nActiver l'occupation pour être toujours mis à jour si vrai",
|
|
78
|
-
"it": "core dipendenza\naggiornamento dipendenza\nAbilitare l'occupazione di essere sempre aggiornato se vero",
|
|
79
|
-
"es": "dependencia básica\ndependencia de actualización\nActivar ocupación para ser siempre actualizada si es verdad",
|
|
80
|
-
"pl": "zasadnicza zależność\naktualizacja zależności\nWłącz zawsze aktualizację obłożenia, jeśli jest prawdziwe",
|
|
81
|
-
"uk": "сердечник\nоновлення залежності\nУвімкнути можливість постійно оновлюватися, якщо правда",
|
|
82
|
-
"zh-cn": "核心依赖性\n更新依赖性\n启用若为真则总是更新占用"
|
|
83
96
|
}
|
|
84
97
|
},
|
|
85
98
|
"messages": [
|
package/lib/deviceController.js
CHANGED
|
@@ -251,11 +251,9 @@ class DeviceController {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
this.createCache[device.ieee_address].description != description
|
|
258
|
-
) {
|
|
254
|
+
if (!this.createCache[device.ieee_address] ||
|
|
255
|
+
this.createCache[device.ieee_address].name != deviceName ||
|
|
256
|
+
this.createCache[device.ieee_address].description != description) {
|
|
259
257
|
const deviceObj = {
|
|
260
258
|
type: 'device',
|
|
261
259
|
common: {
|
package/lib/imageController.js
CHANGED
|
@@ -18,7 +18,7 @@ class ImageController {
|
|
|
18
18
|
return deviceName ? deviceNameString.replace(/\u0000/g, '') : 'NA';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
getZ2mDeviceImageModelJPG(device) {
|
|
22
22
|
if (device && device.definition && device.definition.model) {
|
|
23
23
|
const icoString = `https://www.zigbee2mqtt.io/images/devices/${this.sanitizeZ2MDeviceName(device.definition.model)}.jpg`;
|
|
24
24
|
// eslint-disable-next-line no-control-regex
|
|
@@ -26,55 +26,58 @@ class ImageController {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
getZ2mDeviceImageModelPNG(device) {
|
|
30
|
+
if (device && device.definition && device.definition.model) {
|
|
31
|
+
const icoString = `https://www.zigbee2mqtt.io/images/devices/${this.sanitizeZ2MDeviceName(device.definition.model)}.png`;
|
|
32
|
+
// eslint-disable-next-line no-control-regex
|
|
33
|
+
return icoString.replace(/\u0000/g, '');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
29
38
|
getSlsDeviceImage(device) {
|
|
30
39
|
if (device && device.model_id) {
|
|
31
|
-
const icoString = `https://
|
|
40
|
+
const icoString = `https://www.zigbee2mqtt.io/images/devices/${this.sanitizeModelIDForImageUrl(device.model_id)}.png`;
|
|
32
41
|
// eslint-disable-next-line no-control-regex
|
|
33
42
|
return icoString.replace(/\u0000/g, '');
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
async getDeviceIcon(device) {
|
|
38
|
-
if (this.adapter.config.useDeviceIcons
|
|
39
|
-
return '';
|
|
40
|
-
}
|
|
47
|
+
if (!this.adapter.config.useDeviceIcons) return '';
|
|
41
48
|
|
|
42
|
-
const imageSize
|
|
49
|
+
const imageSize = this.adapter.config.deviceIconsSize;
|
|
43
50
|
|
|
44
|
-
const
|
|
51
|
+
const z2mIconFileNameJPG = `${this.sanitizeZ2MDeviceName(device.definition.model)}.jpg`;
|
|
52
|
+
const z2mIconFileNamePNG = `${this.sanitizeZ2MDeviceName(device.definition.model)}.png`;
|
|
45
53
|
const slsIconFileName = `${this.sanitizeModelIDForImageUrl(device.model_id)}.png`;
|
|
46
54
|
|
|
47
|
-
let
|
|
48
|
-
let iconFileName;
|
|
49
|
-
// Check whether an image has already been downloaded from Z2M.
|
|
50
|
-
if (await this.adapter.fileExistsAsync(this.adapter.namespace, z2mIconFileName)) {
|
|
51
|
-
iconFileName = z2mIconFileName;
|
|
52
|
-
}
|
|
53
|
-
// Check whether an image has already been downloaded from SLSys.
|
|
54
|
-
else if (await this.adapter.fileExistsAsync(this.adapter.namespace, slsIconFileName)) {
|
|
55
|
-
iconFileName = slsIconFileName;
|
|
56
|
-
}
|
|
57
|
-
// If not donwload image
|
|
58
|
-
else {
|
|
59
|
-
let iconUrl = this.getSlsDeviceImage(device);
|
|
60
|
-
|
|
61
|
-
this.adapter.log.info(`Download image for device model: ${device.definition.model}`);
|
|
55
|
+
let iconFileName = await this.getExistingIconFileName(z2mIconFileNameJPG, z2mIconFileNamePNG, slsIconFileName);
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
if (!iconFileName) {
|
|
58
|
+
const iconUrls = [
|
|
59
|
+
this.getZ2mDeviceImageModelJPG(device),
|
|
60
|
+
this.getZ2mDeviceImageModelPNG(device),
|
|
61
|
+
this.getSlsDeviceImage(device)
|
|
62
|
+
];
|
|
69
63
|
|
|
70
|
-
|
|
64
|
+
for (const iconUrl of iconUrls) {
|
|
65
|
+
try {
|
|
66
|
+
await this.downloadIcon(this.adapter, iconUrl, this.adapter.namespace);
|
|
67
|
+
iconFileName = this.getFileNameWithExtension(iconUrl);
|
|
68
|
+
break;
|
|
69
|
+
} catch (err) {
|
|
70
|
+
this.adapter.log.warn(`Failed to download image from ${iconUrl}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
74
|
|
|
73
|
-
if (
|
|
75
|
+
if (!iconFileName) {
|
|
74
76
|
this.adapter.log.warn(`No image for device model: ${device.definition.model} found!`);
|
|
75
77
|
return '';
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
let icon;
|
|
78
81
|
try {
|
|
79
82
|
// Load image from the Meta-Store
|
|
80
83
|
icon = await this.adapter.readFileAsync(this.adapter.namespace, iconFileName);
|
|
@@ -122,6 +125,16 @@ class ImageController {
|
|
|
122
125
|
adapter.log.warn(ex);
|
|
123
126
|
}
|
|
124
127
|
}
|
|
128
|
+
async getExistingIconFileName(z2mIconFileNameJPG, z2mIconFileNamePNG, slsIconFileName) {
|
|
129
|
+
if (await this.adapter.fileExistsAsync(this.adapter.namespace, z2mIconFileNameJPG)) {
|
|
130
|
+
return z2mIconFileNameJPG;
|
|
131
|
+
} else if (await this.adapter.fileExistsAsync(this.adapter.namespace, z2mIconFileNamePNG)) {
|
|
132
|
+
return z2mIconFileNamePNG;
|
|
133
|
+
} else if (await this.adapter.fileExistsAsync(this.adapter.namespace, slsIconFileName)) {
|
|
134
|
+
return slsIconFileName;
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
125
138
|
}
|
|
126
139
|
module.exports = {
|
|
127
140
|
ImageController,
|
|
@@ -19,7 +19,7 @@ class WebsocketController {
|
|
|
19
19
|
wsURL += `?token=${this.adapter.config.wsToken}`;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
wsClient = new WebSocket(wsURL, { rejectUnauthorized: false });
|
|
23
23
|
|
|
24
24
|
wsClient.on('open', () => {
|
|
25
25
|
// Send ping to server
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.zigbee2mqtt",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Zigbee2MQTT adapter for ioBroker",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Dennis Rathjen and Arthur Rupp",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@iobroker/adapter-core": "^3.2.3",
|
|
28
|
-
"@iobroker/dm-utils": "^0.6.
|
|
28
|
+
"@iobroker/dm-utils": "^0.6.11",
|
|
29
29
|
"aedes": "^0.51.3",
|
|
30
30
|
"aedes-persistence-nedb": "^2.0.3",
|
|
31
31
|
"mqtt": "^5.10.3",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
41
41
|
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
42
42
|
"@iobroker/adapter-dev": "^1.3.0",
|
|
43
|
-
"@iobroker/testing": "^
|
|
43
|
+
"@iobroker/testing": "^5.0.0",
|
|
44
44
|
"@tsconfig/node14": "^14.1.2",
|
|
45
45
|
"@types/chai": "^4.3.5",
|
|
46
46
|
"@types/chai-as-promised": "^8.0.1",
|
|
47
|
-
"@types/mocha": "^10.0.
|
|
47
|
+
"@types/mocha": "^10.0.10",
|
|
48
48
|
"@types/node": "^22.10.3",
|
|
49
49
|
"@types/node-schedule": "^2.1.7",
|
|
50
50
|
"@types/proxyquire": "^1.3.31",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/sinon-chai": "^3.2.12",
|
|
53
53
|
"chai": "^4.4.1",
|
|
54
54
|
"chai-as-promised": "^8.0.1",
|
|
55
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.17.0",
|
|
56
56
|
"eslint-config-prettier": "^9.1.0",
|
|
57
57
|
"eslint-plugin-prettier": "^5.2.1",
|
|
58
58
|
"mocha": "^11.0.1",
|