iobroker.esphome 0.3.0 → 0.3.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.
@@ -0,0 +1,42 @@
1
+ # Older changes
2
+ ## 0.2.1-1 (2021-03-30)
3
+ * (DutchmanNL) add cover component
4
+ * (DutchmanNL) add transitionLength for lights
5
+
6
+ ## 0.2.1-0 (2021-03-30)
7
+ * (DutchmanNL) Logging improved, solves [#48](https://github.com/DrozmotiX/ioBroker.esphome/issues/48)
8
+ * (DutchmanNL) Name of states changed, solves [#49](https://github.com/DrozmotiX/ioBroker.esphome/issues/49)
9
+
10
+ ## 0.2.0 (2021-03-29)
11
+ * (DutchmanNL) Translations updated
12
+ * (DutchmanNL) Configuration page updated
13
+ * (DutchmanNL) Added to sentry error reporting
14
+ * (DutchmanNL) Native integration of ESPHome Dashboard added
15
+
16
+ ## 0.1.5 (2021-03-21)
17
+ * (DutchmanNL) Add Translations
18
+
19
+ ## 0.1.4 (2021-03-19)
20
+ * (DutchmanNL) Implemented RGBW
21
+ * (DutchmanNL) Ensure correct encryption and storage of passwords
22
+ * (DutchmanNL) Proper value ranges for type light (255 instead 100)
23
+ * (DutchmanNL) Implemented hex color state for type light (if RGB is available)
24
+
25
+ ## 0.1.2 (2021-03-02)
26
+ * (DutchmanNL) Type Fan added
27
+ * (DutchmanNL) Type Light added
28
+ * (DutchmanNL) Error messages optimized
29
+ * (DutchmanNL) Device reconnect handling improved
30
+ * (DutchmanNL) [Breaking!] Change state name to default "state" for type BinarySensor / Climate / Sensor / TextSensor & Switch
31
+ * (DutchmanNL) Autodiscovery improved, non-ESPHome devices excluded
32
+
33
+ ## 0.1.0 (2021-02-27)
34
+ * (DutchmanNL) Autodiscovery implemented
35
+ * (DutchmanNL) Type Climat added
36
+ * (DutchmanNL) Type TextSensor added
37
+ * (DutchmanNL) Solved reconnection issues
38
+ * (DutchmanNL) Optimized error messages for unknown types
39
+ * (DutchmanNL & @xXBJXx) Adapter configuration page optimized
40
+
41
+ ## 0.0.1
42
+ * (DutchmanNL) initial release
package/README.md CHANGED
@@ -112,6 +112,9 @@ If you like my work, please consider a personal donation
112
112
  ### __WORK IN PROGRESS__
113
113
  * (DutchmanNL)
114
114
  -->
115
+ ### 0.3.1 (2023-10-31)
116
+ * (DutchmanNL) Bugfix: Show online state of ESP Device correctly, Fixes #106
117
+
115
118
  ### 0.3.0 (2023-10-31) - Bugfixes & Improvements
116
119
  * (Dutchman & SimonFischer04) Several Bugfixes
117
120
  * (SimonFischer04) Support type "select device"
@@ -133,48 +136,6 @@ If you like my work, please consider a personal donation
133
136
  * (DutchmanNL) Update ESPHome Dashboard to 1.18.0, requires Python >=3.7 (and ensure <4.0!)
134
137
  * (DutchmanNL) Bugfix : Reconnect to devices without autodiscovery / MDNS-Broadcast in network, solves [#66](https://github.com/DrozmotiX/ioBroker.esphome/issues/66)
135
138
 
136
- ### 0.2.1-1 (2021-03-30)
137
- * (DutchmanNL) add cover component
138
- * (DutchmanNL) add transitionLength for lights
139
-
140
- ### 0.2.1-0 (2021-03-30)
141
- * (DutchmanNL) Logging improved, solves [#48](https://github.com/DrozmotiX/ioBroker.esphome/issues/48)
142
- * (DutchmanNL) Name of states changed, solves [#49](https://github.com/DrozmotiX/ioBroker.esphome/issues/49)
143
-
144
- ### 0.2.0 (2021-03-29)
145
- * (DutchmanNL) Translations updated
146
- * (DutchmanNL) Configuration page updated
147
- * (DutchmanNL) Added to sentry error reporting
148
- * (DutchmanNL) Native integration of ESPHome Dashboard added
149
-
150
- ### 0.1.5 (2021-03-21)
151
- * (DutchmanNL) Add Translations
152
-
153
- ### 0.1.4 (2021-03-19)
154
- * (DutchmanNL) Implemented RGBW
155
- * (DutchmanNL) Ensure correct encryption and storage of passwords
156
- * (DutchmanNL) Proper value ranges for type light (255 instead 100)
157
- * (DutchmanNL) Implemented hex color state for type light (if RGB is available)
158
-
159
- ### 0.1.2 (2021-03-02)
160
- * (DutchmanNL) Type Fan added
161
- * (DutchmanNL) Type Light added
162
- * (DutchmanNL) Error messages optimized
163
- * (DutchmanNL) Device reconnect handling improved
164
- * (DutchmanNL) [Breaking!] Change state name to default "state" for type BinarySensor / Climate / Sensor / TextSensor & Switch
165
- * (DutchmanNL) Autodiscovery improved, non-ESPHome devices excluded
166
-
167
- ### 0.1.0 (2021-02-27)
168
- * (DutchmanNL) Autodiscovery implemented
169
- * (DutchmanNL) Type Climat added
170
- * (DutchmanNL) Type TextSensor added
171
- * (DutchmanNL) Solved reconnection issues
172
- * (DutchmanNL) Optimized error messages for unknown types
173
- * (DutchmanNL & @xXBJXx) Adapter configuration page optimized
174
-
175
- ### 0.0.1
176
- * (DutchmanNL) initial release
177
-
178
139
  ## License
179
140
  MIT License
180
141
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "esphome",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "news": {
6
+ "0.3.1": {
7
+ "en": "Bugfix: Show online state of ESP Device correctly, Fixes #106",
8
+ "de": "Bugfix: Online-Zustand von ESP Device korrekt anzeigen, Fixes #106",
9
+ "ru": "Bugfix: Показать онлайн состояние ESP Device правильно, Fixes #106",
10
+ "pt": "Bugfix: Mostrar estado on-line de ESP dispositivo corretamente, correções #106",
11
+ "nl": "Bugfix: Vertoon online staat van ESP Device correct, Fixes 106",
12
+ "fr": "Bugfix: Afficher l'état en ligne de l'appareil ESP correctement, Fixes #106",
13
+ "it": "Bugfix: Mostrare lo stato online del dispositivo ESP correttamente, Fisse #106",
14
+ "es": "Bugfix: Mostrar el estado online del dispositivo ESP correctamente, Fijaciones #106",
15
+ "pl": "Bugfix: Programy internetowe ESP Device poprawnie ↓, s. 106",
16
+ "uk": "Помилки: Показати онлайн стан ESP Пристрої правильно, Виправлення #106",
17
+ "zh-cn": "Bugfix: ESP Device在线状况,Fixes #106"
18
+ },
6
19
  "0.3.0": {
7
20
  "en": "Several Bugfixes\nSupport type \"select device\"\nESPHome dashboard default disabled\nMigrate to @2colors/esphome-native-api\nAutomatically create needed directories, Fixes #168\nMigrate usage of python to new structure, should solve all ESPHome Dashboard related installation issues",
8
21
  "de": "Mehrere Bugfixes\nSupport-Typ \"Auswahlgerät\"\nESPHome Dashboard default deaktiviert\nMigration auf @2colors/esphome-native-api\nAutomatische Erstellung erforderlicher Verzeichnisse, Fixes #168\nMigration der Nutzung von Python zu neuer Struktur, sollte alle ESPHome Dashboard bezogene Installation Probleme lösen",
@@ -75,18 +88,6 @@
75
88
  "es": "Registro mejorado, resuelve [# 48] (https://github.com/DrozmotiX/ioBroker.esphome/issues/48)\nNombre de los estados cambiado, resuelve [# 49] (https://github.com/DrozmotiX/ioBroker.esphome/issues/49)",
76
89
  "pl": "Logowanie poprawione, rozwiązuje [# 48] (https://github.com/DrozmotiX/ioBroker.esphome/issues/48)\nZmiana nazwy stanów, rozwiązuje [# 49] (https://github.com/DrozmotiX/ioBroker.esphome/issues/49)",
77
90
  "zh-cn": "日志记录得到改进,解决了[#48](https://github.com/DrozmotiX/ioBroker.esphome/issues/48)\n状态名称更改,解决[#49](https://github.com/DrozmotiX/ioBroker.esphome/issues/49)"
78
- },
79
- "0.2.0": {
80
- "en": "Translations updated\nConfiguration page updated\nAdded to sentry error reporting\nNative integration of ESPHome Dashboard added",
81
- "de": "Übersetzungen aktualisiert\nKonfigurationsseite aktualisiert\nZur Sentry-Fehlerberichterstattung hinzugefügt\nNative Integration von ESPHome Dashboard hinzugefügt",
82
- "ru": "Переводы обновлены\nСтраница конфигурации обновлена\nДобавлен в отчет об ошибках караула\nДобавлена встроенная интеграция ESPHome Dashboard.",
83
- "pt": "Traduções atualizadas\nPágina de configuração atualizada\nAdicionado ao relatório de erro de sentinela\nIntegração nativa do ESPHome Dashboard adicionada",
84
- "nl": "Vertalingen bijgewerkt\nConfiguratiepagina bijgewerkt\nToegevoegd aan sentry-foutrapportage\nNative integratie van ESPHome Dashboard toegevoegd",
85
- "fr": "Traductions mises à jour\nPage de configuration mise à jour\nAjouté au rapport d'erreurs de sentinelle\nAjout de l'intégration native du tableau de bord ESPHome",
86
- "it": "Traduzioni aggiornate\nPagina di configurazione aggiornata\nAggiunto alla segnalazione degli errori di sentinella\nAggiunta integrazione nativa di ESPHome Dashboard",
87
- "es": "Traducciones actualizadas\nPágina de configuración actualizada\nAgregado al informe de errores de centinela\nSe agregó la integración nativa de ESPHome Dashboard",
88
- "pl": "Zaktualizowano tłumaczenia\nStrona konfiguracji została zaktualizowana\nDodano do raportowania błędów wartowników\nDodano natywną integrację z ESPHome Dashboard",
89
- "zh-cn": "翻译已更新\n配置页面已更新\n已添加到哨兵错误报告中\nESPHome仪表板的本机集成已添加"
90
91
  }
91
92
  },
92
93
  "title": "Control ESPHome managed devices",
package/main.js CHANGED
@@ -50,6 +50,9 @@ class Esphome extends utils.Adapter {
50
50
  reconnectInterval = this.config.reconnectInterval * 1000;
51
51
  createConfigStates = this.config.configStates;
52
52
 
53
+ // Ensure all online states are set to false during adapter start
54
+ await this.resetOnlineStates();
55
+
53
56
  // Try connecting to already known devices
54
57
  await this.tryKnownDevices();
55
58
 
@@ -116,7 +119,7 @@ class Esphome extends utils.Adapter {
116
119
  this.log.debug(`[ESPHome - Console] ${data}`);
117
120
  }
118
121
  } else {
119
- this.log.error(`[dashboardProcess ERROR] ${data}`);
122
+ console.debug(`[espHomeDashboard] Unknown logging data : ${JSON.stringify(data)}`);
120
123
  }
121
124
  });
122
125
 
@@ -285,6 +288,9 @@ class Esphome extends utils.Adapter {
285
288
  type: 'device',
286
289
  common: {
287
290
  name: deviceInfo.name,
291
+ statusStates: {
292
+ onlineId: `${this.namespace}.${deviceName}.info._online`
293
+ }
288
294
  },
289
295
  native: {
290
296
  ip: host,
@@ -907,6 +913,13 @@ class Esphome extends utils.Adapter {
907
913
  try {
908
914
  this.log.debug(JSON.stringify(this.deviceInfo));
909
915
  for (const device in this.deviceInfo) {
916
+
917
+ // Ensure all known online states are set to false
918
+ if (this.deviceInfo[device].mac != null) {
919
+ const deviceName = this.replaceAll(this.deviceInfo[device].mac, `:`, ``);
920
+ this.setState(`${deviceName}.info._online`, {val: false, ack: true});
921
+ }
922
+
910
923
  try {
911
924
  client[device].disconnect();
912
925
  } catch (e) {
@@ -1153,6 +1166,38 @@ class Esphome extends utils.Adapter {
1153
1166
  }
1154
1167
  }
1155
1168
  }
1169
+
1170
+ async resetOnlineStates(){
1171
+ try {
1172
+ // Set parameters for object view to only include objects within adapter namespace
1173
+ const params = {
1174
+ startkey : `${this.namespace}.`,
1175
+ endkey : `${this.namespace}.\u9999`,
1176
+ };
1177
+
1178
+ // Get all current devices in adapter tree
1179
+ const _devices = await this.getObjectViewAsync('system', 'device', params);
1180
+ // List all found devices & set online state to false
1181
+ for (const currDevice in _devices.rows) {
1182
+
1183
+ // Extend online state to device (to ensure migration of version < 0.3.1
1184
+ await this.extendObjectAsync(_devices.rows[currDevice].id, {
1185
+ common: {
1186
+ statusStates: {
1187
+ onlineId: `${_devices.rows[currDevice].id}.info._online`
1188
+ }
1189
+ },
1190
+ });
1191
+
1192
+ // Set online state to false, will be set to true at successfully connected
1193
+ this.setState(`${_devices.rows[currDevice].id}.info._online`, {val: false, ack: true});
1194
+ }
1195
+
1196
+ } catch (e) {
1197
+ this.log.error(`[resetOnlineState] ${e}`);
1198
+ }
1199
+ }
1200
+
1156
1201
  }
1157
1202
 
1158
1203
  if (require.main !== module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.esphome",
3
- "version": "0.3.0",
3
+ "version": "0.3.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",