iobroker.pv-notifications 1.0.99 → 1.1.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/README.md +5 -6
- package/io-package.json +1 -1
- package/main.js +20 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -339,15 +339,14 @@ sadam6752@gmail.com
|
|
|
339
339
|
### **WORK IN PROGRESS**
|
|
340
340
|
-->
|
|
341
341
|
|
|
342
|
-
### 1.0
|
|
342
|
+
### 1.1.0 (2026-03-01)
|
|
343
343
|
|
|
344
|
-
* (FIX)
|
|
345
|
-
* (FIX)
|
|
346
|
-
* (ADD) User can freely configure send time for weekly/monthly stats via statsWeekDay, statsWeekTime, monthlyStatsDay, monthlyStatsTime
|
|
344
|
+
* (FIX) buildFullMessage() and buildEmptyMessage() now read from INTERNAL states (statistics.currentPower, etc.) instead of external config states
|
|
345
|
+
* (FIX) buildFullMessage() and buildEmptyMessage() converted to async functions with await
|
|
347
346
|
|
|
348
|
-
### 1.0.
|
|
347
|
+
### 1.0.99 (2026-03-01)
|
|
349
348
|
|
|
350
|
-
* (FIX) Weekly
|
|
349
|
+
* (FIX) Weekly stats auto-saved every Sunday at 23:55 (before sourceanalytix reset at 00:00)
|
|
351
350
|
|
|
352
351
|
### 1.0.93 (2026-02-27)
|
|
353
352
|
|
package/io-package.json
CHANGED
package/main.js
CHANGED
|
@@ -639,7 +639,7 @@ class PvNotifications extends utils.Adapter {
|
|
|
639
639
|
const allowNotification = (!nightTime || !nightModeActive) && (!quietTime || !quietModeActive);
|
|
640
640
|
|
|
641
641
|
if (allowNotification && !this.status.full && this.canNotify('full')) {
|
|
642
|
-
const message = this.buildFullMessage(soc);
|
|
642
|
+
const message = await this.buildFullMessage(soc);
|
|
643
643
|
this.sendTelegram(message, 'high');
|
|
644
644
|
this.status.full = true;
|
|
645
645
|
this.status.lastNotification.full = Date.now();
|
|
@@ -668,7 +668,7 @@ class PvNotifications extends utils.Adapter {
|
|
|
668
668
|
const blockedByQuietTime = quietTime && quietModeActive;
|
|
669
669
|
|
|
670
670
|
if (allowEmptyNotification && !blockedByQuietTime) {
|
|
671
|
-
const message = this.buildEmptyMessage(soc);
|
|
671
|
+
const message = await this.buildEmptyMessage(soc);
|
|
672
672
|
this.sendTelegram(message, 'high');
|
|
673
673
|
this.status.empty = true;
|
|
674
674
|
this.status.lastNotification.empty = Date.now();
|
|
@@ -852,11 +852,17 @@ class PvNotifications extends utils.Adapter {
|
|
|
852
852
|
*
|
|
853
853
|
* @param {number} soc - Battery state of charge in percent
|
|
854
854
|
*/
|
|
855
|
-
buildFullMessage(soc) {
|
|
856
|
-
|
|
857
|
-
const
|
|
858
|
-
const
|
|
859
|
-
const
|
|
855
|
+
async buildFullMessage(soc) {
|
|
856
|
+
// Werte aus INTERNEN States lesen (aktualisiert in Echtzeit durch onStateChange)
|
|
857
|
+
const powerState = await this.getStateAsync('statistics.currentPower');
|
|
858
|
+
const totalProdState = await this.getStateAsync('statistics.currentTotalProduction');
|
|
859
|
+
const feedInState = await this.getStateAsync('statistics.currentFeedIn');
|
|
860
|
+
const consumptionState = await this.getStateAsync('statistics.currentConsumption');
|
|
861
|
+
|
|
862
|
+
const power = powerState && powerState.val !== null ? powerState.val : 0;
|
|
863
|
+
const totalProd = totalProdState && totalProdState.val !== null ? totalProdState.val : 0;
|
|
864
|
+
const feedIn = feedInState && feedInState.val !== null ? feedInState.val : 0;
|
|
865
|
+
const consumption = consumptionState && consumptionState.val !== null ? consumptionState.val : 0;
|
|
860
866
|
|
|
861
867
|
let message = `🔋 *${this.translate('Battery full')}* (${soc}%)
|
|
862
868
|
|
|
@@ -900,9 +906,13 @@ class PvNotifications extends utils.Adapter {
|
|
|
900
906
|
*
|
|
901
907
|
* @param {number} soc - Battery state of charge in percent
|
|
902
908
|
*/
|
|
903
|
-
buildEmptyMessage(soc) {
|
|
904
|
-
|
|
905
|
-
const
|
|
909
|
+
async buildEmptyMessage(soc) {
|
|
910
|
+
// Werte aus INTERNEN States lesen (aktualisiert in Echtzeit durch onStateChange)
|
|
911
|
+
const gridPowerState = await this.getStateAsync('statistics.currentGridPower');
|
|
912
|
+
const consumptionState = await this.getStateAsync('statistics.currentConsumption');
|
|
913
|
+
|
|
914
|
+
const gridPower = gridPowerState && gridPowerState.val !== null ? gridPowerState.val : 0;
|
|
915
|
+
const consumption = consumptionState && consumptionState.val !== null ? consumptionState.val : 0;
|
|
906
916
|
|
|
907
917
|
let message = `🔋 *${this.translate('Battery empty')}* (${soc}%)
|
|
908
918
|
|