iobroker.zendure-solarflow 1.8.8 → 1.9.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.
@@ -37,6 +37,7 @@ const updateSolarFlowControlState = async (adapter, productKey, deviceKey, state
37
37
  ));
38
38
  };
39
39
  const checkVoltage = async (adapter, productKey, deviceKey, voltage) => {
40
+ var _a;
40
41
  if (voltage < 46.1) {
41
42
  if (adapter.config.useCalculation) {
42
43
  (0, import_calculationService.setSocToZero)(adapter, productKey, deviceKey);
@@ -48,6 +49,27 @@ const checkVoltage = async (adapter, productKey, deviceKey, voltage) => {
48
49
  true
49
50
  ));
50
51
  (0, import_mqttService.setOutputLimit)(adapter, productKey, deviceKey, 0);
52
+ if (adapter.config.forceShutdownOnLowVoltage) {
53
+ const currentSoc = await adapter.getStateAsync(
54
+ `${productKey}.${deviceKey}.electricLevel`
55
+ );
56
+ if (currentSoc && currentSoc.val) {
57
+ (0, import_mqttService.setDischargeLimit)(
58
+ adapter,
59
+ productKey,
60
+ deviceKey,
61
+ Number(currentSoc.val)
62
+ );
63
+ }
64
+ const hubState = await adapter.getStateAsync(
65
+ `${productKey}.${deviceKey}.hubState`
66
+ );
67
+ if (!hubState || ((_a = hubState.val) == null ? void 0 : _a.toString()) != "Stop output and shut down") {
68
+ adapter.log.warn(
69
+ `[checkVoltage] hubState is not set to 'Stop output and shut down', device will NOT go offline!`
70
+ );
71
+ }
72
+ }
51
73
  }
52
74
  } else if (voltage >= 47.5) {
53
75
  if (adapter.config.useLowVoltageBlock) {
@@ -56,6 +78,12 @@ const checkVoltage = async (adapter, productKey, deviceKey, voltage) => {
56
78
  false,
57
79
  true
58
80
  ));
81
+ (0, import_mqttService.setDischargeLimit)(
82
+ adapter,
83
+ productKey,
84
+ deviceKey,
85
+ adapter.config.dischargeLimit ? adapter.config.dischargeLimit : 10
86
+ );
59
87
  }
60
88
  }
61
89
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/services/adapterService.ts"],
4
- "sourcesContent": ["import { ZendureSolarflow } from \"../main\";\r\nimport { setSocToZero } from \"./calculationService\";\r\nimport { setOutputLimit } from \"./mqttService\";\r\n\r\n/* eslint-disable @typescript-eslint/indent */\r\n\r\nexport const updateSolarFlowState = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n state: string,\r\n val: number | string | boolean\r\n): Promise<void> => {\r\n await adapter?.setState(`${productKey}.${deviceKey}.${state}`, val, true);\r\n};\r\n\r\nexport const updateSolarFlowControlState = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n state: string,\r\n val: number | string | boolean\r\n): Promise<void> => {\r\n await adapter?.setState(\r\n `${productKey}.${deviceKey}.control.${state}`,\r\n val,\r\n true\r\n );\r\n};\r\n\r\nexport const checkVoltage = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n voltage: number\r\n): Promise<void> => {\r\n if (voltage < 46.1) {\r\n if (adapter.config.useCalculation) {\r\n setSocToZero(adapter, productKey, deviceKey);\r\n }\r\n\r\n if (adapter.config.useLowVoltageBlock) {\r\n // Activate Low Voltage Block\r\n await adapter?.setState(\r\n `${productKey}.${deviceKey}.control.lowVoltageBlock`,\r\n true,\r\n true\r\n );\r\n\r\n // Low Voltage Block activated, stop power input immediately\r\n setOutputLimit(adapter, productKey, deviceKey, 0);\r\n }\r\n } else if (voltage >= 47.5) {\r\n if (adapter.config.useLowVoltageBlock) {\r\n // Deactivate Low Voltage Block\r\n await adapter?.setState(\r\n `${productKey}.${deviceKey}.control.lowVoltageBlock`,\r\n false,\r\n true\r\n );\r\n }\r\n }\r\n};\r\n\r\nexport const checkDevicesServer = async (\r\n adapter: ZendureSolarflow\r\n): Promise<void> => {\r\n const channels = await adapter.getChannelsAsync();\r\n\r\n channels.forEach(async (channel) => {\r\n if (channel._id) {\r\n const splitted = channel._id.split(\".\");\r\n if (splitted.length == 4) {\r\n const productKey = splitted[2];\r\n const deviceKey = splitted[3];\r\n\r\n const currentServerState = await adapter.getStateAsync(\r\n `${productKey}.${deviceKey}.registeredServer`\r\n );\r\n\r\n if (\r\n currentServerState &&\r\n currentServerState.val &&\r\n currentServerState.val != adapter.config.server\r\n ) {\r\n adapter.log.warn(\r\n `Device with ProductKey '${productKey}' and DeviceKey '${deviceKey}' was configured on server '${currentServerState.val}', but adapter is configured to use server '${adapter.config.server}'! No data will be available!`\r\n );\r\n }\r\n }\r\n }\r\n });\r\n};\r\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAA6B;AAC7B,yBAA+B;AAIxB,MAAM,uBAAuB,OAClC,SACA,YACA,WACA,OACA,QACkB;AAClB,SAAM,mCAAS,SAAS,GAAG,UAAU,IAAI,SAAS,IAAI,KAAK,IAAI,KAAK;AACtE;AAEO,MAAM,8BAA8B,OACzC,SACA,YACA,WACA,OACA,QACkB;AAClB,SAAM,mCAAS;AAAA,IACb,GAAG,UAAU,IAAI,SAAS,YAAY,KAAK;AAAA,IAC3C;AAAA,IACA;AAAA;AAEJ;AAEO,MAAM,eAAe,OAC1B,SACA,YACA,WACA,YACkB;AAClB,MAAI,UAAU,MAAM;AAClB,QAAI,QAAQ,OAAO,gBAAgB;AACjC,kDAAa,SAAS,YAAY,SAAS;AAAA,IAC7C;AAEA,QAAI,QAAQ,OAAO,oBAAoB;AAErC,aAAM,mCAAS;AAAA,QACb,GAAG,UAAU,IAAI,SAAS;AAAA,QAC1B;AAAA,QACA;AAAA;AAIF,6CAAe,SAAS,YAAY,WAAW,CAAC;AAAA,IAClD;AAAA,EACF,WAAW,WAAW,MAAM;AAC1B,QAAI,QAAQ,OAAO,oBAAoB;AAErC,aAAM,mCAAS;AAAA,QACb,GAAG,UAAU,IAAI,SAAS;AAAA,QAC1B;AAAA,QACA;AAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEO,MAAM,qBAAqB,OAChC,YACkB;AAClB,QAAM,WAAW,MAAM,QAAQ,iBAAiB;AAEhD,WAAS,QAAQ,OAAO,YAAY;AAClC,QAAI,QAAQ,KAAK;AACf,YAAM,WAAW,QAAQ,IAAI,MAAM,GAAG;AACtC,UAAI,SAAS,UAAU,GAAG;AACxB,cAAM,aAAa,SAAS,CAAC;AAC7B,cAAM,YAAY,SAAS,CAAC;AAE5B,cAAM,qBAAqB,MAAM,QAAQ;AAAA,UACvC,GAAG,UAAU,IAAI,SAAS;AAAA,QAC5B;AAEA,YACE,sBACA,mBAAmB,OACnB,mBAAmB,OAAO,QAAQ,OAAO,QACzC;AACA,kBAAQ,IAAI;AAAA,YACV,2BAA2B,UAAU,oBAAoB,SAAS,+BAA+B,mBAAmB,GAAG,+CAA+C,QAAQ,OAAO,MAAM;AAAA,UAC7L;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
4
+ "sourcesContent": ["import { ZendureSolarflow } from \"../main\";\r\nimport { setSocToZero } from \"./calculationService\";\r\nimport { setDischargeLimit, setOutputLimit } from \"./mqttService\";\r\n\r\n/* eslint-disable @typescript-eslint/indent */\r\n\r\nexport const updateSolarFlowState = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n state: string,\r\n val: number | string | boolean\r\n): Promise<void> => {\r\n await adapter?.setState(`${productKey}.${deviceKey}.${state}`, val, true);\r\n};\r\n\r\nexport const updateSolarFlowControlState = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n state: string,\r\n val: number | string | boolean\r\n): Promise<void> => {\r\n await adapter?.setState(\r\n `${productKey}.${deviceKey}.control.${state}`,\r\n val,\r\n true\r\n );\r\n};\r\n\r\nexport const checkVoltage = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n voltage: number\r\n): Promise<void> => {\r\n if (voltage < 46.1) {\r\n if (adapter.config.useCalculation) {\r\n setSocToZero(adapter, productKey, deviceKey);\r\n }\r\n\r\n if (adapter.config.useLowVoltageBlock) {\r\n // Activate Low Voltage Block\r\n await adapter?.setState(\r\n `${productKey}.${deviceKey}.control.lowVoltageBlock`,\r\n true,\r\n true\r\n );\r\n\r\n // Low Voltage Block activated, stop power input immediately\r\n setOutputLimit(adapter, productKey, deviceKey, 0);\r\n\r\n if (adapter.config.forceShutdownOnLowVoltage) {\r\n const currentSoc = await adapter.getStateAsync(\r\n `${productKey}.${deviceKey}.electricLevel`\r\n );\r\n\r\n if (currentSoc && currentSoc.val) {\r\n setDischargeLimit(\r\n adapter,\r\n productKey,\r\n deviceKey,\r\n Number(currentSoc.val)\r\n );\r\n }\r\n\r\n // Check if device setting is correct\r\n const hubState = await adapter.getStateAsync(\r\n `${productKey}.${deviceKey}.hubState`\r\n );\r\n\r\n if (\r\n !hubState ||\r\n hubState.val?.toString() != \"Stop output and shut down\"\r\n ) {\r\n adapter.log.warn(\r\n `[checkVoltage] hubState is not set to 'Stop output and shut down', device will NOT go offline!`\r\n );\r\n }\r\n }\r\n }\r\n } else if (voltage >= 47.5) {\r\n if (adapter.config.useLowVoltageBlock) {\r\n // Deactivate Low Voltage Block\r\n await adapter?.setState(\r\n `${productKey}.${deviceKey}.control.lowVoltageBlock`,\r\n false,\r\n true\r\n );\r\n\r\n setDischargeLimit(\r\n adapter,\r\n productKey,\r\n deviceKey,\r\n adapter.config.dischargeLimit ? adapter.config.dischargeLimit : 10\r\n );\r\n }\r\n }\r\n};\r\n\r\nexport const checkDevicesServer = async (\r\n adapter: ZendureSolarflow\r\n): Promise<void> => {\r\n const channels = await adapter.getChannelsAsync();\r\n\r\n channels.forEach(async (channel) => {\r\n if (channel._id) {\r\n const splitted = channel._id.split(\".\");\r\n if (splitted.length == 4) {\r\n const productKey = splitted[2];\r\n const deviceKey = splitted[3];\r\n\r\n const currentServerState = await adapter.getStateAsync(\r\n `${productKey}.${deviceKey}.registeredServer`\r\n );\r\n\r\n if (\r\n currentServerState &&\r\n currentServerState.val &&\r\n currentServerState.val != adapter.config.server\r\n ) {\r\n adapter.log.warn(\r\n `Device with ProductKey '${productKey}' and DeviceKey '${deviceKey}' was configured on server '${currentServerState.val}', but adapter is configured to use server '${adapter.config.server}'! No data will be available!`\r\n );\r\n }\r\n }\r\n }\r\n });\r\n};\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAA6B;AAC7B,yBAAkD;AAI3C,MAAM,uBAAuB,OAClC,SACA,YACA,WACA,OACA,QACkB;AAClB,SAAM,mCAAS,SAAS,GAAG,UAAU,IAAI,SAAS,IAAI,KAAK,IAAI,KAAK;AACtE;AAEO,MAAM,8BAA8B,OACzC,SACA,YACA,WACA,OACA,QACkB;AAClB,SAAM,mCAAS;AAAA,IACb,GAAG,UAAU,IAAI,SAAS,YAAY,KAAK;AAAA,IAC3C;AAAA,IACA;AAAA;AAEJ;AAEO,MAAM,eAAe,OAC1B,SACA,YACA,WACA,YACkB;AAnCpB;AAoCE,MAAI,UAAU,MAAM;AAClB,QAAI,QAAQ,OAAO,gBAAgB;AACjC,kDAAa,SAAS,YAAY,SAAS;AAAA,IAC7C;AAEA,QAAI,QAAQ,OAAO,oBAAoB;AAErC,aAAM,mCAAS;AAAA,QACb,GAAG,UAAU,IAAI,SAAS;AAAA,QAC1B;AAAA,QACA;AAAA;AAIF,6CAAe,SAAS,YAAY,WAAW,CAAC;AAEhD,UAAI,QAAQ,OAAO,2BAA2B;AAC5C,cAAM,aAAa,MAAM,QAAQ;AAAA,UAC/B,GAAG,UAAU,IAAI,SAAS;AAAA,QAC5B;AAEA,YAAI,cAAc,WAAW,KAAK;AAChC;AAAA,YACE;AAAA,YACA;AAAA,YACA;AAAA,YACA,OAAO,WAAW,GAAG;AAAA,UACvB;AAAA,QACF;AAGA,cAAM,WAAW,MAAM,QAAQ;AAAA,UAC7B,GAAG,UAAU,IAAI,SAAS;AAAA,QAC5B;AAEA,YACE,CAAC,cACD,cAAS,QAAT,mBAAc,eAAc,6BAC5B;AACA,kBAAQ,IAAI;AAAA,YACV;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,WAAW,WAAW,MAAM;AAC1B,QAAI,QAAQ,OAAO,oBAAoB;AAErC,aAAM,mCAAS;AAAA,QACb,GAAG,UAAU,IAAI,SAAS;AAAA,QAC1B;AAAA,QACA;AAAA;AAGF;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ,OAAO,iBAAiB,QAAQ,OAAO,iBAAiB;AAAA,MAClE;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,qBAAqB,OAChC,YACkB;AAClB,QAAM,WAAW,MAAM,QAAQ,iBAAiB;AAEhD,WAAS,QAAQ,OAAO,YAAY;AAClC,QAAI,QAAQ,KAAK;AACf,YAAM,WAAW,QAAQ,IAAI,MAAM,GAAG;AACtC,UAAI,SAAS,UAAU,GAAG;AACxB,cAAM,aAAa,SAAS,CAAC;AAC7B,cAAM,YAAY,SAAS,CAAC;AAE5B,cAAM,qBAAqB,MAAM,QAAQ;AAAA,UACvC,GAAG,UAAU,IAAI,SAAS;AAAA,QAC5B;AAEA,YACE,sBACA,mBAAmB,OACnB,mBAAmB,OAAO,QAAQ,OAAO,QACzC;AACA,kBAAQ,IAAI;AAAA,YACV,2BAA2B,UAAU,oBAAoB,SAAS,+BAA+B,mBAAmB,GAAG,+CAA+C,QAAQ,OAAO,MAAM;AAAA,UAC7L;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
6
6
  "names": []
7
7
  }
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "zendure-solarflow",
4
- "version": "1.8.8",
4
+ "version": "1.9.0",
5
5
  "news": {
6
+ "1.9.0": {
7
+ "en": "New option to force Solarflow device to go offline when \"Low Voltage Block\"-option is used.",
8
+ "de": "Neue Option, Solarflow-Gerät zu zwingen, offline zu gehen, wenn \"Low Voltage Block\"-Option verwendet wird.",
9
+ "ru": "Новая опция заставить устройство Solarflow выйти в автономном режиме, когда используется опция «Low Voltage Block».",
10
+ "pt": "Nova opção para forçar o dispositivo Solarflow a ficar offline quando a opção \"Low Voltage Block\" é usada.",
11
+ "nl": "Nieuwe optie om Solarflow apparaat te dwingen offline te gaan wanneer \"Low Voltage Blok\"-optie wordt gebruikt.",
12
+ "fr": "Nouvelle option pour forcer le périphérique Solarflow à déconnecter lorsque l'option \"Block basse tension\" est utilisée.",
13
+ "it": "Nuova opzione per forza dispositivo Solarflow per andare offline quando \"Low Tensione Block\"-opzione è utilizzato.",
14
+ "es": "Nueva opción para forzar el dispositivo Solarflow a salir fuera de línea cuando se utiliza la opción \"Low Voltage Block\".",
15
+ "pl": "Nowa opcja zmuszenia urządzenia Solarflow do offline przy użyciu opcji \"Block niskiego napięcia\".",
16
+ "uk": "Використовується новий варіант для відключення пристроїв Solarflow при \"Low Блок напруги\"-опція.",
17
+ "zh-cn": "使用“ Low Voltage Block”- 选项时, 强制 Solarflow 设备下线的新选项 ."
18
+ },
6
19
  "1.8.8": {
7
20
  "en": "Improve connection retry, expand the time with every retry attempt.\nStart \"restart adapter job\" regardless of connection.\nFix Hyper setInputLimit with step",
8
21
  "de": "Verbessern Sie die Retry-Verbindung, erweitern Sie die Zeit mit jedem Retry-Test.\nStarten Sie \"Adapter Job starten\" unabhängig von der Verbindung.\nFix Hyper setInputLimit mit Schritt",
@@ -80,19 +93,6 @@
80
93
  "pl": "Fix SOC i energyWhMax Value (liczony według typu dołączonych baterii)\nDodaj obliczenie wejścia siatki (tylko dla Asa 1500 i Hyper 2000)\nPoprawianie sugestii przez sprawdzacz repozytorium jOBroker",
81
94
  "uk": "Фіксація SOC та енергіяWhMax Значення (з урахуванням типу прикріплених батарей)\nДодати розрахунок для входу в мережу (тільки для Ace 1500 і Hyper 2000)\nВиправлення пропозицій на репозиторію ioBroker",
82
95
  "zh-cn": "固定SOC和能量WhMax值(按附电池类型计算)\n添加网格输入计算(仅A 1500和Hyper 2000)\n由 ioBroker 仓库检查器修复建议"
83
- },
84
- "1.7.7": {
85
- "en": "Fix Input and Output limit for Hyper 2000",
86
- "de": "Fixe Eingangs- und Ausgangsgrenze für Hyper 2000",
87
- "ru": "Предельный уровень ввода и вывода для Hyper 2000",
88
- "pt": "Limite de entrada e saída para Hyper 2000",
89
- "nl": "Fix Input and Output limit for Hyper 2000",
90
- "fr": "Fixer la limite d'entrée et de sortie pour Hyper 2000",
91
- "it": "Limite di ingresso e uscita per Hyper 2000",
92
- "es": "Límite de entrada y salida fijo para Hyper 2000",
93
- "pl": "Limit wejścia i wyjścia dla Hyper 2000",
94
- "uk": "Фіксувати вхідні та вихідні обмеження для Hyper 2000",
95
- "zh-cn": "Hyper 2000 输入和输出限制"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -163,7 +163,8 @@
163
163
  "userName": "",
164
164
  "server": "global",
165
165
  "useCalculation": false,
166
- "useLowVoltageBlock": false
166
+ "useLowVoltageBlock": false,
167
+ "dischargeLimit": 10
167
168
  },
168
169
  "encryptedNative": [
169
170
  "password"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.zendure-solarflow",
3
- "version": "1.8.8",
3
+ "version": "1.9.0",
4
4
  "description": "zendure-solarflow",
5
5
  "author": {
6
6
  "name": "Peter",
@@ -21,7 +21,7 @@
21
21
  "node": ">= 18"
22
22
  },
23
23
  "dependencies": {
24
- "@iobroker/adapter-core": "^3.1.6",
24
+ "@iobroker/adapter-core": "^3.2.2",
25
25
  "@types/node-schedule": "^2.1.6",
26
26
  "axios": "^1.5.1",
27
27
  "mqtt": "^5.1.3"