iobroker.sigenergy 3.0.3 → 3.0.4

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 CHANGED
@@ -245,6 +245,9 @@ Status and power readings for the DC charger.
245
245
 
246
246
  ## Changelog
247
247
 
248
+ ### 3.0.4 (2026-06-14)
249
+ - (ssbingo) fix: emergency Telegram notification now sent only once per grid-failure event (not repeated every poll); device switching limited to 3 attempts max (initial + 2 retries) while off-grid
250
+
248
251
  ### 3.0.3 (2026-06-13)
249
252
  - (ssbingo) fix: remove non-functional welcomeText from io-package.json; add visible warning staticText in Emergency Switching config tab (yellow box, i18n in all 11 languages)
250
253
 
package/io-package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sigenergy",
4
- "version": "3.0.3",
4
+ "version": "3.0.4",
5
5
  "news": {
6
- "3.0.3": {
6
+ "3.0.4": {
7
7
  "en": "(ssbingo) feat: emergency gateway switching — automatic disconnection of external PV systems on grid failure; configurable stability timer; optional Telegram notifications",
8
8
  "de": "(ssbingo) Neu: Notabschaltung — automatische Trennung externer PV-Systeme bei Netzausfall; konfigurierbarer Stabilisierungs-Timer; optionale Telegram-Benachrichtigungen",
9
9
  "ru": "(ssbingo) Новое: аварийное отключение — автоматическое отключение внешних ФЭ-систем при пропадании сети; таймер стабилизации; уведомления Telegram",
package/main.js CHANGED
@@ -136,6 +136,7 @@ class Sigenergy extends utils.Adapter {
136
136
  this._protocolDetected = false;
137
137
  this._emergencyWasOffGrid = false;
138
138
  this._emergencyStabilityTimer = null;
139
+ this._emergencySwitchCount = 0;
139
140
  this._protoDetectWarnLogged = false;
140
141
  this._modelVerified = false;
141
142
  this._pvStringCount = 0;
@@ -2175,12 +2176,14 @@ class Sigenergy extends utils.Adapter {
2175
2176
  this.log.info(`[emergency] Initial onOffGridStatus: ${val} (${this._emergencyModeName(val)})`);
2176
2177
  if (isOff) {
2177
2178
  this._emergencyWasOffGrid = true;
2179
+ this._emergencySwitchCount = 1;
2178
2180
  this.log.warn(`[emergency] System already off-grid at start — switching emergency devices`);
2179
2181
  await this._emergencySwitchAll(true);
2180
2182
  await this._emergencySendTelegram(
2181
2183
  `⚠️ Sigenergy — Grid failure\n\nMode: ${this._emergencyModeName(val)}\nEmergency devices switched.\n\n🕐 ${new Date().toLocaleString()}`,
2182
2184
  );
2183
2185
  } else {
2186
+ this._emergencySwitchCount = 0;
2184
2187
  this.log.info('[emergency] System on-grid at start — restoring emergency devices');
2185
2188
  await this._emergencySwitchAll(false);
2186
2189
  }
@@ -2195,17 +2198,29 @@ class Sigenergy extends utils.Adapter {
2195
2198
  const isOff = this._emergencyIsOffGrid(val);
2196
2199
 
2197
2200
  if (isOff) {
2198
- if (!this._emergencyWasOffGrid) {
2201
+ const wasAlreadyOff = this._emergencyWasOffGrid;
2202
+ this._emergencyWasOffGrid = true;
2203
+ this._emergencyCancelTimer();
2204
+ if (!wasAlreadyOff) {
2205
+ // First transition on→off-grid: switch immediately, send Telegram once
2199
2206
  this.log.warn(
2200
2207
  `[emergency] Off-grid detected: ${this._emergencyModeName(val)} — switching emergency devices`,
2201
2208
  );
2209
+ this._emergencySwitchCount = 1;
2210
+ await this._emergencySwitchAll(true);
2211
+ await this._emergencySendTelegram(
2212
+ `⚠️ Sigenergy — Grid failure\n\nMode: ${this._emergencyModeName(val)}\nEmergency devices switched.\n\n🕐 ${new Date().toLocaleString()}`,
2213
+ );
2214
+ } else if (this._emergencySwitchCount < 3) {
2215
+ // Still off-grid on subsequent polls: retry switch, max 2 retries (3 total)
2216
+ this._emergencySwitchCount++;
2217
+ this.log.info(
2218
+ `[emergency] Still off-grid — retry device switch (attempt ${this._emergencySwitchCount}/3)`,
2219
+ );
2220
+ await this._emergencySwitchAll(true);
2221
+ } else {
2222
+ this.log.debug('[emergency] Still off-grid — max switch attempts reached, skipping');
2202
2223
  }
2203
- this._emergencyWasOffGrid = true;
2204
- this._emergencyCancelTimer();
2205
- await this._emergencySwitchAll(true);
2206
- await this._emergencySendTelegram(
2207
- `⚠️ Sigenergy — Grid failure\n\nMode: ${this._emergencyModeName(val)}\nEmergency devices switched.\n\n🕐 ${new Date().toLocaleString()}`,
2208
- );
2209
2224
  } else {
2210
2225
  if (!this._emergencyWasOffGrid) {
2211
2226
  return;
@@ -2225,6 +2240,7 @@ class Sigenergy extends utils.Adapter {
2225
2240
  if (current && !this._emergencyIsOffGrid(current.val)) {
2226
2241
  this.log.info(`[emergency] ${delayMin} min stable — restoring all emergency devices`);
2227
2242
  this._emergencyWasOffGrid = false;
2243
+ this._emergencySwitchCount = 0;
2228
2244
  await this._emergencySwitchAll(false);
2229
2245
  await this._emergencySendTelegram(
2230
2246
  `✅ Sigenergy — Grid stable\n\nGrid has been stable for ${delayMin} minutes.\nAll emergency devices restored.\n\n🕐 ${new Date().toLocaleString()}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sigenergy",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "ioBroker adapter for Sigenergy solar energy systems via Modbus TCP/RTU",
5
5
  "author": {
6
6
  "name": "ssbingo",
@@ -37,7 +37,7 @@
37
37
  "@iobroker/eslint-config": "^2.3.4",
38
38
  "@iobroker/testing": "^5.2.2",
39
39
  "@tsconfig/node22": "^22.0.5",
40
- "@types/node": "^22.0.0"
40
+ "@types/node": "^22.19.20"
41
41
  },
42
42
  "main": "main.js",
43
43
  "files": [