iobroker.zigbee2mqtt 3.0.10 → 3.0.13

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Arthur Rupp <arteck@outlook.com>,
3
+ Copyright (c) 2025-2026 Arthur Rupp <arteck@outlook.com>,
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -22,6 +22,16 @@ 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.13 (2026-01-25)
26
+ * (arteck) add action dp
27
+
28
+ ### 3.0.12 (2026-01-05)
29
+ * (arteck) Dependencies have been updated
30
+ * (MMeinhardt1) typo fix
31
+
32
+ ### 3.0.11 (2025-12-31)
33
+ - (arteck) fix info.connection
34
+
25
35
  ### 3.0.10 (2025-12-07)
26
36
  - (arteck) Dependencies have been updated
27
37
  - (bluefox) Changed role of `color_temp_startup` state to `level` to avoid double `level.temperature` in one device
@@ -43,250 +53,9 @@ This adapter allows to control the data points of the devices of a Zigbee2MQTT i
43
53
  - (arteck) settings restructure
44
54
  - (arteck) fix icon not found message
45
55
 
46
- ### 3.0.5 (2025-05-29)
47
- - (arteck) add additional folder for some devices (like smoke detector)
48
- - (arteck) state.js cleanup
49
- - (arteck) set available State to true if device message include last_seen status
50
-
51
- ### 3.0.4 (2025-05-11)
52
- - (arteck) update admin
53
-
54
- ### 3.0.3 (2025-02-03)
55
- - (arteck) corr illuminance (del illuminance_raw)
56
- - (arteck) indicator.alarm.flood
57
-
58
- ### 3.0.2 (2025-01-06)
59
- - (simateck) corr WebSocket connection
60
-
61
- ### 3.0.1 (2025-01-04)
62
- - (arteck) corr icon download
63
-
64
- ### 3.0.0 (2025-01-04)
65
- - (arteck) adaptation z2m 2.x
66
-
67
- ### 2.13.11 (2024-10-17)
68
- - (arteck) corr package.json
69
-
70
- ### 2.13.10 (2024-09-05)
71
- - (arteck) update dependecy
72
- - (arteck) add available object for groups
73
-
74
- ### 2.13.9 (2024-05-13)
75
- - (arteck) fix lint
76
- - (arteck) update dependecy
77
-
78
- ### 2.13.9 (2024-05-13)
79
- - (arteck) fix lint
80
- - (arteck) update dependecy
81
-
82
- ### 2.13.8 (2024-05-13)
83
- - (arteck) fix icon path
84
-
85
- ### 2.13.7 (2024-04-20)
86
- - (arteck) core dependecy
87
- - (arteck) update dependecy
88
- - (pepp86) Enable occupancy to be always updated if true
89
-
90
- ### 2.13.6 (2024-03-11)
91
- - (arteck) update dependecy
92
-
93
- ### 2.13.5 (2024-02-02)
94
- - (arteck) fixed mqttClient.end()
95
-
96
- ### 2.13.4 (2023-12-17)
97
-
98
- - (o0shojo0o) fixed unnecessary warning for special value ([269](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/269))
99
-
100
- ### 2.13.3 (2023-10-10)
101
-
102
- - (o0shojo0o) fixed devices erroneous offline indication ([#255](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/255))
103
-
104
- ### 2.13.2 (2023-09-30)
105
-
106
- - (o0shojo0o) fixed NULL values when HASS integration is enabled in zigbee2mqtt
107
-
108
- ### 2.13.1 (2023-09-07)
109
-
110
- - (o0shojo0o) fixed storage name
111
-
112
- ### 2.13.0 (2023-09-07)
113
-
114
- - (o0shojo0o) added state `info.coordinator_check` ([#247](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/247))
115
- - (o0shojo0o) added state `info.missing_routers` ([#247](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/247))
116
- - (o0shojo0o) added state `info.missing_routers_count` ([#247](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/247))
117
- - (o0shojo0o) added option `Automatic check for missing routers in the coordinator memory` ([#247](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/247))
118
-
119
- ### 2.12.0 (2023-09-05)
120
-
121
- - (o0shojo0o) added option `Size of the object icons in pixels`
122
-
123
- ### 2.11.0 (2023-08-24)
124
-
125
- - (o0shojo0o) added automatic download of device image from zigbee2mqtt to meta-storage
126
- - (o0shojo0o) device images from Meta-Storage added to the object
127
- - (o0shojo0o) device images from Meta-Storage auto resize to 28x28 pixel for smaller object
128
- - (o0shojo0o) added option `Download device images from Zigbee2Mqtt and use them as object icons.`
129
- - (o0shojo0o) fixed Hue_Move ([#223](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/223))
130
- - (o0shojo0o) added option `Generate simple 'Hold' and 'Release' states`
131
- - (o0shojo0o) added option `Generate simple 'Move' and 'Stop' states`
132
- - (o0shojo0o) added option `Generate simple 'Press' and 'Release' states`
133
-
134
- ### 2.10.1 (2023-08-13)
135
-
136
- - (o0shojo0o) fixed type definitions (thx @arteck)
137
-
138
- ### 2.10.0 (2023-08-12)
139
-
140
- - (o0shojo0o) optimisation for the MQTT connection
141
- - (o0shojo0o) fixed for MQTT output type: attribute_and_json ([#87](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/87))
142
- - (o0shojo0o) added support for external MQTT-Server credentials ([#148](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/148))
143
- - *After update, Websocket Auth-Token must be set again, if used.*
144
-
145
- ### 2.9.0 (2023-07-21)
146
-
147
- - (o0shojo0o) added state `send_payload` to send a raw json payload
148
-
149
- ### 2.8.0 (2023-07-19)
150
-
151
- - (o0shojo0o) added WSS support for websoket connection ([#191](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/191))
152
- - (o0shojo0o) small fixes
153
-
154
- ### 2.7.5 (2023-04-08)
155
-
156
- - (o0shojo0o) added state `last_seen` contains date/time of last Zigbee message ([#131](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/131))
157
-
158
- ### 2.7.4 (2023-03-05)
159
-
160
- - (o0shojo0o) fixed for Aqara presence detector FP1 `reset_nopresence_status`
161
-
162
- ### 2.7.3 (2023-02-18)
163
-
164
- - (o0shojo0o) hotfix for Aqara presence detector FP1
165
-
166
- ### 2.7.2 (2023-02-01)
167
-
168
- - (o0shojo0o) rework of the detection of removed devices
169
-
170
- ### 2.7.1 (2023-01-24)
171
-
172
- - (arteck) added option for use folder description
173
- - (arteck) use the iobroker device folder description for device description or events
174
-
175
- ### 2.7.0 (2023-01-18)
176
-
177
- - (o0shojo0o) added support for wildcard actions (eg. *_single) ([#116](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/116))
178
- - (o0shojo0o) added error handling optimizations ([more](https://github.com/ioBroker/ioBroker.repositories/pull/1976#issuecomment-1382038679))
179
- - (o0shojo0o) added option `auth_token` for websocket connection ([#112](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/112))
180
- - (o0shojo0o) websocket timeout increased
181
-
182
- ### 2.6.0 (2023-01-10)
183
-
184
- - (o0shojo0o) added state `transition` for transition overwrite (-1 disabled overwrite) ([#101](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/101))
185
- - (o0shojo0o) consideration of the description when creating the friendly name ([#105](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/105))
186
- - (o0shojo0o) added state `effect` for groups ([#101](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/101))
187
- - (o0shojo0o) fixed state contact
188
- - (o0shojo0o) added handling for disabled devices
189
-
190
- ### 2.5.0 (2023-01-02)
191
-
192
- - (o0shojo0o) added option `Brightness step should also turn the light on or off`
193
- - (o0shojo0o) added handling of `brightness_step` ([#96](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/96))
194
- - (o0shojo0o) states processing more flexible designed ([#94](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/94))
195
-
196
- ### 2.4.5 (2022-12-20)
197
-
198
- - (o0shojo0o) extend `text` for `action` ([#84](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/84))
199
-
200
- ### 2.4.4 (2022-12-06)
201
-
202
- - (o0shojo0o) better state identification ([#79](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/79))
203
-
204
- ### 2.4.3 (2022-11-23)
205
-
206
- - (o0shojo0o) fixed availability when `friendly_name` `/` contains
207
-
208
- ### 2.4.2 (2022-11-20)
209
-
210
- - (o0shojo0o) added correct handling of `move_to_saturation`, `hue_move` and `brightness_move_to_level` ([#68](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/68))
211
- - (o0shojo0o) fixed when `friendly_name` `/` contains
212
-
213
- ### 2.4.1 (2022-11-16)
214
-
215
- - (o0shojo0o) fixed based on [review](https://github.com/ioBroker/ioBroker.repositories/pull/1976#issuecomment-1316656378)
216
-
217
- ### 2.4.0 (2022-11-08)
218
-
219
- - (o0shojo0o) fixed for devices with multiple endpoints ([#57](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/57)).
220
- - (o0shojo0o) added option `Brightness move should also turn the light on or off`
221
- - (o0shojo0o) added state toggle for groups
222
- - (o0shojo0o) more dynamic during data point creation ([#48](https://github.com/arteck/ioBroker.zigbee2mqtt/issues/48)).
223
-
224
- ### 2.3.0 (2022-10-30)
225
-
226
- - (o0shojo0o) added support for the `toggle` of states that support this.
227
- - (o0shojo0o) added correct handling of `color_move` and `color_temperature_move`
228
-
229
- ### 2.2.1 (2022-10-25)
230
-
231
- - (o0shojo0o) fixed state roles and access
232
- - (o0shojo0o) fixed state handling
233
- - (o0shojo0o) fixed createZ2MMessage
234
-
235
- ### 2.2.0 (2022-10-20)
236
-
237
- - (o0shojo0o) added support for [Lidl HG06467 effects](https://www.zigbee2mqtt.io/devices/HG06467.html#trigger-effects)
238
- - (o0shojo0o) added support for hs color
239
- - (o0shojo0o) `simulated_brightness` data point is added only for supported devices
240
-
241
- ### 2.1.1 (2022-10-16)
242
-
243
- - (o0shojo0o) advanced detection if a device has been removed
244
- - (o0shojo0o) fixes the design error in the websocket connection
245
-
246
- ### 2.1.0 (2022-10-14)
247
-
248
- - (o0shojo0o) added option for color temperature sync with color
249
- - (o0shojo0o) fixed logfilter and debugDevices
250
- - (o0shojo0o) lots of bugfixes
251
- - (o0shojo0o) now set the correct min/max at color temp
252
- - (o0shojo0o) better error handling for the connections
253
-
254
- ### 2.0.0 (2022-10-12)
255
-
256
- **!!!BREAKING CHANGE!!!**
257
-
258
- - (o0shojo0o) added configurable connection to Zigbee2MQTT (Settings must be renewed)
259
- - Websocket
260
- - External MQTT-Server
261
- - Internal MQTT-Server
262
- - (o0shojo0o) optimized state writing performance in ioBroker
263
- - (o0shojo0o) fixed the correct set of the connection status
264
-
265
- ### 1.0.0 (2022-10-09)
266
-
267
- **!!!BREAKING CHANGE!!!**
268
-
269
- - (o0shojo0o) added options for external MQTT-Server
270
- - (o0shojo0o) connection to zigbee2mqtt completely reworked and changed to MQTT
271
- - (o0shojo0o) lots of bugfixes
272
- - (o0shojo0o) automatically set button actions back to false
273
- - (o0shojo0o) added support for Zigbee2MQTT feature simulated_brightness
274
- - (o0shojo0o) added config check
275
- - (o0shojo0o) added log output about coordinator details
276
-
277
- ### 0.2.0 (2022-10-04)
278
-
279
- - (o0shojo0o) group states corrected
280
- - (o0shojo0o) added option 'Use Kelvin instead of mired for the color temps'
281
- - (o0shojo0o) remove available logic, now will use the information from z2m
282
- - (o0shojo0o) rename noLogDevices to logfilter
283
- - (o0shojo0o) lots of bugfixes
284
- - (o0shojo0o) added noLogDevices functionality
285
- - (o0shojo0o) added debugmessage for specific device functionality
286
- - (o0shojo0o) added some states are default false
287
- - (o0shojo0o) added support for scenes defined on a device
288
- - (o0shojo0o) fixed available state role
289
- - (o0shojo0o) fixed edsubscribeWritableStates
56
+ .
57
+ .
58
+ .
290
59
 
291
60
  ### 0.1.0 (2022-09-29)
292
61
 
@@ -296,7 +65,7 @@ This adapter allows to control the data points of the devices of a Zigbee2MQTT i
296
65
 
297
66
  MIT License
298
67
 
299
- Copyright (c) 2025 Arthur Rupp <arteck@outlook.com>,
68
+ Copyright (c) 2025-2026 Arthur Rupp <arteck@outlook.com>,
300
69
 
301
70
  Permission is hereby granted, free of charge, to any person obtaining a copy
302
71
  of this software and associated documentation files (the "Software"), to deal
package/io-package.json CHANGED
@@ -1,8 +1,47 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "zigbee2mqtt",
4
- "version": "3.0.10",
4
+ "version": "3.0.13",
5
5
  "news": {
6
+ "3.0.13": {
7
+ "en": "add action dp",
8
+ "de": "aktion dp hinzufügen",
9
+ "ru": "добавить действие dp",
10
+ "pt": "adicionar ação dp",
11
+ "nl": "actie dp toevoegen",
12
+ "fr": "ajouter action dp",
13
+ "it": "aggiungere azione",
14
+ "es": "añadir acción dp",
15
+ "pl": "dodaj działanie dp",
16
+ "uk": "додати дію dp",
17
+ "zh-cn": "添加动作 dp"
18
+ },
19
+ "3.0.12": {
20
+ "en": "Dependencies have been updated\ntypo fix",
21
+ "de": "Abhängigkeiten wurden aktualisiert\ntypo fix",
22
+ "ru": "Зависимости были обновлены\nисправление опечаток",
23
+ "pt": "As dependências foram atualizadas\nerro de digitação",
24
+ "nl": "Afhankelijkheden zijn bijgewerkt\ntypo-fix",
25
+ "fr": "Les dépendances ont été actualisées\ncorrection du type",
26
+ "it": "Le dipendenze sono state aggiornate\ncorrezione di errore",
27
+ "es": "Se han actualizado las dependencias\ntypo fix",
28
+ "pl": "Zaktualizowano zależności\nfix typo",
29
+ "uk": "Залежність було оновлено\nтипофікс",
30
+ "zh-cn": "依赖关系已更新\n类型修复"
31
+ },
32
+ "3.0.11": {
33
+ "en": "fix info.connection",
34
+ "de": "fix info.connection",
35
+ "ru": "обсуждение fix info.connection",
36
+ "pt": "corrigir info.connection",
37
+ "nl": "fix info.connection",
38
+ "fr": "corriger info.connection",
39
+ "it": "fix info.connection",
40
+ "es": "arreglar info.conexión",
41
+ "pl": "fix info.connection",
42
+ "uk": "фіксувати інформацію.connection",
43
+ "zh-cn": "修复信息.连接"
44
+ },
6
45
  "3.0.10": {
7
46
  "en": "Dependencies have been updated\nChanged role of `color_temp_startup` state to `level` to avoid double `level.temperature` in one device\nfix ZBMINIR2 inching DP\ndelete DP colortempstartup",
8
47
  "de": "Abhängigkeiten wurden aktualisiert\nÄnderung der Rolle von `color_temp_startup` Zustand auf `level`, um Doppel `level.temperature` in einem Gerät zu vermeiden\nzBMINIR2 Inch DP reparieren\nlöschen DP colortempstartup",
@@ -54,45 +93,6 @@
54
93
  "pl": "fix jsconconf",
55
94
  "uk": "закріпити jsconconf",
56
95
  "zh-cn": "修复 jsconconconf"
57
- },
58
- "3.0.6": {
59
- "en": "settings restructure\nfix icon not found message",
60
- "de": "einstellungen restrukturieren\nsymbol nicht gefunden",
61
- "ru": "реструктуризация настроек\nисправить иконку не найдено сообщение",
62
- "pt": "reestruturação de configurações\ncorrigir ícone não encontrado mensagem",
63
- "nl": "instellingen herstructureren\npictogram niet gevonden bericht herstellen",
64
- "fr": "restructuration des paramètres\ncorrection icône non trouvée message",
65
- "it": "installazione\nfix icona non trovato messaggio",
66
- "es": "configuración de reestructuración\nfijar icono no encontrado mensaje",
67
- "pl": "restrukturyzacja ustawień\nnie znaleziono ikony",
68
- "uk": "реструктуризація параметрів\nне знайдено повідомлення",
69
- "zh-cn": "设置调整\n未找到消息的修复图标"
70
- },
71
- "3.0.5": {
72
- "en": "add additional folder for some devices (like smoke detector)\nstate.js cleanup\nset available State to true if device message include last_seen status",
73
- "de": "zusätzliche ordner für einige geräte hinzufügen (wie rauchmelder)\nstate.js cleanup\neingestellt verfügbar Zustand, um wahr zu sein, wenn die Gerätenachricht last_seen status enthält",
74
- "ru": "добавьте дополнительную папку для некоторых устройств (например, детектор дыма)\nочистка state.js\nустановленное состояние истинно, если сообщение устройства включает в себя статус last_seen",
75
- "pt": "adicionar pasta adicional para alguns dispositivos (como detector de fumaça)\nlimpeza state.js\nset available Estado para true se a mensagem do dispositivo incluir status last_seen",
76
- "nl": "extra map toevoegen voor sommige apparaten (zoals rookmelder)\nstate.js opruimen\nbeschikbare status instellen op true als apparaatbericht laatste_geziene status bevat",
77
- "fr": "ajouter un dossier supplémentaire pour certains appareils (comme le détecteur de fumée)\nétat.js nettoyage\ndéfinir l'État disponible à true si le message de périphérique inclut le statut last_seen",
78
- "it": "aggiungere cartella aggiuntiva per alcuni dispositivi (come rilevatore di fumo)\nstato.js pulizia\nse il messaggio del dispositivo include lo stato di last_seen",
79
- "es": "añadir carpeta adicional para algunos dispositivos (como detector de humos)\nestado.js limpieza\nestado disponible para ver si el mensaje del dispositivo incluye el estado de último visto",
80
- "pl": "dodaj dodatkowy folder dla niektórych urządzeń (np. czujnik dymu)\nstan. js cleanup\nustaw dostępny stan na true jeśli wiadomość urządzenia zawiera status last _ seen",
81
- "uk": "додати додаткову папку для деяких пристроїв (наприклад, детектор диму)\nстан.js cleanup\nвстановити доступну державу, якщо повідомлення про пристрій включають статус останнього_seen",
82
- "zh-cn": "为一些设备添加额外的文件夹( 如烟雾探测器)\n状态.js 清理\n如果设备消息包含最后的_ Seenn 状态, 将可用状态设定为 true"
83
- },
84
- "3.0.4": {
85
- "en": "update admin",
86
- "de": "admin",
87
- "ru": "обновление admin",
88
- "pt": "atualização admin",
89
- "nl": "admin bijwerken",
90
- "fr": "mettre à jour l'administrateur",
91
- "it": "aggiornamento",
92
- "es": "actualización admin",
93
- "pl": "aktualizacja admin",
94
- "uk": "оновлення адмін",
95
- "zh-cn": "更新管理员"
96
96
  }
97
97
  },
98
98
  "messages": [
@@ -211,8 +211,7 @@
211
211
  "pl": "Zigbee2MQTT",
212
212
  "zh-cn": "Zigbee2MQTT"
213
213
  },
214
- "link": "%webUIScheme%://%webUIServer%:%webUIPort%",
215
- "fa-icon": "</i><img style='width:24px;margin-bottom:-6px;' src='/adapter/zigbee2mqtt/zigbee2mqtt.png'><i>"
214
+ "link": "%webUIScheme%://%webUIServer%:%webUIPort%"
216
215
  },
217
216
  "localLinks": {
218
217
  "_default": {
package/lib/check.js CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ *
3
+ * @param config
4
+ * @param log
5
+ * @param version
6
+ */
1
7
  function checkConfig(config, log, version) {
2
8
  const checkAPIOptions = {
3
9
  legacy_api_enabled: config.advanced.legacy_api != false,
package/lib/colors.js CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-prototype-builtins */
1
+
2
2
  'use strict';
3
3
 
4
4
  const namedColors = {
@@ -424,19 +424,33 @@ const namedColors = {
424
424
  },
425
425
  };
426
426
 
427
+ /**
428
+ *
429
+ * @param name
430
+ */
427
431
  function NamedColorToRGBstring(name) {
428
432
  const lowerName = name.toLowerCase();
429
- if (namedColors.hasOwnProperty(lowerName)) return namedColors[lowerName].rgb;
433
+ if (namedColors.hasOwnProperty(lowerName)) {
434
+ return namedColors[lowerName].rgb;
435
+ }
430
436
  return '#0088FF';
431
437
  }
432
438
 
439
+ /**
440
+ *
441
+ * @param rgbstring
442
+ */
433
443
  function ParseColor(rgbstring) {
434
444
  if (typeof rgbstring === 'string') {
435
445
  const lowerName = rgbstring.toLowerCase();
436
- if (namedColors.hasOwnProperty(lowerName)) rgbstring = namedColors[lowerName].rgb;
446
+ if (namedColors.hasOwnProperty(lowerName)) {
447
+ rgbstring = namedColors[lowerName].rgb;
448
+ }
437
449
  rgbstring = rgbstring.trim();
438
- if (rgbstring.startsWith('#')) rgbstring = rgbstring.slice(1);
439
- const val = parseInt('0x' + rgbstring);
450
+ if (rgbstring.startsWith('#')) {
451
+ rgbstring = rgbstring.slice(1);
452
+ }
453
+ const val = parseInt(`0x${ rgbstring}`);
440
454
  const oneColor = {};
441
455
  oneColor.r = Math.floor(val / (256 * 256));
442
456
  oneColor.g = Math.floor((val % (256 * 256)) / 256);
@@ -446,8 +460,14 @@ function ParseColor(rgbstring) {
446
460
  return { r: 0, g: 128, b: 255 };
447
461
  }
448
462
 
463
+ /**
464
+ *
465
+ * @param name
466
+ */
449
467
  function NamedColorToRGB(name) {
450
- if (namedColors.hasOwnProperty(name)) return ParseColor(namedColors[name].rgb);
468
+ if (namedColors.hasOwnProperty(name)) {
469
+ return ParseColor(namedColors[name].rgb);
470
+ }
451
471
  return { r: 0, g: 128, b: 255 };
452
472
  }
453
473
  module.exports = {
@@ -5,7 +5,19 @@ const colors = require('./colors.js');
5
5
  const rgb = require('./rgb.js');
6
6
  const ImageController = require('./imageController').ImageController;
7
7
 
8
+ /**
9
+ *
10
+ */
8
11
  class DeviceController {
12
+ /**
13
+ *
14
+ * @param adapter
15
+ * @param deviceCache
16
+ * @param groupCache
17
+ * @param config
18
+ * @param logCustomizations
19
+ * @param createCache
20
+ */
9
21
  constructor(adapter, deviceCache, groupCache, config, logCustomizations, createCache) {
10
22
  this.adapter = adapter;
11
23
  this.groupCache = groupCache;
@@ -16,6 +28,10 @@ class DeviceController {
16
28
  this.imageController = new ImageController(adapter);
17
29
  }
18
30
 
31
+ /**
32
+ *
33
+ * @param devicesMessage
34
+ */
19
35
  async createDeviceDefinitions(devicesMessage) {
20
36
  utils.clearArray(this.deviceCache);
21
37
  for (const devicesMessag of devicesMessage) {
@@ -44,6 +60,12 @@ class DeviceController {
44
60
  }
45
61
  }
46
62
 
63
+ /**
64
+ *
65
+ * @param groupID
66
+ * @param ieee_address
67
+ * @param scenes
68
+ */
47
69
  async defineGroupDevice(groupID, ieee_address, scenes) {
48
70
  const brmPropName =
49
71
  this.adapter.config.brightnessMoveOnOff == true ? 'brightness_move_onoff' : 'brightness_move';
@@ -126,14 +148,14 @@ class DeviceController {
126
148
  if (payload.color && payload.color.x && payload.color.y) {
127
149
  const colorval = rgb.cie_to_rgb(payload.color.x, payload.color.y);
128
150
  return (
129
- '#' +
130
- utils.decimalToHex(colorval[0]) +
131
- utils.decimalToHex(colorval[1]) +
132
- utils.decimalToHex(colorval[2])
151
+ `#${
152
+ utils.decimalToHex(colorval[0])
153
+ }${utils.decimalToHex(colorval[1])
154
+ }${utils.decimalToHex(colorval[2])}`
133
155
  );
134
- } else {
156
+ }
135
157
  return undefined;
136
- }
158
+
137
159
  },
138
160
  },
139
161
  {
@@ -159,9 +181,9 @@ class DeviceController {
159
181
  }
160
182
  if (this.config.useKelvin == true) {
161
183
  return utils.miredKelvinConversion(payload.color_temp);
162
- } else {
184
+ }
163
185
  return payload.color_temp;
164
- }
186
+
165
187
  },
166
188
  },
167
189
  {
@@ -213,7 +235,7 @@ class DeviceController {
213
235
  type: 'boolean',
214
236
  setter: (value) => (value ? scene.id : undefined),
215
237
  };
216
- // @ts-ignore
238
+
217
239
  newDevice.states.push(sceneSate);
218
240
  }
219
241
 
@@ -222,6 +244,10 @@ class DeviceController {
222
244
  this.groupCache.push(newDevice);
223
245
  }
224
246
 
247
+ /**
248
+ *
249
+ * @param groupsMessage
250
+ */
225
251
  async createGroupDefinitions(groupsMessage) {
226
252
  utils.clearArray(this.groupCache);
227
253
  for (const groupMessage of groupsMessage) {
@@ -232,6 +258,9 @@ class DeviceController {
232
258
  }
233
259
  }
234
260
 
261
+ /**
262
+ *
263
+ */
235
264
  async createOrUpdateDevices() {
236
265
  for (const device of this.groupCache.concat(this.deviceCache)) {
237
266
  let deviceName = await this.getDeviceName(device);
@@ -270,17 +299,12 @@ class DeviceController {
270
299
  if (device.ieee_address.includes('group_')) {
271
300
  deviceObj.native.groupDevice = true;
272
301
  deviceObj.common.statusStates.onlineId = `${this.adapter.name}.${this.adapter.instance}.${device.ieee_address}.available`;
273
- }
274
- // Disabled Device
275
- else if (device.disabled || device.disabled == true) {
302
+ } else if (device.disabled || device.disabled == true) { // // Disabled Device
276
303
  // Placeholder for possible later logic
277
- }
278
- // Only the onlineId is set if the device is not disabled
279
- else {
304
+ } else { // Only the onlineId is set if the device is not disabled
280
305
  deviceObj.common.statusStates.onlineId = `${this.adapter.name}.${this.adapter.instance}.${device.ieee_address}.available`;
281
306
  }
282
-
283
- //@ts-ignore
307
+
284
308
  await this.adapter.extendObjectAsync(device.ieee_address, deviceObj);
285
309
  this.createCache[device.ieee_address] = { name: deviceName, description: description };
286
310
  }
@@ -313,6 +337,10 @@ class DeviceController {
313
337
  }
314
338
  }
315
339
 
340
+ /**
341
+ *
342
+ * @param messageObj
343
+ */
316
344
  async renameDeviceInCache(messageObj) {
317
345
  const renamedDevice = this.groupCache
318
346
  .concat(this.deviceCache)
@@ -322,6 +350,9 @@ class DeviceController {
322
350
  }
323
351
  }
324
352
 
353
+ /**
354
+ *
355
+ */
325
356
  async checkAndProgressDeviceRemove() {
326
357
  let description = '';
327
358
  let deviceName = '';
@@ -359,6 +390,11 @@ class DeviceController {
359
390
  }
360
391
  }
361
392
 
393
+ /**
394
+ *
395
+ * @param devices
396
+ * @param ieee_address
397
+ */
362
398
  removeDeviceByIeee(devices, ieee_address) {
363
399
  const idx = devices.findIndex((x) => x.ieee_address == ieee_address);
364
400
  if (idx > -1) {
@@ -366,6 +402,10 @@ class DeviceController {
366
402
  }
367
403
  }
368
404
 
405
+ /**
406
+ *
407
+ * @param state
408
+ */
369
409
  async copyAndCleanStateObj(state) {
370
410
  const iobState = { ...state };
371
411
  const blacklistedKeys = [
@@ -387,14 +427,26 @@ class DeviceController {
387
427
  return iobState;
388
428
  }
389
429
 
430
+ /**
431
+ *
432
+ * @param device
433
+ */
390
434
  getDeviceName(device) {
391
435
  return device.id == device.ieee_address ? '' : device.id;
392
436
  }
393
437
 
438
+ /**
439
+ *
440
+ * @param device
441
+ */
394
442
  getDeviceDescription(device) {
395
443
  return device.description ? device.description : '';
396
444
  }
397
445
 
446
+ /**
447
+ *
448
+ * @param payload
449
+ */
398
450
  processCoordinatorCheck(payload) {
399
451
  if (payload && payload.data && payload.data.missing_routers) {
400
452
  const missingRoutersCount = payload.data.missing_routers.length;