iobroker.weathersense 3.0.3 → 4.0.0

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 Daniel Luginbühl <webmaster@ltspiceusers.ch>
3
+ Copyright (c) 2025-2026 Daniel Luginbühl <webmaster@ltspiceusers.ch>
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
@@ -19,10 +19,12 @@ See: https://play.google.com/store/apps/details?id=com.emax.weahter&hl=de_CH
19
19
 
20
20
  Some WiFi weather stations use the WeatherSense Cloud.
21
21
 
22
- For example, this WiFi weather station from Ideoon (Pearl):
22
+ For example, this WiFi weather stations from Ideoon (Pearl):
23
23
 
24
24
  ![Screenshot](https://github.com/ltspicer/WeatherSense/blob/main/wetterstation.png)
25
25
 
26
+ ![Screenshot](https://github.com/ltspicer/WeatherSense/blob/main/casativo_ideoon_weatherstation.png)
27
+
26
28
  ## Use:
27
29
 
28
30
  Simply enter your WeatherSense account login details (email and password).
@@ -30,6 +32,11 @@ The weather station data is stored in the weathersense data point.
30
32
  The data can also be sent via MQTT.
31
33
 
32
34
  ## Changelog
35
+ ### 4.0.0 (2026-01-23)
36
+
37
+ - "All status OK" flag added
38
+ - MQTT topic changed from WEATHERSENSE to WeatherSense
39
+
33
40
  ### 3.0.3 (2025-09-14)
34
41
 
35
42
  - eslint-config & testing version updated
@@ -75,7 +82,7 @@ The data can also be sent via MQTT.
75
82
 
76
83
  MIT License
77
84
 
78
- Copyright (c) 2025 Daniel Luginbühl <webmaster@ltspiceusers.ch>
85
+ Copyright (c) 2025-2026 Daniel Luginbühl <webmaster@ltspiceusers.ch>
79
86
 
80
87
  Permission is hereby granted, free of charge, to any person obtaining a copy
81
88
  of this software and associated documentation files (the "Software"), to deal
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "weathersense",
4
- "version": "3.0.3",
4
+ "version": "4.0.0",
5
5
  "news": {
6
+ "4.0.0": {
7
+ "en": "\"All status OK\" flag added\nMQTT topic changed from WEATHERSENSE to WeatherSense",
8
+ "de": "\"All status OK\"-Flag hinzugefügt\nMQTT-Thema von WEATHERSENSE zu WeatherSense geändert",
9
+ "ru": "Флаг «All Status OK»\nТема MQTT изменилась с WEATHERSENSE на WeatherSense",
10
+ "pt": "Bandeira \"Todos os status OK\" adicionada\nO tópico MQTT mudou de Weathersense para WeatherSense",
11
+ "nl": "\"Alle status OK\" vlag toegevoegd\nMQTT onderwerp veranderd van WEERSENSE naar WeerSense",
12
+ "fr": "\"Tout le statut OK\" drapeau ajouté\nMQTT sujet changé de WEATHERSENSE à WeatherSense",
13
+ "it": "\"Tutto lo stato OK\" bandiera aggiunto\nL'argomento MQTT è cambiato da WEATHERSENSE a WeatherSense",
14
+ "es": "\"Todo el estado OK\" bandera\nTema MQTT cambió de WEATHERSENSE a WeatherSense",
15
+ "pl": "Dodano flagę \"All status OK\"\nTemat MQTT zmienił się z WEATHERSENSE na WeatherSense",
16
+ "uk": "\"Весь статус OK\" додано прапор\nТема MQTT змінилася з WEATHERSENSE до погоди",
17
+ "zh-cn": "添加了“ 所有状态确定” 标记\nMQTT 主题从 WEATHERSENSE 改为天气感"
18
+ },
6
19
  "3.0.3": {
7
20
  "en": "eslint-config & testing version updated",
8
21
  "de": "eslint-Konfiguration und Testversion aktualisiert",
@@ -80,19 +93,6 @@
80
93
  "pl": "Więcej danych\nTyp czyszczenia i wyjście kanału",
81
94
  "uk": "Більше даних\nТип очищення та вихід каналу",
82
95
  "zh-cn": "更多数据输出\n清洁类型和频道输出( T)"
83
- },
84
- "1.0.3": {
85
- "en": "Delay with different syntax",
86
- "de": "Verzögerung mit unterschiedlicher Syntax",
87
- "ru": "Задержка с разным синтаксисом",
88
- "pt": "Atrasar com sintaxe diferente",
89
- "nl": "Vertraging met verschillende syntaxis",
90
- "fr": "Retard avec une syntaxe différente",
91
- "it": "Delay con sintassi diversa",
92
- "es": "Delay con diferentes sintaxis",
93
- "pl": "Opóźnienie z inną składnią",
94
- "uk": "Делей з різними синтаксисом",
95
- "zh-cn": "不同语法的延迟"
96
96
  }
97
97
  },
98
98
  "titleLang": {
package/main.js CHANGED
@@ -110,6 +110,19 @@ class WeatherSense extends utils.Adapter {
110
110
 
111
111
  const deviceId = `${this.namespace}.${sensor_id}`;
112
112
 
113
+ const allStatesOkId = `${deviceId}.allStatesOk`;
114
+ await this.setObjectNotExistsAsync(allStatesOkId, {
115
+ type: 'state',
116
+ common: {
117
+ name: 'All states ok',
118
+ type: 'boolean',
119
+ role: 'indicator',
120
+ read: true,
121
+ write: false,
122
+ },
123
+ native: {},
124
+ });
125
+
113
126
  try {
114
127
  const mainResult = await this.main(
115
128
  client,
@@ -170,6 +183,9 @@ class WeatherSense extends utils.Adapter {
170
183
 
171
184
  // Alle Werte aus devdata.content
172
185
  const content = devdata.content || {};
186
+
187
+ let status = await this.isSuccess(devdata);
188
+
173
189
  for (const [key, value] of Object.entries(content)) {
174
190
  if (value !== null && value !== undefined && key !== 'sensorDatas') {
175
191
  const id = `${devDataChannelId}.${key}`;
@@ -308,9 +324,11 @@ class WeatherSense extends utils.Adapter {
308
324
  }
309
325
  }
310
326
  }
327
+ await this.setStateAsync(allStatesOkId, { val: status, ack: true });
311
328
  } else {
312
329
  this.log.error('Error loading data in main()');
313
330
  await this.setStateAsync(systemStateId, { val: false, ack: true });
331
+ await this.setStateAsync(allStatesOkId, { val: false, ack: true });
314
332
  }
315
333
  } catch (error) {
316
334
  this.log.error(`Unexpected error in onReady(): ${error.message}`);
@@ -324,13 +342,42 @@ class WeatherSense extends utils.Adapter {
324
342
  }
325
343
  }
326
344
 
345
+ // Alle Statuswerte ok?
346
+ async isSuccess(data) {
347
+ try {
348
+ if (data.status !== 0) {
349
+ this.log.warn(`status: ${data.status}`);
350
+ return false;
351
+ }
352
+
353
+ if (data.error !== 0) {
354
+ this.log.warn(`error: ${data.error}`);
355
+ return false;
356
+ }
357
+
358
+ if (data.message !== 'success') {
359
+ this.log.warn(`message: ${data.message}`);
360
+ return false;
361
+ }
362
+
363
+ if (data.content?.powerStatus === 0) {
364
+ this.log.warn(`content/powerStatus: ${data.content.powerStatus}`);
365
+ return false;
366
+ }
367
+
368
+ return true;
369
+ } catch {
370
+ return false;
371
+ }
372
+ }
373
+
327
374
  // MQTT senden
328
375
  async sendMqtt(sensor_id, mqtt_active, client, topic, wert) {
329
376
  if (mqtt_active) {
330
377
  if (typeof wert !== 'string') {
331
378
  wert = wert !== null && wert !== undefined ? wert.toString() : '';
332
379
  }
333
- client.publish(`WEATHERSENSE/${sensor_id.toString()}/${topic}`, wert);
380
+ client.publish(`WeatherSense/${sensor_id.toString()}/${topic}`, wert);
334
381
  }
335
382
  }
336
383
 
@@ -571,9 +618,10 @@ class WeatherSense extends utils.Adapter {
571
618
  this.log.error('No token received');
572
619
  if (mqtt_active) {
573
620
  await this.sendMqtt(sensor_id, mqtt_active, client, 'dataReceived', 'false');
621
+ await this.sendMqtt(sensor_id, mqtt_active, client, 'allStatesOk', 'false');
574
622
  client.end();
575
623
  }
576
- return false;
624
+ return { dataReceived: false };
577
625
  }
578
626
  const devdata = await this.devData(token);
579
627
  const forecast = await this.foreCast(token);
@@ -581,6 +629,7 @@ class WeatherSense extends utils.Adapter {
581
629
  this.log.error('No data received');
582
630
  if (mqtt_active) {
583
631
  await this.sendMqtt(sensor_id, mqtt_active, client, 'dataReceived', 'false');
632
+ await this.sendMqtt(sensor_id, mqtt_active, client, 'allStatesOk', 'false');
584
633
  client.end();
585
634
  }
586
635
  return { dataReceived: false };
@@ -592,9 +641,10 @@ class WeatherSense extends utils.Adapter {
592
641
  fs.writeFileSync(path.join(storeDir, 'devData.json'), json_object, 'utf-8');
593
642
  }
594
643
 
595
- this.log.debug('devData JSON:');
596
644
  this.printAllKeys(devdata);
597
645
 
646
+ let status = await this.isSuccess(devdata);
647
+
598
648
  if (mqtt_active) {
599
649
  for (const [key, value] of Object.entries(devdata)) {
600
650
  if (key === 'content') {
@@ -681,6 +731,10 @@ class WeatherSense extends utils.Adapter {
681
731
 
682
732
  this.printAllKeys(forecast);
683
733
 
734
+ if (status) {
735
+ status = await this.isSuccess(forecast);
736
+ }
737
+
684
738
  const forecasts = forecast?.content?.forecast?.forecasts || [];
685
739
 
686
740
  if (mqtt_active) {
@@ -689,12 +743,17 @@ class WeatherSense extends utils.Adapter {
689
743
 
690
744
  await this.sendForecasts(client, forecasts, celsius, sensor_id);
691
745
 
746
+ await this.sendMqtt(sensor_id, mqtt_active, client, 'allStatesOk', status);
747
+
692
748
  client.end(); // wie client.disconnect()
693
749
  }
694
750
 
695
751
  await this.createOrUpdateForecastDPs(forecastChannelId, forecasts, celsius);
696
752
 
753
+ this.log.debug(`allStatesOk: ${status}`);
754
+
697
755
  return {
756
+ allStatesOk: true,
698
757
  dataReceived: true,
699
758
  devdata,
700
759
  forecast,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.weathersense",
3
- "version": "3.0.3",
3
+ "version": "4.0.0",
4
4
  "description": "Read in data from WeatherSense",
5
5
  "author": {
6
6
  "name": "Daniel Luginbühl",
@@ -24,24 +24,18 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@iobroker/adapter-core": "^3.3.2",
27
- "axios": "^1.10.0",
28
- "mqtt": "^5.14.0"
27
+ "axios": "^1.13.2",
28
+ "mqtt": "^5.14.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@alcalzone/release-script": "^3.8.0",
32
- "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
33
- "@alcalzone/release-script-plugin-license": "^3.7.0",
34
- "@alcalzone/release-script-plugin-manual-review": "^3.7.0",
35
- "@iobroker/adapter-dev": "^1.4.0",
36
- "@iobroker/dev-server": "^0.7.8",
37
- "@iobroker/eslint-config": "^2.1.0",
38
- "@iobroker/testing": "^5.1.1",
39
- "chai": "^4.5.0",
40
- "chai-as-promised": "^8.0.1",
41
- "mocha": "^11.5.0",
42
- "proxyquire": "^2.1.3",
43
- "sinon": "^21.0.0",
44
- "sinon-chai": "^3.7.0"
31
+ "@alcalzone/release-script": "^5.0.0",
32
+ "@alcalzone/release-script-plugin-iobroker": "^4.0.0",
33
+ "@alcalzone/release-script-plugin-license": "^4.0.0",
34
+ "@alcalzone/release-script-plugin-manual-review": "^4.0.0",
35
+ "@iobroker/adapter-dev": "^1.5.0",
36
+ "@iobroker/dev-server": "^0.8.0",
37
+ "@iobroker/eslint-config": "^2.2.0",
38
+ "@iobroker/testing": "^5.1.1"
45
39
  },
46
40
  "main": "main.js",
47
41
  "files": [