iobroker.zigbee 2.0.0 → 2.0.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/io-package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "zigbee",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "news": {
6
- "2.0.0": {
7
- "en": "new herdsman adaption",
8
- "de": "neue herdsman adaption",
9
- "ru": "адаптация нового пастуха",
10
- "pt": "nova adaptação herdsman",
11
- "nl": "nieuwe aanpassing van herders",
12
- "fr": "nouvelle adaptation des éleveurs",
13
- "it": "nuovo adattamento mandriano",
14
- "es": "nueva adaptación del pastor",
15
- "pl": "nowa adaptacja zioła",
16
- "uk": "новий гердман адаптація",
17
- "zh-cn": "新牧民适应"
6
+ "2.0.1": {
7
+ "en": "BREAKING CHANGES\n\nswitch to converters 21 changes the exposes for a large numbern of devices (mostly remotes)\nnew method for controlling color based on subchannels for rgb, hs and xy\nExposes as default for ALL devices. Use of old definition as option only\nRequires Node 20.x or newer\n\nFix Pairing\nchange ping\ndelay map generation until refresh is activated, map messages after generation\nremove bindings tab from zigbee tab\nreorder tabs in configuration\nremove binding tab from configuration\nremove map from configuration\nadd debug to zigbee tab\nHerdsman 3.2.5, Converters 21.30.0\nExposes as default, use of old device definitions as legacy optional\nUser specific images (model based, device based)\nImproved group editing - remove members from group card",
8
+ "de": "VERÄNDERUNGEN\n\nschalter auf konverter 21 ändert die belichtung für eine große anzahl von geräten (meist fernbedienungen)\nneue methode zur farbsteuerung auf basis von subkanälen für rgb, hs und xy\nExposes als Standard für ALL Geräte. Verwendung der alten Definition nur als Option\nErfordert Node 20.x oder neuer\n\nFeste Paarung\nänderung ping\nverzögerung der kartenerzeugung, bis das update aktiviert ist, kartennachrichten nach generation\nbinden tab aus zickbee tab entfernen\nreorder tabs in konfiguration\nbindelasche aus der konfiguration entfernen\nkarte aus der konfiguration entfernen\ndebug to zigbee tab hinzufügen\nHerdsman 3.2.5, Konverter 21.30.0\nExposes als Standard, Verwendung von alten Gerätedefinitionen als Vermächtnis optional\nBenutzerspezifische Bilder (modellbasierte, gerätebasierte)\nVerbesserte Gruppenbearbeitung - Mitglieder aus Gruppenkarte entfernen",
9
+ "ru": "ПЕРЕМЕНЫ ДЫХАНИЯ\n\nпереход на преобразователи 21 изменяет экспозиции для большого количества устройств (в основном пультов)\nновый метод управления цветом на основе подканалов для rgb, hs и xy\nВыставляется по умолчанию для всех устройств. Использование старого определения только в качестве варианта\nТребуется Node 20.x или новый\n\nФиксация пар\nизменить пинг\nзадержка генерации карт до активации обновления, сообщения карт после генерации\nудалить вкладку связывания из вкладки zigbee\nзакладки переупорядочения в конфигурации\nудалить вкладку связывания из конфигурации\nудалить карту из конфигурации\nдобавить отладку в zigbee tab\nСтадовод 3.2.5, Преобразователи 21.30.0\nОбъявления по умолчанию, использование старых определений устройств в качестве устаревших опций\nПользовательские изображения (на основе модели, устройства)\nУлучшенное редактирование группы - удаление членов с карты группы",
10
+ "pt": "ALTERAÇÕES DE TRABALHO\n\nmudar para conversores 21 altera as exposiçãμes para um grande nãomero de dispositivos (principalmente remotos)\nnovo método para controlar a cor com base em subcanais para rgb, hs e xy\nExpõe como padrão para todos os dispositivos. Uso da definição antiga como opção apenas\nRequer nó 20.x ou mais recente\n\nEmparelhamento fixo\nmudança de ping\ngeração de mapas de atraso até que a atualização seja ativada, mapeie mensagens após a geração\nremover encadernações guia da aba zigbee\nreordenar as abas na configuração\nremover guia de ligação da configuração\nremover mapa da configuração\nadd debug to ziigbee tab\nHerdsman 3.2.5, Conversores 21.30.0\nExpõe como padrão, uso de definições de dispositivos antigos como legado opcional\nImagens específicas do usuário (modelo baseado, dispositivo baseado)\nEdição de grupo melhorada - remover membros do cartão de grupo",
11
+ "nl": "BEREIDINGSVERANDERINGEN\n\nswitch to converters 21 verandert de expos voor een groot aantal apparaten (meestal afstandsbedieningen)\nnieuwe methode voor het controleren van kleur op basis van subkanalen voor rgb, hs en xy\nExposeert als standaard voor ALLE apparaten. Gebruik van oude definitie als optie\nVereist Node 20.x of nieuwer\n\nRepareren\nverandering ping\nde mapgeneratie uitstellen tot het vernieuwen is geactiveerd, berichten na generatie in kaart brengen\ntabblad bindingen verwijderen uit zigbee-tabblad\ntabbladen opnieuw ordenen in configuratie\ntabblad binding verwijderen uit configuratie\nkaart uit configuratie verwijderen\ndebug toevoegen aan zigbee-tabblad\nHerdsman 3.2.5, Converters 21.30.0\nExposeert als standaard, gebruik van oude apparaatdefinities als optioneel legacy\nGebruikersspecifieke afbeeldingen (op basis van model, apparaat)\nVerbeterde groepsbewerking - leden verwijderen van groepskaart",
12
+ "fr": "CHANGEMENTS\n\nbasculer vers les convertisseurs 21 modifie les expositions pour un grand nombre de dispositifs (principalement des télécommandes)\nnouvelle méthode pour contrôler la couleur basée sur les sous-canaux pour rgb, hs et xy\nExposes par défaut pour TOUS les appareils. Utilisation de l'ancienne définition comme option seulement\nNécessite le Node 20.x ou plus récents\n\nCorrection de l'appariement\nchangement ping\nretarder la génération de la carte jusqu'à ce que le rafraîchissement soit activé, map messages after generation\nsupprimer l'onglet reliures de l'onglet zigbee\nréorganiser les onglets dans la configuration\nsupprimer l'onglet de liaison de la configuration\nsupprimer la carte de la configuration\najouter debug à l'onglet zigbee\nHerdsman 3.2.5, Convertisseurs 21.30.0\nExposes comme par défaut, utilisation des anciennes définitions d'appareils comme legs optionnel\nImages spécifiques à l'utilisateur (sur modèle, sur périphérique)\nAmélioration de l'édition de groupe - supprimer les membres de la carte de groupe",
13
+ "it": "VARIAZIONI\n\ncommutazione a convertitori 21 cambia l'esposizione per un gran numero di dispositivi (per lo più remoti)\nnuovo metodo per il controllo del colore basato su sottocanali per rgb, hs e xy\nMostra come predefinito per tutti i dispositivi. Uso della vecchia definizione come opzione solo\nRichiede Node 20.x o nuovo\n\nFissare l'accoppiamento\ncambiamento ping\nritardare la generazione della mappa fino all'attivazione del aggiornamento, mappare i messaggi dopo generazione\nrimuovere la scheda binding dalla scheda zigbee\nriordinare le schede nella configurazione\nrimuovere la scheda di binding dalla configurazione\nrimuovere la mappa dalla configurazione\naggiungere debug a zigbee scheda\nHerdsman 3.2.5, Convertitori 21.30.0\nEsposizioni come predefinito, uso di vecchie definizioni del dispositivo come legacy opzionale\nImmagini specifiche dell'utente (modello basato, dispositivo basato)\nModifica del gruppo migliorato - rimuovere i membri dalla scheda di gruppo",
14
+ "es": "BREAKING CHANGS\n\ninterruptor a convertidores 21 cambios de los expuestos para un gran número de dispositivos (en su mayoría remotos)\nnuevo método para controlar el color basado en subcanales para rgb, hs y xy\nExposes como predeterminado para TODOS los dispositivos. Uso de la vieja definición como opción solamente\nRequiere Nodo 20.x o más nuevos\n\nPareja fija\ncambio de ping\nretraso de la generación del mapa hasta que se activa el refresco, mapa mensajes después de la generación\neliminar la ficha de unión de la pestaña zigbee\npestañas reordenadas en configuración\neliminar la pestaña de unión de configuración\neliminar mapa de la configuración\nañadir debug a la pestaña zigbee\nHerdsman 3.2.5, convertidores 21.30.0\nExposes as default, use of old device definitions as legacy Optional\nImágenes específicas del usuario (con base de modelo, basadas en dispositivos)\nMejor edición de grupo - eliminar miembros de la tarjeta de grupo",
15
+ "pl": "ZMIANY ZBIORCZE\n\nprzełączanie na konwertery 21 zmienia eksponaty dużej liczby urządzeń (głównie pilotów)\nnowa metoda kontrolowania koloru na podstawie podkanałów dla rgb, hs i xy\nWyświetla jako domyślne dla urządzeń ALL. Używanie starej definicji jako opcji\nWymaga węzła 20.x lub nowsze\n\nNapraw parowanie\nzmienić ping\nopóźnianie generowania mapy aż do uruchomienia odświeżania, wiadomości mapy po generacji\nusunąć zakładkę wiązania z zakładki zigbee\nponownie zamówić karty w konfiguracji\nusunąć zakładkę wiązania z konfiguracji\nusuń mapę z konfiguracji\ndodaj debug do karty zigbee\nHerdsman 3.2.5, Konwertery 21.30.0\nWyświetla jako domyślne, użycie starych definicji urządzenia jako dotychczasowe opcjonalne\nObrazy specyficzne dla użytkownika (oparte na modelu, na urządzeniu)\nUlepszona edycja grupowa - usunąć członków z karty grupowej",
16
+ "uk": "БРЕАКІНГОВІ ЗМІНИ\n\nперемикач на перетворювачі 21 змінює висадки для великої кількості пристроїв (найбільш віддалені)\nновий метод контролю кольору на основі підканалів для rgb, hs і xy\nЗа замовчуванням для всіх пристроїв. Використання старого визначення як варіант\nВимагає Node 20.x або нові\n\nФіксація Пірсинг\nзмінити пінг\nгенерація карти затримки до освіження активується, повідомлення після генерації\nвидалити вкладку в'язання з вкладки zigbee\nвкладка зворотного замовлення в конфігурації\nвидалити вкладку з конфігурації\nвидалити карту з конфігурації\nadd debug до zigbee tab\nEnglish, Українська, Français..\nЕкспози як за замовчуванням, використання застарілих параметрів пристрою, як необов'язковий\nКористувальницькі специфічні зображення (моделі на основі пристрою)\nУдосконалено редагування груп - видалення членів з групової картки",
17
+ "zh-cn": "裂变\n\n21 更改大量设备(大多为远程设备)的曝光量\n基于 rgb、 hs 和 xy 子通道的新的颜色控制方法\n曝光为默认所有设备 。 仅将旧定义用作选项\n需要节点 20.x 或更新\n\n修复对齐\n更改键\n将映射生成延迟到刷新启动, 映射消息生成后\n从 zigbee 标签中删除绑定标签\n在配置中重新排序标签\n从配置中删除绑定标签\n从配置中删除地图\n添加调试到 zigbee 标签\n牧民 3.2.5,转换器 21.30.0\n将曝光作为默认, 将旧设备定义作为遗留选项\n用户特定图像( 基于模型、 设备)\n改进组编辑 - 从组卡中删除成员"
18
18
  },
19
- "1.10.15": {
20
- "en": "Work in progress",
21
- "de": "Work in progress",
22
- "ru": "Work in progress",
23
- "pt": "Work in progress",
24
- "nl": "Work in progress",
25
- "fr": "Work in progress",
26
- "it": "Work in progress",
27
- "es": "Work in progress",
28
- "pl": "Work in progress",
29
- "uk": "Work in progress",
30
- "zh-cn": "Work in progress"
19
+ "1.11.2": {
20
+ "en": "debug for states",
21
+ "de": "debug for states",
22
+ "ru": "debug for states",
23
+ "pt": "debug for states",
24
+ "nl": "debug for states",
25
+ "fr": "debug for states",
26
+ "it": "debug for states",
27
+ "es": "debug for states",
28
+ "pl": "debug for states",
29
+ "uk": "debug for states",
30
+ "zh-cn": "debug for states"
31
31
  },
32
32
  "1.10.14": {
33
33
  "en": "Herdsman 2.1.9, Converters 20.58.0\nFix: Aqara T1M (CL-L02D) \ndeleteDeviceStates change to deleteObj",
@@ -187,8 +187,8 @@
187
187
  "condition": {
188
188
  "operand": "and",
189
189
  "rules": [
190
- "oldVersion<=1.10.3",
191
- "newVersion>=1.10.10"
190
+ "oldVersion<=1.10.14",
191
+ "newVersion>=2.0.0"
192
192
  ]
193
193
  },
194
194
  "title": {
@@ -204,17 +204,17 @@
204
204
  "zh-cn": "重要通知!"
205
205
  },
206
206
  "text": {
207
- "en": "\"BREAKING CHANGE. after update to this Version you can't go back to Version <= 1.10.3. Only option is your Backup",
208
- "de": "\"BREAKING CHANGE. nach dem Update könnt ihr nicht zurück zu einer Version <= 1.10.3. Es geht nur per ioBroker Backup was hoffentlich gemacht habt",
209
- "ru": "\"Изменяюсь. После обновления этой версии вы не можете вернуться к версии <= 1.10.3. Единственный вариант - это ваша резервная копия",
210
- "pt": "\"BREAKING CHANGE. após a atualização para esta versão você não pode voltar para Versão <= 1.10.3. A única opção é o seu Backup",
211
- "nl": "\"Verandering. Na update naar deze versie kun je niet meer terug naar versie <= 1.10.3. De enige optie is uw back-up",
212
- "fr": "\"C'est le changement. après la mise à jour de cette version, vous ne pouvez pas retourner à la version <= 1.10.3. Seule option est votre sauvegarde",
213
- "it": "\"Cambiare il cambiamento. dopo l'aggiornamento a questa versione non si può tornare alla versione <= 1.10.3. Solo l'opzione è il backup",
214
- "es": "\"Cambiando. después de la actualización a esta versión no puede volver a la versión 0 = 1.10.3. La única opción es tu Backup",
215
- "pl": "\"ZMIENIONA ZMIANA. po aktualizacji do tej wersji nie można wrócić do wersji < = 1.10.3. Jedyną opcją jest kopia zapasowa",
216
- "uk": "\"Бреагування ЗМІНИ. після оновлення цієї версії ви не можете повернутися до версії <= 1.10.3. Тільки варіант - Ваш Резервне копіювання",
217
- "zh-cn": "\"呼吸变化。 更新到此版本后, 您不能返回到 QQ 1. 10. 3. 版本 唯一的选项是您的备份"
207
+ "en": "\"BREAKING CHANGE. <br> switch to converters 21 changes the exposes for a large numbern of devices (mostly remotes) <br> new method for controlling color based on subchannels for rgb, hs and xy <br> Exposes as default for ALL devices. Use of old definition as option only",
208
+ "de": "\"BREAKING CHANGE. <br> Umstellung auf Konverter 21 ändert die Einstellungen für eine große Anzahl von Geräten (vor allem Fernbedienungen) <br> neue Methode zur Steuerung der Farbe basierend auf rgb, hs und xy <br> Exposes als Standard für ALLE Geräte. die alte Definition ist jetzt nur optional",
209
+ "ru": "\"BREAKING CHANGE. <br> Переход на конвертеры 21 изменяет экспозиции для большого количества устройств основном пультов) <br> Новый метод управления цветом, основанный на подканалах для rgb, hs и xy <br> Экспонирует по умолчанию для ВСЕХ устройств. Использование старого определения только в качестве опции",
210
+ "pt": "\"BREAKING CHANGE. <br> mudança para conversores 21 altera a exposição de um grande número de dispositivos (principalmente controles remotos) <br> novo método para controlar cores baseado em subcanais para rgb, hs e xy <br> expõe como padrão para TODOS os dispositivos. Utilização da definição antiga apenas como opção",
211
+ "nl": "\"BREAKING CHANGE. <br> overschakelen naar converters 21 verandert de instellingen voor een groot aantal apparaten (vooral afstandsbedieningen) <br> nieuwe methode voor het regelen van kleur op basis van subkanalen voor rgb, hs en xy <br> Standaardinstellingen voor ALLE apparaten. Gebruik van oude definitie alleen als optie",
212
+ "fr": "\"BREAKING CHANGE. <br> le passage aux convertisseurs 21 modifie l'exposition pour un grand nombre d'appareils (principalement les télécommandes) <br>nouvelle méthode pour contrôler la couleur basée sur les sous-canaux pour rgb, hs et xy <br>Expose par défaut pour TOUS les appareils. Utilisation de l'ancienne définition comme option seulement",
213
+ "it": "\"BREAKING CHANGE. <br> il passaggio ai convertitori 21 modifica le esposizioni per un gran numero di dispositivi (soprattutto telecomandi) <br> nuovo metodo per il controllo del colore basato su sottocanali per rgb, hs e xy <br> Espone come predefinito per TUTTI i dispositivi. Uso della vecchia definizione solo come opzione",
214
+ "es": "\"BREAKING CHANGE. <br> cambiar a convertidores 21 cambia las exposiciones para un gran númeron de dispositivos (principalmente mandos a distancia) <br> nuevo método para controlar el color basado en subcanales para rgb, hs y xy <br> Expone por defecto para TODOS los dispositivos. Uso de la antigua definición sólo como opción",
215
+ "pl": "\"BREAKING CHANGE. <br> przejście na konwertery 21 zmienia ekspozycje dla dużej liczby urządzeń (głównie pilotów) <br> nowa metoda sterowania kolorem w oparciu o podkanały dla rgb, hs i xy <br> Ekspozycje domyślnie dla WSZYSTKICH urządzeń. Użycie starej definicji tylko jako opcji",
216
+ "uk": "\"BREAKING CHANGE. <br> перехід на конвертери 21 змінює експозиції для великої кількості пристроїв (переважно пультів) <br> новий метод керування кольором на основі підканалів для rgb, hs та xy <br> Експозиції за замовчуванням для ВСІХ пристроїв. Використання старого визначення лише як опція",
217
+ "zh-cn": "\"BREAKING CHANGE. <br> 切换到转换器 21 会改变大量设备(主要是遥控器)的显示<br>基于 rgb、hs xy 子通道控制颜色的新方法<br>对所有设备显示为默认设置。仅使用旧定义作为选项"
218
218
  },
219
219
  "link": "https://github.com/ioBroker/ioBroker.zigbee/blob/master/README.md",
220
220
  "level": "warn",
@@ -235,7 +235,8 @@
235
235
  "cancel"
236
236
  ]
237
237
  }
238
- ]
238
+ ],
239
+ "installedFrom": "asgothian/ioBroker.zigbee#1.11"
239
240
  },
240
241
  "native": {
241
242
  "port": "",
package/lib/binding.js CHANGED
@@ -238,7 +238,7 @@ class Binding {
238
238
  await this.doBindUnbind(type, bind_source, bind_source_ep, 'coordinator', '1');
239
239
  this.debug('Successfully ' + (type === 'bind' ? 'bound' : 'unbound') + ' Coordinator from ' + bind_source);
240
240
  } catch (e) {
241
- this.error(`Could not ${type} Coordinator from ${bind_source}: ${(e && e.message ? e.message : 'no error message')} ${(e && e.stack ? e.stack : 'no call stack')}`);
241
+ this.error(`Could not ${type} Coordinator from ${bind_source}: ${JSON.stringify(e)}`);
242
242
  }
243
243
  }
244
244
  } catch (error) {
package/lib/colors.js CHANGED
@@ -441,6 +441,7 @@ function parseColor(rgbstring) {
441
441
  if (rgbstring.startsWith('#')) {
442
442
  rgbstring = rgbstring.slice(1);
443
443
  }
444
+ if (rgbstring.length != 6) return {r: 0, g: 128, b: 255}
444
445
  const val = parseInt(`0x${rgbstring}`);
445
446
  const oneColor = {};
446
447
  oneColor.r = Math.floor(val / (256 * 256));
@@ -460,6 +461,12 @@ function namedColorToRGB(name) {
460
461
  return {r: 0, g: 128, b: 255};
461
462
  }
462
463
 
464
+ function getColorNames()
465
+ {
466
+ return Object.keys(namedColors);
467
+ }
468
+
463
469
  exports.NamedColorToRGB = namedColorToRGB;
464
470
  exports.NamedCOlorToRGBString = namedColorToRGBstring;
465
471
  exports.ParseColor = parseColor;
472
+ exports.getColorNames = getColorNames;
package/lib/commands.js CHANGED
@@ -4,6 +4,10 @@ const getZbId = require('./utils').getZbId;
4
4
  const fs = require('fs');
5
5
  const pathLib = require('path');
6
6
  const statesMapping = require('./devices');
7
+ const utils = require('@iobroker/adapter-core'); // Get common adapter utils
8
+ const colors = require('./colors.js');
9
+ const { exec } = require('child_process');
10
+
7
11
  const disallowedDashStates = [
8
12
  'link_quality', 'available', 'battery', 'groups', 'device_query',
9
13
  'hue_move', 'color_temp_move', 'satuation_move', 'brightness_move', 'brightness_step', 'hue_calibration',
@@ -114,6 +118,42 @@ class Commands {
114
118
  this.setDeviceActivated(obj.from, obj.command, obj.message, obj.callback);
115
119
  }
116
120
  break;
121
+ case 'setDeviceDebug':
122
+ if (obj.message && typeof obj.message === 'object') {
123
+ this.toggleDeviceDebug(obj.from, obj.command, obj.message, obj.callback);
124
+ }
125
+ break;
126
+ case 'getDebugDevices':
127
+ if (obj.message && typeof obj.message === 'object') {
128
+ this.getDebugDevices(obj.from, obj.command, obj.message, obj.callback);
129
+ }
130
+ break;
131
+ case 'getNamedColors':
132
+ if (obj.message && typeof obj.message === 'object') {
133
+ const val = colors.getColorNames();
134
+ this.adapter.sendTo(obj.from, obj.command, {colors: val}, obj.callback);
135
+ }
136
+ break;
137
+
138
+ case 'getLocalImages':
139
+ if (obj.message && typeof obj.message === 'object') {
140
+ this.getLocalImages(obj.from, obj.command, obj.message, obj.callback);
141
+ }
142
+ break;
143
+ case 'updateDeviceImage':
144
+ if (obj.message && typeof obj.message === 'object') {
145
+ this.updateDeviceImage(obj.from, obj.command, obj.message, obj.callback);
146
+ }
147
+ break;
148
+ case 'updateDeviceData':
149
+ if (obj.message && typeof obj.message === 'object') {
150
+ this.updateDeviceData(obj.from, obj.command, obj.message, obj.callback);
151
+ }
152
+ break;
153
+ case 'getDeviceCleanupRequired':
154
+ if (obj) {
155
+ this.adapter.sendTo(obj.from, obj.command, {clean:this.stController.CleanupRequired(), errors:this.stController.getStashedErrors()}, obj.callback);
156
+ }
117
157
  }
118
158
  }
119
159
  }
@@ -150,8 +190,8 @@ class Commands {
150
190
  return;
151
191
  }
152
192
  }
153
- catch (error) {
154
- this.error(`Pairing with code failed with: ${(error && error.message ? error.message : 'no error message')} ${(error && error.stack ? error.stack : 'no call stack')}`);
193
+ catch (e) {
194
+ this.error(JSON.stringify(e));
155
195
  this.adapter.sendTo(
156
196
  from, command,
157
197
  {error: 'Exception when trying to add QR code'},
@@ -163,7 +203,7 @@ class Commands {
163
203
  }
164
204
  }
165
205
  // allow devices to join the network within 60 secs
166
- this.adapter.logToPairing('Pairing started ' + devId, true);
206
+ // this.adapter.logToPairing('Pairing started ' + devId, true);
167
207
 
168
208
  let cTimer = Number(this.adapter.config.countDown);
169
209
  if (!this.adapter.config.countDown || !cTimer) {
@@ -209,6 +249,7 @@ class Commands {
209
249
 
210
250
  async getDevices(from, command, id, callback) {
211
251
  if (this.zbController) {
252
+ this.debug(`getDevices called from ${from} with command ${JSON.stringify(command)} and id ${JSON.stringify(id)}`);
212
253
  const pairedDevices = await this.zbController.getClients(true);
213
254
  const groups = {};
214
255
  let rooms;
@@ -226,11 +267,6 @@ class Commands {
226
267
  // get device states and groups
227
268
  result.forEach(async devInfo => {
228
269
  if (devInfo._id) {
229
- // groups
230
- // const grState = alls[`${devInfo._id}.groups`];
231
- // if (grState && grState.val) {
232
- // groups[devInfo._id] = JSON.parse(grState.val);
233
- // }
234
270
  // battery and link_quality
235
271
  const lqState = alls[`${devInfo._id}.link_quality`];
236
272
  devInfo.link_quality = lqState ? lqState.val : undefined;
@@ -243,9 +279,10 @@ class Commands {
243
279
 
244
280
  // put only allowed states
245
281
  devInfo.statesDef = (states || []).filter(stateDef => {
246
- const sid = stateDef._id;
247
- const name = sid.split('.').pop();
248
- return !disallowedDashStates.includes(name);
282
+ const sid = stateDef._id.replace(this.adapter.namespace + '.', '');
283
+ const names = sid.split('.');
284
+ if (stateDef.common.color || names.length > 2) return false;
285
+ return !disallowedDashStates.includes(names.pop());
249
286
 
250
287
  }).map(stateDef => {
251
288
  const name = stateDef.common.name;
@@ -309,6 +346,8 @@ class Commands {
309
346
  const modelDesc = statesMapping.findModel(devInfo.common.type);
310
347
  devInfo.icon = (modelDesc && modelDesc.icon) ? modelDesc.icon : 'img/unknown.png';
311
348
  devInfo.vendor = modelDesc ? modelDesc.vendor : '';
349
+ const legacyDesc = statesMapping.findModel(devInfo.common.type, true);
350
+ devInfo.legacyIcon = (legacyDesc && legacyDesc.icon) ? legacyDesc.icon : undefined;
312
351
  }
313
352
 
314
353
  const id = getZbId(devInfo._id);
@@ -328,7 +367,6 @@ class Commands {
328
367
  }
329
368
  }
330
369
  devInfo.paired = !!devInfo.info;
331
- // devInfo.groups = groups[devInfo._id];
332
370
  devices.push(devInfo);
333
371
  }
334
372
  return devices;
@@ -336,11 +374,9 @@ class Commands {
336
374
  .then(async (devices) => {
337
375
  // fill group info
338
376
  for (const groupdev in groups) {
339
- //this.debug(`GetDevices scanning group ${groupdev} ${JSON.stringify(groups[groupdev])}`);
340
377
  const device = devices.find(dev => (groupdev === getZbId(dev._id)));
341
378
  if (device) {
342
379
  device.groups = groups[groupdev];
343
- //this.debug(`adding group info to device ${groupdev}`);
344
380
  }
345
381
  }
346
382
  // append devices that paired but not created
@@ -495,18 +531,20 @@ class Commands {
495
531
  async cleanDeviceStates(from, command, msg, callback) {
496
532
  this.info(`State cleanup with ${JSON.stringify(msg)}`);
497
533
  const devicesFromDB = await this.zbController.getClients(false);
534
+ const messages = [];
535
+ this.stController.CleanupRequired(false);
498
536
 
499
537
  for (const device of devicesFromDB) {
500
538
  const entity = await this.zbController.resolveEntity(device);
501
539
 
502
540
  if (entity) {
503
541
  const model = (entity.mapped) ? entity.mapped.model : entity.device.modelID;
504
- await this.stController.deleteOrphanedDeviceStates(device.ieeeAddr, model, msg.force);
542
+ this.stController.deleteOrphanedDeviceStates(device.ieeeAddr, model, msg.force, (msg)=> { messages.push(msg)});
505
543
  }
506
544
  }
507
545
  // rebuild retainDeviceNamesDB
508
- this.stController.rebuildRetainDeviceNames();
509
- this.adapter.sendTo(from, command, {}, callback);
546
+ //this.stController.rebuildRetainDeviceNames();
547
+ this.adapter.sendTo(from, command, {stateList: messages}, callback);
510
548
  }
511
549
 
512
550
  async getChannels(from, command, message, callback) {
@@ -532,6 +570,78 @@ class Commands {
532
570
  }
533
571
  }
534
572
 
573
+ async toggleDeviceDebug(from, command, msg, callback) {
574
+ if (this.stController) {
575
+ const id = msg.id;
576
+ const result = await this.stController.toggleDeviceDebug(id);
577
+ this.adapter.sendTo(from, command, {debugDevices:result}, callback)
578
+ }
579
+ }
580
+
581
+ async getDebugDevices(from, command, msg, callback) {
582
+ if (this.stController) {
583
+ this.stController.getDebugDevices((debugDevices) => this.adapter.sendTo(from, command, {debugDevices:debugDevices}, callback));
584
+ }
585
+ }
586
+
587
+
588
+ async getLocalImages(from, command, msg, callback) {
589
+ if (this.stController) {
590
+ const id = msg.id;
591
+ const result = await this.stController.localConfig.enumerateImages(utils.getAbsoluteInstanceDataDir(this.adapter).replace('.','_'));
592
+ this.adapter.sendTo(from, command, {imageData:result}, callback)
593
+ }
594
+ }
595
+
596
+ async updateDeviceImage(from, command, msg, callback) {
597
+ if (this.stController) {
598
+ this.debug(`UpdateDeviceImage : ${JSON.stringify(msg)}`)
599
+ const target = msg.global ? msg.target : msg.target.replace(`${this.adapter.namespace}.`, '')
600
+ const result = await this.stController.localConfig.updateLocalOverride(target, 'icon', msg.image, msg.global);
601
+ if (msg.name) {
602
+ this.stController.localConfig.updateLocalOverride(target, 'name', msg.name, msg.global);
603
+ }
604
+ if (!msg.global) {
605
+ const entity = await this.zbController.resolveEntity(`0x${target}`);
606
+ if (entity) {
607
+ this.stController.updateDev(target, entity.mapped.model, entity.mapped.model, () => {this.adapter.sendTo(from, command, {imageData:result}, callback)});
608
+ }
609
+ else {
610
+ this.stController.updateDev(target, undefined, 'group',() => {this.adapter.sendTo(from, command, {imageData:result}, callback)});
611
+ }
612
+ }
613
+ else {
614
+ //this.error(JSON.stringify(result));
615
+ this.adapter.sendTo(from, command, {imageData:result}, callback);
616
+ }
617
+ }
618
+ }
619
+
620
+ async updateDeviceData(from, command, msg, callback) {
621
+ if (this.stController) {
622
+ this.debug(`UpdateDeviceData : ${JSON.stringify(msg)}`)
623
+ const target = msg.target.replace(`${this.adapter.namespace}.`, '');
624
+ const entity = await this.zbController.resolveEntity(target);
625
+ //this.warn('entity for ' + target + ' is '+ JSON.stringify(entity))
626
+ if (msg.data)
627
+ {
628
+ for (const prop in msg.data) {
629
+ this.debug('enumerating data: ' + prop);
630
+ await this.stController.localConfig.updateLocalOverride(target, (entity ? entity.mapped.model : 'group'), prop, msg.data[prop], msg.global);
631
+ }
632
+ }
633
+ if (entity) {
634
+ //this.warn('with Entity');
635
+ this.stController.updateDev(target, entity.mapped.model, entity.mapped.model, () => {this.adapter.sendTo(from, command, {}, callback)});
636
+ }
637
+ else {
638
+ //this.warn('without Entity');
639
+ this.stController.updateDev(target, undefined, 'group',() => {this.adapter.sendTo(from, command, {}, callback)});
640
+ }
641
+ }
642
+ }
643
+
644
+
535
645
  async reconfigure(from, command, msg, callback) {
536
646
  if (this.zbController) {
537
647
  const devid = getZbId(msg.id);
package/lib/developer.js CHANGED
File without changes
package/lib/devices.js CHANGED
@@ -599,17 +599,7 @@ function states_with_epname(entity, states) {
599
599
  return devstates;
600
600
  }
601
601
 
602
- const devices = [
603
- /* {
604
- models: ['WXKG01LM'],
605
- icon: 'img/xiaomi_wireless_switch.png',
606
- states: [
607
- states.click, states.double_click, states.triple_click, states.quad_click,
608
- states.many_click, states.long_click, states.voltage, states.battery,
609
- states.long_press,
610
- ],
611
- },
612
- */
602
+ const legacy_devices = [
613
603
  {
614
604
  models: ['WXKG11LM'],
615
605
  icon: 'img/aqara_switch.png',
@@ -655,9 +645,9 @@ const devices = [
655
645
  models: ['WXKG02LM', 'WXKG02LM_rev2'],
656
646
  icon: 'img/86sw2.png',
657
647
  states: [
658
- states.left_click, states.right_click, states.both_click,
659
- states.left_click_long, states.left_click_double, states.right_click_long, states.right_click_double,
660
- states.both_click_long, states.both_click_double, states.voltage, states.battery
648
+ states.lumi_left_click, states.lumi_right_click, states.lumi_both_click,
649
+ states.lumi_left_click_long, states.lumi_right_click_long, states.lumi_left_click_double, states.lumi_right_click_double,
650
+ states.lumi_both_click_long, states.lumi_both_click_double, states.voltage, states.battery
661
651
  ],
662
652
  },
663
653
  {
@@ -3061,56 +3051,14 @@ const devices = [
3061
3051
  icon: 'img/ICZB-RM11S.png',
3062
3052
  states: generator.icasa_remote,
3063
3053
  },
3064
-
3065
- /* ------------ images only for admin ------------------- */
3066
- {
3067
- models: ['LED1923R5/LED1925G6'],
3068
- icon: 'img/LED1923R5.png',
3069
- },
3070
- {
3071
- models: ['E1812'],
3072
- icon: 'img/ikea_E1812.png',
3073
- },
3074
- {
3075
- models: ['WHD02'],
3076
- icon: 'img/WHD02.png',
3077
- },
3078
- {
3079
- models: ['R7060'],
3080
- icon: 'img/R7060.png',
3081
- },
3082
- {
3083
- models: ['929001821618'],
3084
- icon: 'img/philips_hue_ambiance.png',
3085
- },
3086
- {
3087
- models: ['14153905L'],
3088
- icon: 'img/14153905L.png',
3089
- },
3090
- {
3091
- models: ['HG06338'],
3092
- icon: 'img/HG06338.png',
3093
- },
3094
- {
3095
- models: ['81855'],
3096
- icon: 'img/81855.png',
3097
- },
3098
- {
3099
- models: ['TI0001-cover'],
3100
- icon: 'img/TI0001-cover.png',
3101
- },
3102
- {
3103
- models: ['E1603/E1702/E1708'],
3104
- icon: 'img/ikea_control_outlet.png',
3105
- },
3106
- {
3107
- models: ['E2204'],
3108
- icon: 'img/E2204.png',
3109
- },
3054
+ ];
3055
+ const devices = [
3110
3056
  {
3111
- models: ['L1(ZW)'],
3112
- icon: 'img/TS0502B.png',
3113
- },
3057
+ models: ['group'],
3058
+ icon: 'img/group_0.png',
3059
+ states: states.groupStates,
3060
+ linkedStates: [comb.brightnessAndState],
3061
+ }
3114
3062
  ];
3115
3063
 
3116
3064
  const commonStates = [
@@ -3121,26 +3069,35 @@ const commonStates = [
3121
3069
  states.send_payload,
3122
3070
  ];
3123
3071
 
3072
+ const DevicesByModel = new Map();
3073
+ const LegacyDevicesByModel = new Map();
3074
+
3124
3075
  const groupStates = [states.brightness_step].concat(lightStatesWithColor);
3125
3076
 
3126
3077
  function getByModel() {
3127
- const byModel = new Map();
3078
+ DevicesByModel.clear();
3128
3079
  for (const device of devices) {
3129
3080
  for (const model of device.models) {
3130
3081
  const stripModel = model.replace(/\0.*$/g, '').trim();
3131
- byModel.set(stripModel, device);
3082
+ DevicesByModel.set(stripModel, device);
3083
+ }
3084
+ }
3085
+ LegacyDevicesByModel.clear();
3086
+ for (const device of legacy_devices) {
3087
+ for (const model of device.models) {
3088
+ const stripModel = model.replace(/\0.*$/g, '').trim();
3089
+ LegacyDevicesByModel.set(stripModel, device);
3132
3090
  }
3133
3091
  }
3134
- return byModel;
3092
+ return DevicesByModel;
3135
3093
  }
3136
3094
 
3137
3095
  removeEmptyStates(devices);
3138
3096
 
3139
- function fillStatesWithExposes(allExcludesObj) {
3140
- const byModel = getByModel();
3141
-
3142
- applyExposes(devices, byModel, allExcludesObj);
3143
-
3097
+ function fillStatesWithExposes() {
3098
+ //const byModel = getByModel();
3099
+ if (DevicesByModel.size <1) getByModel();
3100
+ applyExposes(devices, DevicesByModel);
3144
3101
  removeEmptyStates(devices);
3145
3102
  }
3146
3103
 
@@ -3153,17 +3110,64 @@ function removeEmptyStates(devices) {
3153
3110
  }
3154
3111
  }
3155
3112
 
3156
- function findModel(model) {
3157
- const byModel = getByModel();
3113
+ function findModel(model, legacy) {
3114
+ const src = (legacy ? LegacyDevicesByModel : DevicesByModel)
3115
+ if (src.size <1) getByModel();
3158
3116
  const stripModel = (model) ? model.replace(/\0.*$/g, '').trim() : '';
3159
- return byModel.get(stripModel);
3117
+ return src.get(stripModel);
3118
+ }
3119
+
3120
+
3121
+
3122
+ function fillDevicesForLegacy(paired) {
3123
+ devices.clear();
3124
+ for (const candidate in legacy_devices) {
3125
+ for (const model in candidate.models) {
3126
+ if (paired.indexOf(model) >= 0) devices.push(candidate);
3127
+ break;
3128
+ }
3129
+ }
3130
+ }
3131
+
3132
+ function pairedLegacyDevices(candidates) {
3133
+ const rv = [];
3134
+ for (const candidate in legacy_devices) {
3135
+ for (const model in candidates.models) {
3136
+ if (candidate.models.contains(model)) rv.push(model);
3137
+ break;
3138
+ }
3139
+ }
3140
+ return rv;
3141
+ }
3142
+
3143
+ function setLegacyDevices(legacyModels) {
3144
+ const legacyByModel = new Map();
3145
+ for (const device of legacy_devices) {
3146
+ for (const model of device.models) {
3147
+ const stripModel = model.replace(/\0.*$/g, '').trim();
3148
+ legacyByModel.set(stripModel, device);
3149
+ }
3150
+ }
3151
+ legacyModels.forEach((model) => {
3152
+ const stripModel = model.replace(/\0.*$/g, '').trim();
3153
+ const dev = legacyByModel.get(stripModel);
3154
+ if (dev) devices.push(dev);
3155
+ })
3156
+ }
3157
+
3158
+ function getIconforLegacyModel(model) {
3159
+
3160
3160
  }
3161
3161
 
3162
3162
  module.exports = {
3163
3163
  devices,
3164
+ legacy_devices,
3164
3165
  commonStates,
3165
3166
  groupStates,
3166
3167
  groupsState: states.groups,
3167
3168
  fillStatesWithExposes,
3168
3169
  findModel,
3170
+ fillDevicesForLegacy,
3171
+ pairedLegacyDevices,
3172
+ setLegacyDevices
3169
3173
  };