iobroker.esphome 0.4.0 → 0.4.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/CHANGELOG_OLD.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # Older changes
2
+ ## 0.2.4 (2021-08-24)
3
+ * (DutchmanNL) Version of ESPHome Dashboard updated to 2021.8
4
+ * (DutchmanNL) Add option if config of ESPHome device should be shown as states (default = FALSE, safes 8 states for each sensor)
5
+
2
6
  ## 0.2.3 (2021-06-29)
3
7
  * (Jey-Cee) Bugfix : Light component state not changed [#74](https://github.com/DrozmotiX/ioBroker.esphome/issues/74)
4
8
  * (DutchmanNL) Update compatibility to version 1.19.4 of ESPHome Dashboard
package/README.md CHANGED
@@ -112,6 +112,11 @@ If you like my work, please consider a personal donation
112
112
  ### __WORK IN PROGRESS__
113
113
  * (DutchmanNL)
114
114
  -->
115
+ ### 0.4.1 (2023-11-05)
116
+ * (DutchmanNL) Bugfix: Password / connection issues in previous beta resolves #179
117
+ * (DutchmanNL) Bugfix: Allow individual API password or encryption keys for devices, resolves #174
118
+ * (DutchmanNL) Support ESPHome device Encryption Key (you should migrate from API password to Encryption Key ! resolves #152)
119
+
115
120
  ### 0.4.0 (2023-11-03)
116
121
  * (DutchmanNL) Added cleanup capability for unused channels & states after initialisation of device, resolves #39
117
122
  * (DutchmanNL) Added button to info channel which allows to delete all offline devices from adapter tree. resolves #39
@@ -132,10 +137,6 @@ If you like my work, please consider a personal donation
132
137
  * (DutchmanNL) Automatically create needed directories, resolves #168
133
138
  * (SimonFischer04) Migrate usage of python to new structure, should solve all ESPHome Dashboard related installation issues
134
139
 
135
- ### 0.2.4 (2021-08-24)
136
- * (DutchmanNL) Version of ESPHome Dashboard updated to 2021.8
137
- * (DutchmanNL) Add option if config of ESPHome device should be shown as states (default = FALSE, safes 8 states for each sensor)
138
-
139
140
  ## License
140
141
  MIT License
141
142
 
@@ -88,15 +88,23 @@
88
88
  console.log('Return of all devices : ' + JSON.stringify(_devices));
89
89
 
90
90
  let text = '';
91
- text += `
92
- <div class="input-field ip col s4">
93
- <input placeholder="192.168.0.1" class="center" id="device-ip" type="text" value='${_devices.rows[index].value.native.ip}'/>
94
- <span class="translate">IP</span>
95
- </div>
96
- <div class="input-field pass col s4">
97
- <input class="center" id="device-pass" type="password" value='${decryptManuell(secret, _devices.rows[index].value.native.passWord)}'/>
98
- <span class="translate">device-pass</span>
99
- </div>`;
91
+ text += `
92
+
93
+ <p class="translate">You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)</p>
94
+ <p class="translate">When Encryption Key is provided, API-Password will be ignored</p>
95
+ <div class="input-field ip col s8">
96
+ <label for="device-ip"></label><input placeholder="192.168.0.100" class="center" id="device-ip" type="text"/>
97
+ <span class="translate">IP</span>
98
+ </div>
99
+ <div class="input-field pass col s8">
100
+ <label for="deviceEncryptionKey"></label><input class="center" id="deviceEncryptionKey" type="password"/>
101
+ <span class="translate">deviceEncryptionKey</span>
102
+ </div>
103
+ <div class="input-field pass col s8">
104
+ <label for="device-pass"></label><input class="center" id="device-pass" type="password"/>
105
+ <span class="translate">device-pass</span>
106
+ </div>`;
107
+
100
108
  $(`#edit_device_container`).html(text);
101
109
  });
102
110
  }
@@ -190,7 +198,8 @@
190
198
  console.log('Add device button executed');
191
199
  messageObj = {
192
200
  'device-ip': $('#device-ip').val(),
193
- 'device-pass': encryptManuell(secret, $('#device-pass').val())
201
+ 'device-pass': encryptManuell(secret, $('#device-pass').val()),
202
+ 'deviceEncryptionKey': encryptManuell(secret, $('#deviceEncryptionKey').val())
194
203
  };
195
204
  sendTo(null, 'addDevice', messageObj, (data) => {
196
205
  console.log('Message from backend : ' + data);
@@ -210,7 +219,8 @@
210
219
  messageObj = {
211
220
  'device-ip': $('#device-ip').val(),
212
221
  // 'device-pass': decryptManuell(secret, $('#device-pass').val())
213
- 'device-pass': encryptManuell(secret, $('#device-pass').val())
222
+ 'device-pass': encryptManuell(secret, $('#device-pass').val()),
223
+ 'deviceEncryptionKey': encryptManuell(secret, $('#deviceEncryptionKey').val())
214
224
  };
215
225
  sendTo(null, 'addDevice', messageObj, (data) => {
216
226
  console.log('Message from backend : ' + data);
@@ -305,31 +315,6 @@
305
315
  <input type="text" class="value" disabled="true" id="ESPHomeDashboardPort" />
306
316
  <label for="ESPHomeDashboardPort" class="translate">ESPHomeDashboardPort</label>
307
317
  </div>
308
-
309
- <!-- <div class="input-field col s4">-->
310
- <!-- <input placeholder="localhost" class="center" id="device-ip" type="text" id="ESPHomeDashboardEnabled" />-->
311
- <!-- <span class="translate">ESPHome Dashboard IP</span>-->
312
- <!-- </div>-->
313
- <!-- <div class="input-field col s4">-->
314
- <!-- <input type="number" class="value" id="ESPHomeDashboardPort" />-->
315
- <!-- <span class="translate">Port</span>-->
316
- <!-- </div>-->
317
- <!-- <div class="input-field col s2">-->
318
- <!-- <input type="checkbox" class="value" id="currentYearWeeks" />-->
319
- <!-- <span class="translate">Week</span>-->
320
- <!-- </div>-->
321
- <!-- <div class="input-field col s2">-->
322
- <!-- <input type="checkbox" class="value" id="currentYearMonth" />-->
323
- <!-- <span class="translate">Month</span>-->
324
- <!-- </div>-->
325
- <!-- <div class="input-field col s2">-->
326
- <!-- <input type="checkbox" class="value" id="currentYearQuarter" />-->
327
- <!-- <span class="translate">Quarter</span>-->
328
- <!-- </div>-->
329
- <!-- <div class="input-field col s2">-->
330
- <!-- <input type="checkbox" class="value" id="currentYearPrevious" />-->
331
- <!-- <span class="translate">Previous</span>-->
332
- <!-- </div>-->
333
318
  </div>
334
319
 
335
320
  <div class="row center">
@@ -407,11 +392,17 @@
407
392
  <div class="modal-content">
408
393
  <h5 class="translate center">Add device manually</h5>
409
394
  <div class="row center">
410
- <div class="input-field ip col s4">
411
- <label for="device-ip"></label><input placeholder="192.168.0.1" class="center" id="device-ip" type="text"/>
395
+ <p class="translate">You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)</p>
396
+ <p class="translate">When Encryption Key is provided, API-Password will be ignored</p>
397
+ <div class="input-field ip col s8">
398
+ <label for="device-ip"></label><input placeholder="192.168.0.100" class="center" id="device-ip" type="text"/>
412
399
  <span class="translate">IP</span>
413
400
  </div>
414
- <div class="input-field pass col s4">
401
+ <div class="input-field pass col s8">
402
+ <label for="deviceEncryptionKey"></label><input class="center" id="deviceEncryptionKey" type="password"/>
403
+ <span class="translate">deviceEncryptionKey</span>
404
+ </div>
405
+ <div class="input-field pass col s8">
415
406
  <label for="device-pass"></label><input class="center" id="device-pass" type="password"/>
416
407
  <span class="translate">device-pass</span>
417
408
  </div>
package/admin/words.js CHANGED
@@ -10,6 +10,8 @@ systemDictionary = {
10
10
  'Connected': { 'en': 'Connected', 'de': 'Verbunden', 'ru': 'Подключено', 'pt': 'Conectado', 'nl': 'Verbonden', 'fr': 'Lié', 'it': 'Collegato', 'es': 'Conectado', 'pl': 'Połączony', 'zh-cn': '连接的'},
11
11
  'Delete': { 'en': 'Delete', 'de': 'Löschen', 'ru': 'Удалить', 'pt': 'Excluir', 'nl': 'Verwijderen', 'fr': 'Effacer', 'it': 'Elimina', 'es': 'Borrar', 'pl': 'Usuń', 'zh-cn': '删除'},
12
12
  'Devices can be added manually or by autodiscovery': {'en': 'Devices can be added manually or by autodiscovery', 'de': 'Geräte können manuell oder durch die automatische Erkennung hinzugefügt werden', 'ru': 'Устройства можно добавлять вручную или с помощью автообнаружения', 'pt': 'Os dispositivos podem ser adicionados manualmente ou por autodiscovery', 'nl': 'Apparaten kunnen handmatig of door autodiscovery worden toegevoegd', 'fr': 'Les appareils peuvent être ajoutés manuellement ou par découverte automatique', 'it': 'I dispositivi possono essere aggiunti manualmente o tramite rilevamento automatico', 'es': 'Los dispositivos se pueden agregar manualmente o por descubrimiento automático', 'pl': 'Urządzenia można dodawać ręcznie lub przez automatyczne wykrywanie', 'zh-cn': '可以手动添加设备或通过自动发现添加设备'},
13
+ 'You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)': {'en': 'You can either choose to use the Device Encryption Key (preferred) or API-Password (legacy)', 'de': 'Sie können entweder den Geräteverschlüsselungsschlüssel (bevorzugt) oder das API-Passwort (alt) verwenden.', 'ru': 'Вы можете использовать либо ключ шифрования устройства (предпочтительно), либо пароль API (устаревший вариант).', 'pt': 'Você pode optar por usar a chave de criptografia do dispositivo (preferencial) ou a senha da API (legado)', 'nl': 'U kunt ervoor kiezen om de Device Encryption Key (bij voorkeur) of het API-wachtwoord (verouderd) te gebruiken', 'fr': "Vous pouvez choisir d'utiliser la clé de chiffrement de l'appareil (de préférence) ou le mot de passe API (ancien)", 'it': 'Puoi scegliere di utilizzare la chiave di crittografia del dispositivo (preferita) o la password API (legacy)', 'es': 'Puede optar por utilizar la clave de cifrado del dispositivo (preferida) o la contraseña API (heredada)', 'pl': 'Możesz wybrać użycie klucza szyfrowania urządzenia (preferowany) lub hasła API (starsza wersja)', 'zh-cn': '您可以选择使用设备加密密钥(首选)或 API 密码(旧版)'},
14
+ 'When Encryption Key is provided, API-Password will be ignored': {'en': 'When Encryption Key is provided, API-Password will be ignored', 'de': 'Wenn der Verschlüsselungsschlüssel bereitgestellt wird, wird das API-Passwort ignoriert', 'ru': 'Если предоставлен ключ шифрования, пароль API будет игнорироваться.', 'pt': 'Quando a chave de criptografia for fornecida, a senha da API será ignorada', 'nl': 'Wanneer de coderingssleutel wordt opgegeven, wordt het API-wachtwoord genegeerd', 'fr': 'Lorsque la clé de cryptage est fournie, le mot de passe API sera ignoré', 'it': 'Quando viene fornita la chiave di crittografia, la password API verrà ignorata', 'es': 'Cuando se proporciona la clave de cifrado, se ignorará la contraseña API', 'pl': 'Po podaniu klucza szyfrowania hasło API zostanie zignorowane', 'zh-cn': '当提供加密密钥时,API-密码将被忽略'},
13
15
  'ESPHomeDashboardEnabled': { 'en': 'Enable built-in ESPHome dashboard', 'de': 'Aktiviere das integrierte ESPHome-Dashboard', 'ru': 'Включить встроенный ESPHome Dashboard', 'pt': 'Ativar painel ESPHome integrado', 'nl': 'Schakel het ingebouwde ESPHome-dashboard in', 'fr': 'Activer le tableau de bord ESPHome intégré', 'it': 'Abilita il dashboard ESPHome integrato', 'es': 'Habilitar el panel de control ESPHome integrado', 'pl': 'Włącz wbudowany pulpit nawigacyjny ESPHome', 'zh-cn': '启用内置ESPHome仪表板'},
14
16
  'ESPHome_Dashboard_Generic_info': { 'en': 'Here you can enable / disable the ESPHome dashboard hosted by ioBroker. A separate installation of ESPHome is not required!', 'de': 'Hier wird das von ioBroker bereitgestellt ESPHome-Dashboard aktiviert / deaktiviert. Eine separate Installation von ESPHome ist nicht erforderlich!', 'ru': 'Здесь вы можете включить / отключить панель управления ESPHome, запущенную ioBroker-ом. Устанавливать дополнительно ESPhome не нужно!', 'pt': 'Aqui você pode ativar / desativar o painel ESPHome hospedado por ioBroker. ', 'nl': 'Hier kunt u het ESPHome-dashboard dat wordt gehost door ioBroker in- / uitschakelen. Een seperate installatie is niet noodzakelijk!', 'fr': 'Ici, vous pouvez activer / désactiver le tableau de bord ESPHome hébergé par ioBroker. ', 'it': 'Qui puoi abilitare / disabilitare la dashboard ESPHome ospitata da ioBroker. ', 'es': 'Aquí puede habilitar / deshabilitar el panel de ESPHome alojado por ioBroker. ', 'pl': 'Tutaj możesz włączyć / wyłączyć pulpit nawigacyjny ESPHome obsługiwany przez ioBroker. ', 'zh-cn': '您可以在此处启用/禁用ioBroker托管的ESPHome仪表板。'},
15
17
  'ESPHome_Dashboard_IP_info': { 'en': 'Please provide the IP address where the ESPHome dashboard is located (ioBroker or already existing instance).', 'de': 'Bitte die IP-Adresse angeben, unter der sich das ESPHome-Dashboard befindet (ioBroker oder bereits vorhandene ESPHome Instanz).', 'ru': 'Укажите IP-адрес, на котором расположена панель управления ESPHome (ioBroker или уже существующий экземпляр?)', 'pt': 'Forneça o endereço IP onde o ESPHome Dashboard está localizado (ioBroker ou instância já existente?)', 'nl': 'IP-adres op waar het ESPHome-dashboard zich bevindt (ioBroker of een reeds bestaande instantie?)', 'fr': "Veuillez fournir l'adresse IP où se trouve le tableau de bord ESPHome (ioBroker ou instance déjà existante?)", 'it': "Fornisci l'indirizzo IP in cui si trova ESPHome Dashboard (ioBroker o istanza già esistente?)", 'es': 'Proporcione la dirección IP donde se encuentra el panel de ESPHome (¿ioBroker o una instancia ya existente?)', 'pl': 'Podaj adres IP, pod którym znajduje się pulpit nawigacyjny ESPHome (ioBroker czy już istniejąca instancja?)', 'zh-cn': '请提供ESPHome仪表板所在的IP地址(ioBroker或已经存在的实例?)'},
@@ -20,6 +22,7 @@ systemDictionary = {
20
22
  'IP-Address': { 'en': 'IP Address', 'de': 'IP-Adresse', 'ru': 'IP адрес', 'pt': 'Endereço de IP', 'nl': 'IP adres', 'fr': 'Adresse IP', 'it': 'Indirizzo IP', 'es': 'Dirección IP', 'pl': 'Adres IP', 'zh-cn': 'IP地址'},
21
23
  'Name': { 'en': 'Name', 'de': 'Name', 'ru': 'Имя', 'pt': 'Nome', 'nl': 'Naam', 'fr': 'Nom', 'it': 'Nome', 'es': 'Nombre', 'pl': 'Nazwa', 'zh-cn': '姓名'},
22
24
  'Show configuration as states': { 'en': 'Show configuration as states', 'de': 'Konfiguration als Zustände anzeigen', 'ru': 'Показать конфигурацию как состояния', 'pt': 'Mostrar configuração como estados', 'nl': 'Configuratie weergeven als toestanden', 'fr': "Afficher la configuration sous forme d'états", 'it': 'Mostra configurazione come stati', 'es': 'Mostrar configuración como estados', 'pl': 'Pokaż konfigurację jako stany', 'zh-cn': '将配置显示为状态'},
23
- 'device-pass': { 'en': 'Password', 'de': 'Passwort', 'ru': 'Пароль', 'pt': 'Senha', 'nl': 'Wachtwoord', 'fr': 'Mot de passe', 'it': "Parola d'ordine", 'es': 'Contraseña', 'pl': 'Hasło', 'zh-cn': '密码'},
25
+ 'device-pass': { 'en': 'Device API Password (legacy)', 'de': 'Passwort', 'ru': 'Пароль', 'pt': 'Senha', 'nl': 'Wachtwoord', 'fr': 'Mot de passe', 'it': "Parola d'ordine", 'es': 'Contraseña', 'pl': 'Hasło', 'zh-cn': '密码'},
26
+ 'deviceEncryptionKey': { 'en': 'Device EncryptionKey (preferred)', 'de': 'Geräteverschlüsselungsschlüssel (bevorzugt)', 'ru': 'Ключ шифрования устройства (предпочтительно)', 'pt': 'Chave de criptografia do dispositivo (preferencial)', 'nl': 'Apparaatcoderingssleutel (bij voorkeur)', 'fr': "Clé de chiffrement de l'appareil (de préférence)", 'it': 'Chiave di crittografia del dispositivo (preferita)', 'es': 'Clave de cifrado del dispositivo (preferida)', 'pl': 'Klucz szyfrowania urządzenia (preferowany)', 'zh-cn': '设备加密密钥(首选)'},
24
27
  'reconnect interval': { 'en': 'Reconnect Interval', 'de': 'Intervall für erneutes Verbinden', 'ru': 'Интервал повторного соединения', 'pt': 'intervalo de reconexão', 'nl': 'interval voor opnieuw verbinden', 'fr': 'intervalle de reconnexion', 'it': "ricollegare l'intervallo", 'es': 'intervalo de reconexión', 'pl': 'interwał ponownego łączenia', 'zh-cn': '重新连接间隔'},
25
28
  };
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "esphome",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "news": {
6
+ "0.4.1": {
7
+ "en": "Bugfix: Password / connection issues in previous beta resolves #179\nBugfix: Allow individual API password or encryption keys for devices, resolves #174\nSupport ESPHome device Encryption Key (you should migrate from API password to Encryption Key ! resolves #152)",
8
+ "de": "Bugfix: Passwort / Verbindungsprobleme in vorherigen beta löst #179\nBugfix: Lassen Sie individuelle API-Passwort oder Verschlüsselungsschlüssel für Geräte, löst #174\nSupport ESPHome Gerät Verschlüsselungsschlüssel (Sie sollten von API-Passwort zu Verschlüsselungsschlüssel migrieren! löst #152)",
9
+ "ru": "Bugfix: Пароль / проблемы соединения в предыдущей бета-версии решает #179\nBugfix: Разрешить индивидуальные API-пароль или ключи шифрования для устройств, решает #174\nПоддержка ESPHome устройства Encryption Key (вы должны migrate от API-пароль для Encryption Key! решает #152)",
10
+ "pt": "Bugfix: Problemas de senha / conexão no beta anterior resolve #179\nBugfix: Permitir senha API individual ou chaves de criptografia para dispositivos, resolve #174\nSuporte ESPHome dispositivo Encryption Key (você deve migrar da senha API para Encryption Key! resolve #152)",
11
+ "nl": "Vertaling:\nBugfix: Sta individuele API wachtwoord of encryptie sleutels voor apparatuur, vaststellen\nSteun ESPHome apparatuur encryption Key (je moet migreren van API wachtwoord naar Encryption Key! Vertaling:",
12
+ "fr": "Bugfix: Mot de passe / problèmes de connexion dans la bêta précédente résout #179\nBugfix: Permettre un mot de passe ou des clés de chiffrement de l'API pour les appareils, résout #174\nSupport ESPHome périphérique Clé de chiffrement (vous devriez migrer de l'API mot de passe à la clé de chiffrement ! résout #152)",
13
+ "it": "Bugfix: Password / problemi di connessione nella precedente beta risolve #179\nBugfix: Consentire singole password API o chiavi di crittografia per i dispositivi, risolve #174\nSupporto dispositivo ESPHome chiave di crittografia (si dovrebbe migrare da password API a chiave di crittografia! risolve #152)",
14
+ "es": "Bugfix: Problemas de contraseña / conexión en beta anterior resuelve #179\nBugfix: Permitir contraseña o claves de cifrado individuales de API para dispositivos, resuelve #174\nSoporte ESPHome dispositivo clave de cifrado (debe migrar desde contraseña de API a clave de cifrado! resuelve #152)",
15
+ "pl": "Bugfix: Password / Problemy połączenia w poprzednich beta rozwiązały numer #179\nBugfix: Allow indywidualny API password lub klucze szyfrujące dla urządzeń, rozwiązał numer #174\nWsparcie ESPHome: Encryption Key (you powinien wyemigrować z hasła API do Encryption Key ! Rozwiązanie #152",
16
+ "uk": "Помилки: Пароль / питання з'єднання у попередніх бета-рішеннях #179\nПомилки: Дозволити індивідуальний пароль API або ключі шифрування для пристроїв, вирішує #174\nПідтримка ESPHome пристрій шифрування ключа (Ви повинні мигратувати від API пароля до ключа шифрування ! розчини #152)",
17
+ "zh-cn": "Bugfix:在前几批被盗用词/联系问题\nBugfix: 允许个人的通用或加密装置的关键,第174号行动\n支持ESPHome装置的加密关键(you应从API密码移到恩加密的关键! 第152号决议)"
18
+ },
6
19
  "0.4.0": {
7
20
  "en": "Added cleanup capability for unused channels & states after initialisation of device, resolves #39\nAdded button to info channel which allows to delete all offline devices from adapter tree. resolves #39\n[Breaking] Backup strategy changed, requires [BackitUp v2.9.1](https://github.com/simatec/ioBroker.backitup) and activate option for ESPHome, fixes #129",
8
21
  "de": "Zusätzliche Reinigungsfähigkeit für ungenutzte Kanäle & Zustände nach der Initialisierung des Geräts, löst #39\nZusätzlicher Button zum Info-Kanal, der alle Offline-Geräte aus dem Adapterbaum löschen kann. löst #39\n[Breaking] Backup-Strategie geändert, erfordert [BackitUp v2.9.1](https://github.com/simatec/ioBroker.backitup) und aktiviert Option für ESPHome, repariert #129",
@@ -78,18 +91,6 @@
78
91
  "es": "Corrección de error: el estado del componente de luz no ha cambiado [# 74] (https://github.com/DrozmotiX/ioBroker.esphome/issues/74)\nActualizar la compatibilidad a la versión 1.19.4 de ESPHome Dashboard",
79
92
  "pl": "Poprawka błędu: stan lekkiego komponentu nie uległ zmianie [#74](https://github.com/DrozmotiX/ioBroker.esphome/issues/74)\nZaktualizuj kompatybilność do wersji 1.19.4 ESPHome Dashboard",
80
93
  "zh-cn": "修正:轻组件状态没有改变 [#74](https://github.com/DrozmotiX/ioBroker.esphome/issues/74)\n更新与 ESPHome Dashboard 1.19.4 版的兼容性"
81
- },
82
- "0.2.2": {
83
- "en": "[!!! Breaking !!!] Make YAML file persistent, backup your configuration before updating ! solves [#57](https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nUpdate ESPHome Dashboard to 1.18.0, requires Python >=3.7 (and ensure <4.0!)\nBugfix : Reconnect to devices without autodiscovery / MDNS-Broadcast in network, solves [#66](https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
84
- "de": "[!!! Breaking !!!] Machen Sie die YAML-Datei persistent, sichern Sie Ihre Konfiguration vor dem Update! löst [#57](https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nAktualisieren Sie das ESPHome-Dashboard auf 1.18.0, erfordert Python >=3.7 (und stellen Sie sicher <4.0!)\nBugfix : Reconnect zu Geräten ohne Autodiscovery / MDNS-Broadcast im Netzwerk, behebt [#66](https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
85
- "ru": "[!!! Ломаю !!!] Сделайте файл YAML постоянным, сделайте резервную копию конфигурации перед обновлением! решает [# 57] (https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nОбновите ESPHome Dashboard до 1.18.0, требуется Python> = 3.7 (и убедитесь, что <4.0!)\nИсправление: повторное подключение к устройствам без автообнаружения / MDNS-трансляции в сети, решает [# 66] (https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
86
- "pt": "[!!! Quebrando !!!] Torne o arquivo YAML persistente, faça backup de sua configuração antes de atualizar! resolve [# 57] (https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nAtualize o painel ESPHome para 1.18.0, requer Python> = 3.7 (e garanta <4.0!)\nCorreção de bug: reconectar a dispositivos sem autodiscovery / MDNS-Broadcast na rede, resolve [# 66] (https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
87
- "nl": "[!!! Breaking !!!] Maak het YAML-bestand persistent, maak een back-up van uw configuratie voordat u deze bijwerkt! lost [#57](https://github.com/DrozmotiX/ioBroker.esphome/issues/57) op\nUpdate ESPHome Dashboard naar 1.18.0, vereist Python >=3.7 (en zorg voor <4.0!)\nBugfix: opnieuw verbinding maken met apparaten zonder autodiscovery / MDNS-uitzending in netwerk, lost [#66](https://github.com/DrozmotiX/ioBroker.esphome/issues/66) op",
88
- "fr": "[!!! Breaking !!!] Rendez le fichier YAML persistant, sauvegardez votre configuration avant de mettre à jour ! résout [#57](https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nMettez à jour ESPHome Dashboard vers 1.18.0, nécessite Python >=3.7 (et assurez-vous <4.0 !)\nCorrection de bug : se reconnecter aux appareils sans découverte automatique / MDNS-Broadcast en réseau, résout [#66](https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
89
- "it": "[!!! Breaking !!!] Rendi persistente il file YAML, esegui il backup della configurazione prima di aggiornare! risolve [#57](https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nAggiorna ESPHome Dashboard a 1.18.0, richiede Python >=3.7 (e assicurati <4.0!)\nBugfix: riconnettersi ai dispositivi senza autodiscovery / MDNS-Broadcast in rete, risolve [#66] (https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
90
- "es": "[!!! ¡¡¡Rompiendo !!!] ¡Haga que el archivo YAML sea persistente, haga una copia de seguridad de su configuración antes de actualizar! resuelve [# 57] (https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nActualice ESPHome Dashboard a 1.18.0, requiere Python> = 3.7 (¡y asegúrese de <4.0!)\nCorrección de error: vuelva a conectarse a dispositivos sin detección automática / MDNS-Broadcast en la red, resuelve [# 66] (https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
91
- "pl": "[!!! Breaking !!!] Utrwal plik YAML, wykonaj kopię zapasową konfiguracji przed aktualizacją! rozwiązuje [#57](https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\nZaktualizuj pulpit nawigacyjny ESPHome do wersji 1.18.0, wymaga Pythona >=3.7 (i upewnij się, że <4.0!)\nBugfix: Połącz się ponownie z urządzeniami bez automatycznego wykrywania / MDNS-Broadcast w sieci, rozwiązuje [#66](https://github.com/DrozmotiX/ioBroker.esphome/issues/66)",
92
- "zh-cn": "[!!!打破 !!!] 使 YAML 文件持久化,更新前备份您的配置!解决 [#57](https://github.com/DrozmotiX/ioBroker.esphome/issues/57)\n将 ESPHome Dashboard 更新到 1.18.0,需要 Python >=3.7(并确保 <4.0!)\n修正:在网络中没有自动发现/MDNS-Broadcast 的情况下重新连接到设备,解决[#66](https://github.com/DrozmotiX/ioBroker.esphome/issues/66)"
93
94
  }
94
95
  },
95
96
  "title": "Control ESPHome managed devices",
package/main.js CHANGED
@@ -60,7 +60,11 @@ class Esphome extends utils.Adapter {
60
60
 
61
61
  // Start MDNS discovery when enabled
62
62
  if (autodiscovery) {
63
- this.deviceDiscovery(); // Start MDNS autodiscovery
63
+ if (resetTimers['autodiscovery']) resetTimers['autodiscovery'] = clearTimeout(resetTimers['autodiscovery']);
64
+ this.log.info(`Adapter ready, automatic Device Discovery will be acticated in 30 seconds.`);
65
+ resetTimers['autodiscovery'] = setTimeout(async () => {
66
+ this.deviceDiscovery(); // Start MDNS autodiscovery
67
+ }, (30000));
64
68
  } else {
65
69
  this.log.warn(`Auto Discovery disabled, new devices (or IP changes) will NOT be detected automatically!`);
66
70
  }
@@ -171,7 +175,7 @@ class Esphome extends utils.Adapter {
171
175
 
172
176
  // Get basic data of known devices and start reading data
173
177
  for (const i in knownDevices) {
174
- this.connectDevices(knownDevices[i].native.ip);
178
+ this.connectDevices(knownDevices[i].native.ip, knownDevices[i].native.passWord, knownDevices[i].native.encryptionKey ? knownDevices[i].native.encryptionKey : '');
175
179
  }
176
180
  } catch (e) {
177
181
  this.sendSentry(`[tryKnownDevices] ${e}`);
@@ -182,7 +186,7 @@ class Esphome extends utils.Adapter {
182
186
  deviceDiscovery() {
183
187
  try {
184
188
 
185
- this.log.info(`Auto Discovery startet, new devices (or IP changes) will be detected automatically`);
189
+ this.log.info(`Automatic device Discovery started, new devices (or IP changes) will be detected automatically`);
186
190
  discovery = new Discovery();
187
191
 
188
192
  discovery.on('info', async (message) => {
@@ -190,7 +194,13 @@ class Esphome extends utils.Adapter {
190
194
  this.log.debug(`Discovery message ${JSON.stringify(message)}`);
191
195
  if (this.deviceInfo[message.address] == null) {
192
196
  this.log.info(`[AutoDiscovery] New ESPHome device found at IP ${message.address}, trying to initialize`);
193
- this.connectDevices(`${message.address}`);
197
+ //ToDo: Add default Encryption Key
198
+ // Only run autodiscovery if device is unknown yet
199
+ if (!this.deviceInfo[message.address]
200
+ && this.deviceInfo[message.address].connectError === false
201
+ && !this.deviceInfo[message.address] && this.deviceInfo[message.address].connecting) {
202
+ this.connectDevices(`${message.address}`, apiPass, '');
203
+ }
194
204
  }
195
205
  } catch (e) {
196
206
  this.log.error(`[deviceDiscovery handler] ${e}`);
@@ -205,41 +215,80 @@ class Esphome extends utils.Adapter {
205
215
  /**
206
216
  * Handle Socket connections
207
217
  * @param {string} host IP adress of device
218
+ * @param {string} deviceApiPass Native API credentials
219
+ * @param {string} deviceEncryptionKey Encryption Key credentials
208
220
  */
209
- connectDevices(host) {
221
+ connectDevices(host, deviceApiPass, deviceEncryptionKey) {
210
222
  try {
211
223
  // const host = espDevices[device].ip;
212
224
  this.log.info(`Try to connect to ${host}`);
213
- // Prepare connection attributes
214
- client[host] = new Client({
215
- host: host,
216
- password: apiPass,
217
- clientInfo: `${this.host}`,
218
- clearSession: true,
219
- initializeDeviceInfo: true,
220
- initializeListEntities: true,
221
- initializeSubscribeStates: false,
222
- // initializeSubscribeLogs: false, //ToDo: Make configurable by adapter settings
223
- reconnect: true,
224
- reconnectInterval: reconnectInterval,
225
- pingInterval: 15000, //ToDo: Make configurable by adapter settings
226
- pingAttempts: 3
227
- // port: espDevices[device].port //ToDo: Make configurable by adapter settings
228
- });
225
+
226
+ // Cancel process if connection try is already in progress
227
+ if (this.deviceInfo[host] && this.deviceInfo[host].connecting) return;
228
+
229
+ // Clear any existing memory information for this device
230
+ delete this.deviceInfo[host];
231
+
232
+ // Reserve basic memory information for this device
233
+ this.deviceInfo[host] = {
234
+ connected : false,
235
+ connecting : true,
236
+ connectionError : false,
237
+ initialized: false,
238
+ ip : host
239
+ };
240
+
241
+ if (!deviceEncryptionKey || deviceEncryptionKey === '') {
242
+ client[host] = new Client({
243
+ host: host,
244
+ clientInfo: `${this.host}`,
245
+ clearSession: true,
246
+ initializeDeviceInfo: true,
247
+ initializeListEntities: true,
248
+ initializeSubscribeStates: false,
249
+ // initializeSubscribeLogs: false, //ToDo: Make configurable by adapter settings
250
+ reconnect: true,
251
+ reconnectInterval: reconnectInterval,
252
+ pingInterval: 15000, //ToDo: Make configurable by adapter settings
253
+ pingAttempts: 3,
254
+ password : this.decrypt(deviceApiPass)
255
+ // port: espDevices[device].port //ToDo: Make configurable by adapter settings
256
+ });
257
+ } else {
258
+ client[host] = new Client({
259
+ host: host,
260
+ clientInfo: `${this.host}`,
261
+ clearSession: true,
262
+ initializeDeviceInfo: true,
263
+ initializeListEntities: true,
264
+ initializeSubscribeStates: false,
265
+ // initializeSubscribeLogs: false, //ToDo: Make configurable by adapter settings
266
+ reconnect: true,
267
+ reconnectInterval: reconnectInterval,
268
+ pingInterval: 15000, //ToDo: Make configurable by adapter settings
269
+ pingAttempts: 3,
270
+ encryptionKey: this.decrypt(deviceEncryptionKey)
271
+ // port: espDevices[device].port //ToDo: Make configurable by adapter settings
272
+ });
273
+ }
229
274
 
230
275
  // Connection listener
231
276
  client[host].on('connected', async () => {
232
277
  try {
233
278
  // Clear any existing memory information for this device
234
279
  delete this.deviceInfo[host];
235
-
236
- // Reserve basic memory information for this device
237
- this.deviceInfo[host] = {
238
- connected : true,
239
- connectionError : false,
240
- initialized: false,
241
- ip : host
242
- };
280
+ if (!this.deviceInfo[host]) {
281
+ this.deviceInfo[host] = {
282
+ connected : false,
283
+ connecting : true,
284
+ connectionError : false,
285
+ initialized: false,
286
+ ip : host
287
+ };
288
+ } else {
289
+ this.deviceInfo[host].connected = true;
290
+ this.deviceInfo[host].connecting = false;
291
+ }
243
292
  this.log.info(`ESPHome client ${host} connected`);
244
293
  // Clear possible present warn messages for device from previous connection
245
294
  delete warnMessages[host];
@@ -248,10 +297,10 @@ class Esphome extends utils.Adapter {
248
297
  }
249
298
  });
250
299
 
251
- client[host].on('disconnected', () => {
300
+ client[host].on('disconnected', async () => {
252
301
  try {
253
302
  if (this.deviceInfo[host].deviceName != null) {
254
- this.setState(`${this.deviceInfo[host].deviceName}.info._online`, {val: false, ack: true});
303
+ await this.stateSetCreate(`${this.deviceInfo[host].deviceName}.info._online`, `Online state`, false);
255
304
 
256
305
  // Check all created states in memory if their are related to this device
257
306
  for (const state in this.createdStatesDetails) {
@@ -273,6 +322,7 @@ class Esphome extends utils.Adapter {
273
322
  // Reserve basic memory information for this device
274
323
  this.deviceInfo[host] = {
275
324
  connected : false,
325
+ connecting: false,
276
326
  connectionError : true,
277
327
  deviceName : cacheDeviceInformation.deviceName,
278
328
  deviceInfoName : cacheDeviceInformation.deviceInfoName,
@@ -326,7 +376,8 @@ class Esphome extends utils.Adapter {
326
376
  deviceInfo: deviceInfo,
327
377
  deviceName: deviceName,
328
378
  deviceInfoName: deviceInfo.name,
329
- passWord: apiPass,
379
+ passWord: deviceApiPass,
380
+ encryptionKey: deviceEncryptionKey,
330
381
  };
331
382
 
332
383
  // Store MAC & IP relation, delete possible existing entry before
@@ -349,7 +400,8 @@ class Esphome extends utils.Adapter {
349
400
  name: this.deviceInfo[host].deviceInfoName,
350
401
  mac: deviceInfo.macAddress,
351
402
  deviceName: deviceName,
352
- passWord: this.encrypt(apiPass),
403
+ passWord: deviceApiPass,
404
+ encryptionKey: deviceEncryptionKey
353
405
  },
354
406
  });
355
407
 
@@ -549,7 +601,7 @@ class Esphome extends utils.Adapter {
549
601
  });
550
602
 
551
603
  // Connection data handler
552
- client[host].on('error', (error) => {
604
+ client[host].on('error', async (error) => {
553
605
  try {
554
606
 
555
607
  // Reserve memory space for connection error if not already exist
@@ -568,24 +620,42 @@ class Esphome extends utils.Adapter {
568
620
  if (!this.deviceInfo[host].connectError) {
569
621
  this.log.error(optimisedError);
570
622
  this.deviceInfo[host].connectError = true;
623
+ await this.stateSetCreate(`${this.deviceInfo[host].deviceName}.info._online`, `Online state`, false);
624
+ }
625
+ } else if (error.message.includes('EHOSTUNREACH')) {
626
+ optimisedError = `Client ${host} unreachable !`;
627
+ if (!this.deviceInfo[host].connectError) {
628
+ this.log.error(optimisedError);
629
+ this.deviceInfo[host].connectError = true;
630
+ await this.stateSetCreate(`${this.deviceInfo[host].deviceName}.info._online`, `Online state`, false);
571
631
  }
572
632
  } else if (error.message.includes('Invalid password')) {
573
633
  optimisedError = `Client ${host} incorrect password !`;
574
634
  if (!this.deviceInfo[host].connectError) {
575
635
  this.log.error(optimisedError);
576
636
  this.deviceInfo[host].connectError = true;
637
+ await this.stateSetCreate(`${this.deviceInfo[host].deviceName}.info._online`, `Online state`, false);
638
+ }
639
+ } else if (error.message.includes('Encryption expected')) {
640
+ optimisedError = `Client ${host} requires encryption key which has not been provided, please enter encryption key in adapter settings for this device !`;
641
+ if (!this.deviceInfo[host].connectError) {
642
+ this.log.error(optimisedError);
643
+ this.deviceInfo[host].connectError = true;
644
+ await this.stateSetCreate(`${this.deviceInfo[host].deviceName}.info._online`, `Online state`, false);
577
645
  }
578
646
  } else if (error.message.includes('ECONNRESET')) {
579
647
  optimisedError = `Client ${host} Connection Lost, will reconnect automatically when device is available!`;
580
648
  if (!this.deviceInfo[host].connectError) {
581
649
  this.log.warn(optimisedError);
582
650
  this.deviceInfo[host].connectError = true;
651
+ await this.stateSetCreate(`${this.deviceInfo[host].deviceName}.info._online`, `Online state`, false);
583
652
  }
584
653
  } else if (error.message.includes('timeout')) {
585
654
  optimisedError = `Client ${host} Timeout, will reconnect automatically when device is available!`;
586
655
  if (!this.deviceInfo[host].connectError) {
587
656
  this.log.warn(optimisedError);
588
657
  this.deviceInfo[host].connectError = true;
658
+ await this.stateSetCreate(`${this.deviceInfo[host].deviceName}.info._online`, `Online state`, false);
589
659
  }
590
660
  } else if (error.message.includes('ECONNREFUSED')) {
591
661
  optimisedError = `Client ${host} not yet ready to connect, will try again!`;
@@ -624,7 +694,7 @@ class Esphome extends utils.Adapter {
624
694
  }
625
695
 
626
696
  } catch (e) {
627
- this.log.error(`ESP device error for ${host}`);
697
+ this.log.error(`ESP device error for ${host} | ${e} | ${e.stack}`);
628
698
  }
629
699
  }
630
700
 
@@ -1086,8 +1156,7 @@ class Esphome extends utils.Adapter {
1086
1156
  } else {
1087
1157
  this.log.info(`Valid IP address received`);
1088
1158
  this.messageResponse[obj.message['device-ip']] = obj;
1089
- // const pass = this.decrypt(obj.message['device-pass']);
1090
- await this.connectDevices(obj.message['device-ip']);
1159
+ await this.connectDevices(obj.message['device-ip'], obj.message['device-pass'], obj.message['deviceEncryptionKey']);
1091
1160
  }
1092
1161
  break;
1093
1162
  }
@@ -1295,7 +1364,7 @@ class Esphome extends utils.Adapter {
1295
1364
  });
1296
1365
 
1297
1366
  // Set online state to false, will be set to true at successfully connected
1298
- this.setState(`${_devices.rows[currDevice].id}.info._online`, {val: false, ack: true});
1367
+ await this.stateSetCreate(`${_devices.rows[currDevice].id}.info._online`, `Online state`, false);
1299
1368
  }
1300
1369
 
1301
1370
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.esphome",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Control your ESP8266/ESP32 with simple yet powerful configuration files created and managed by ESPHome",
5
5
  "author": {
6
6
  "name": "DutchmanNL",