iobroker.sun2000 0.9.0 → 0.11.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 CHANGED
@@ -29,7 +29,8 @@ Feel free to follow the discussions in the german [iobroker forum](https://forum
29
29
 
30
30
  ## Dependencies
31
31
  * Node.js 18.x or higher
32
- * ioBroker host (js-controller) 5.x or higher
32
+ * ioBroker host (js-controller) 5.0.19 or higher
33
+ * ioBroker admin 5.1.13 or higher
33
34
 
34
35
  ## Documentation
35
36
 
@@ -62,11 +63,22 @@ browse in the [wiki](https://github.com/bolliy/ioBroker.sun2000/wiki)
62
63
  Placeholder for the next version (at the beginning of the line):
63
64
  ### **WORK IN PROGRESS**
64
65
  -->
66
+ ### 0.11.0 (2024-06-27)
67
+ * added a donation link in the adapter settings
68
+ * dependency updated
69
+
70
+ ### 0.10.0 (2024-06-14)
71
+ * dependency and configuration updates
72
+ * adjust roles in the control path
73
+ * Battery control: add backup power SOC #84
74
+ * fix: wrong state name `control.battery.targetSOC` with trailing space
75
+
65
76
  ### 0.9.0 (2024-05-09)
66
77
  * dependency and configuration updates
67
78
  * modbus device remains active in standby on the inverter M2,M3
68
79
 
69
80
  ### 0.8.0 (2024-04-19)
81
+
70
82
  * Check numerical values for plausibility #75
71
83
  * realization the "limit the power fed to grid" (Export control)
72
84
  * realization the "forcible Charge or Discharge Power"
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Wenn Ihnen dieser Adapter gefällt, denken Sie bitte über eine Spende nach um meine Arbeit zu unterstützen.",
2
3
  "sun2000 adapter settings": "Adaptereinstellungen für Huawei Inverter Sun2000",
3
4
  "address": "Geräte-IP-Adresse",
4
5
  "port": "Modbus TCP-Port",
@@ -14,8 +15,8 @@
14
15
  "automatic adjustment of the modbus settings": "automatische Anpassung der Modbus-Einstellungen",
15
16
  "ms.aktive": "Modbus-Proxy aktiv",
16
17
  "Modbus-proxy via TCP for read-only is active": "Modbus-Proxy über TCP zum Nur-Lesen ist aktiv",
17
- "ms.address": "Modbus-Proxy-IP-Adresse",
18
- "If want to listen only at localhost use 127.0.0.1": "Wenn Sie nur auf localhost zuhören möchten, verwenden Sie 127.0.0.1",
18
+ "ms.address": "Modbus-Proxy überwacht die Adresse",
19
+ "If want to listen only at localhost use 127.0.0.1": "Wenn Sie nur auf localhost hören möchten, verwenden Sie 127.0.0.1",
19
20
  "ms.port": "Modbus-Proxy-TCP-Port",
20
21
  "The Modbus-proxy TCP port": "Der Modbus-Proxy-TCP-Port",
21
22
  "The SDongle modbus ID": "Die SDongle-Modbus-ID – normalerweise 100",
@@ -26,6 +27,6 @@
26
27
  "sl.meterId": "Modbus-ID des SmartLogger-Messgeräts",
27
28
  "The Meter modbus ID": "Die Modbus-ID des Messgeräts",
28
29
  "sd.active": "SDongle abfragen",
29
- "Create default TOU setting": "Standard TOU Einstellung verwenden",
30
+ "Create default TOU setting": "Erstellen Sie eine Standard-TOU-Einstellung",
30
31
  "Examples of application": "Anwendungsbeispiele"
31
32
  }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "If you like this adapter, please consider making a donation to support my work.",
2
3
  "sun2000 adapter settings": "Adapter settings for huawai inverter sun2000",
3
4
  "address": "Device IP address",
4
5
  "port": "modbus TCP port",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings" : "automatic adjustment of the modbus settings",
15
16
  "ms.aktive" : "Modbus-proxy active",
16
17
  "Modbus-proxy via TCP for read-only is active" : "Modbus-proxy via TCP for read-only is active",
17
- "ms.address": "Modbus-proxy IP address",
18
+ "ms.address": "Modbus-proxy listening on address",
18
19
  "If want to listen only at localhost use 127.0.0.1": "If want to listen only at localhost use 127.0.0.1",
19
20
  "ms.port": "Modbus-proxy TCP port",
20
21
  "The Modbus-proxy TCP port" : "The Modbus-proxy TCP port",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Si le gusta este adaptador, considere hacer una donación para apoyar mi trabajo.",
2
3
  "sun2000 adapter settings": "Configuración del adaptador para el inversor huawai sun2000",
3
4
  "address": "Dirección IP del dispositivo",
4
5
  "port": "Puerto TCP Modbus",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "ajuste automático de la configuración modbus",
15
16
  "ms.aktive": "Proxy Modbus activo",
16
17
  "Modbus-proxy via TCP for read-only is active": "El proxy Modbus a través de TCP para solo lectura está activo",
17
- "ms.address": "Dirección IP del proxy Modbus",
18
+ "ms.address": "Proxy Modbus escuchando en la dirección",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Si desea escuchar solo en localhost use 127.0.0.1",
19
20
  "ms.port": "Puerto TCP proxy Modbus",
20
21
  "The Modbus-proxy TCP port": "El puerto TCP del proxy Modbus",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Si vous aimez cet adaptateur, pensez à faire un don pour soutenir mon travail.",
2
3
  "sun2000 adapter settings": "Paramètres de l'adaptateur pour l'onduleur Huawai Sun2000",
3
4
  "address": "Adresse IP de l'appareil",
4
5
  "port": "port TCP Modbus",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "ajustement automatique des paramètres modbus",
15
16
  "ms.aktive": "Proxy Modbus actif",
16
17
  "Modbus-proxy via TCP for read-only is active": "Le proxy Modbus via TCP pour la lecture seule est actif",
17
- "ms.address": "Adresse IP du proxy Modbus",
18
+ "ms.address": "Modbus-proxy écoutant l'adresse",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Si vous souhaitez écouter uniquement sur localhost, utilisez 127.0.0.1",
19
20
  "ms.port": "Port TCP du proxy Modbus",
20
21
  "The Modbus-proxy TCP port": "Le port TCP du proxy Modbus",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Se ti piace questo adattatore, considera di fare una donazione per sostenere il mio lavoro.",
2
3
  "sun2000 adapter settings": "Impostazioni dell'adattatore per inverter huawai sun2000",
3
4
  "address": "Indirizzo IP del dispositivo",
4
5
  "port": "porta TCP Modbus",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "regolazione automatica delle impostazioni Modbus",
15
16
  "ms.aktive": "Proxy Modbus attivo",
16
17
  "Modbus-proxy via TCP for read-only is active": "Il proxy Modbus tramite TCP per la sola lettura è attivo",
17
- "ms.address": "Indirizzo IP proxy Modbus",
18
+ "ms.address": "Ascolto proxy Modbus sull'indirizzo",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Se vuoi ascoltare solo su localhost usa 127.0.0.1",
19
20
  "ms.port": "Porta TCP proxy Modbus",
20
21
  "The Modbus-proxy TCP port": "La porta TCP del proxy Modbus",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Als je deze adapter leuk vindt, overweeg dan een donatie te doen om mijn werk te ondersteunen.",
2
3
  "sun2000 adapter settings": "Adapterinstellingen voor huawai omvormer sun2000",
3
4
  "address": "IP-adres van apparaat",
4
5
  "port": "modbus TCP-poort",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "automatische aanpassing van de Modbus-instellingen",
15
16
  "ms.aktive": "Modbus-proxy actief",
16
17
  "Modbus-proxy via TCP for read-only is active": "Modbus-proxy via TCP voor alleen-lezen is actief",
17
- "ms.address": "Modbus-proxy IP-adres",
18
+ "ms.address": "Modbus-proxy luistert op adres",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Als je alleen op localhost wilt luisteren, gebruik dan 127.0.0.1",
19
20
  "ms.port": "Modbus-proxy TCP-poort",
20
21
  "The Modbus-proxy TCP port": "De Modbus-proxy TCP-poort",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Jeśli podoba Ci się ten adapter, rozważ przekazanie darowizny na wsparcie mojej pracy.",
2
3
  "sun2000 adapter settings": "Ustawienia adaptera dla falownika Huawei Sun2000",
3
4
  "address": "Adres IP urządzenia",
4
5
  "port": "portu Modbus TCP",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "automatyczna regulacja ustawień Modbus",
15
16
  "ms.aktive": "Aktywny serwer proxy Modbus",
16
17
  "Modbus-proxy via TCP for read-only is active": "Modbus-proxy przez TCP w trybie tylko do odczytu jest aktywny",
17
- "ms.address": "Adres IP serwera proxy Modbus",
18
+ "ms.address": "Modbus-proxy nasłuchuje na adresie",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Jeśli chcesz słuchać tylko na localhost, użyj 127.0.0.1",
19
20
  "ms.port": "Port Modbus-proxy TCP",
20
21
  "The Modbus-proxy TCP port": "Port Modbus-proxy TCP",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Se você gosta deste adaptador, considere fazer uma doação para apoiar meu trabalho.",
2
3
  "sun2000 adapter settings": "Configurações do adaptador para inversor huawai sun2000",
3
4
  "address": "Endereço IP do dispositivo",
4
5
  "port": "porta modbus TCP",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "ajuste automático das configurações modbus",
15
16
  "ms.aktive": "Proxy Modbus ativo",
16
17
  "Modbus-proxy via TCP for read-only is active": "O proxy Modbus via TCP para somente leitura está ativo",
17
- "ms.address": "Endereço IP proxy Modbus",
18
+ "ms.address": "Proxy Modbus escutando no endereço",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Se quiser ouvir apenas no localhost use 127.0.0.1",
19
20
  "ms.port": "Porta TCP proxy Modbus",
20
21
  "The Modbus-proxy TCP port": "A porta TCP proxy Modbus",
@@ -1,10 +1,11 @@
1
1
  {
2
+ "donateTxt": "Если вам понравился этот адаптер, рассмотрите возможность сделать пожертвование в поддержку моей работы.",
2
3
  "sun2000 adapter settings": "Настройки адаптера для инвертора huawei sun2000",
3
4
  "address": "IP-адрес устройства",
4
5
  "port": "TCP-порт Modbus",
5
6
  "Modbus inverter IDs": "Идентификаторы преобразователей Modbus",
6
7
  "Update interval (sec)": "Интервал обновления [сек]",
7
- "The device ip address": "IP-адрес инвертора",
8
+ "The device ip address": "IP-адрес инверторов",
8
9
  "The modbus TCP port": "TCP-порт Modbus",
9
10
  "The modbus inverter IDs, separated with character ,": "Идентификаторы инверторов Modbus, разделенные символом ,",
10
11
  "Update interval to update the values from the inverters": "Интервал обновления для обновления значений инверторов.",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "автоматическая регулировка настроек Modbus",
15
16
  "ms.aktive": "Modbus-прокси активен",
16
17
  "Modbus-proxy via TCP for read-only is active": "Modbus-прокси через TCP только для чтения активен",
17
- "ms.address": "IP-адрес Modbus-прокси",
18
+ "ms.address": "Modbus-прокси прослушивает адрес",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Если вы хотите слушать только на локальном хосте, используйте 127.0.0.1.",
19
20
  "ms.port": "TCP-порт Modbus-прокси",
20
21
  "The Modbus-proxy TCP port": "TCP-порт Modbus-прокси",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "Якщо вам подобається цей адаптер, зробіть пожертву на підтримку моєї роботи.",
2
3
  "sun2000 adapter settings": "Налаштування адаптера huawai inverter sun2000",
3
4
  "address": "IP-адреса пристрою",
4
5
  "port": "порт Modbus TCP",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "автоматичне налаштування параметрів Modbus",
15
16
  "ms.aktive": "Modbus-проксі активний",
16
17
  "Modbus-proxy via TCP for read-only is active": "Modbus-проксі через TCP для читання активний",
17
- "ms.address": "IP-адреса Modbus-проксі",
18
+ "ms.address": "Прослуховування адреси Modbus-проксі",
18
19
  "If want to listen only at localhost use 127.0.0.1": "Якщо ви хочете слухати лише на локальному хості, використовуйте 127.0.0.1",
19
20
  "ms.port": "TCP-порт Modbus-proxy",
20
21
  "The Modbus-proxy TCP port": "TCP-порт Modbus-proxy",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "donateTxt": "如果您喜欢这个适配器,请考虑捐赠以支持我的工作。",
2
3
  "sun2000 adapter settings": "华为逆变器sun2000的适配器设置",
3
4
  "address": "设备IP地址",
4
5
  "port": "Modbus TCP 端口",
@@ -14,7 +15,7 @@
14
15
  "automatic adjustment of the modbus settings": "自动调整 Modbus 设置",
15
16
  "ms.aktive": "Modbus 代理处于活动状态",
16
17
  "Modbus-proxy via TCP for read-only is active": "通过 TCP 进行只读的 Modbus 代理已激活",
17
- "ms.address": "Modbus 代理 IP 地址",
18
+ "ms.address": "Modbus 代理监听地址",
18
19
  "If want to listen only at localhost use 127.0.0.1": "如果只想在本地主机上监听,请使用 127.0.0.1",
19
20
  "ms.port": "Modbus 代理 TCP 端口",
20
21
  "The Modbus-proxy TCP port": "Modbus 代理 TCP 端口",
@@ -6,6 +6,17 @@
6
6
  "type": "panel",
7
7
  "label": "Main settings",
8
8
  "items": {
9
+ "donateTxt": {
10
+ "type": "staticText",
11
+ "text": "donateTxt"
12
+ },
13
+ "donateImage": {
14
+ "type": "staticImage",
15
+ "label": "label",
16
+ "href" : "https://www.paypal.com/donate/?hosted_button_id=ZTX3VP9LZBDCG",
17
+ "src" : "paypal-button.png",
18
+ "newLine": true
19
+ },
9
20
  "mainHdr1": {
10
21
  "newLine": true,
11
22
  "type": "header",
Binary file
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sun2000",
4
- "version": "0.9.0",
4
+ "version": "0.11.0",
5
5
  "news": {
6
+ "0.11.0": {
7
+ "en": "added a donation link in the adapter settings\ndependency updated",
8
+ "de": "einen spendenlink in den adaptereinstellungen hinzugefügt\naktualisierte abhängigkeit",
9
+ "ru": "добавлена ссылка пожертвований в настройках адаптера\nобновленные данные",
10
+ "pt": "adicionou um link de doação nas configurações do adaptador\ndependência atualizada",
11
+ "nl": "een donatielink toegevoegd in de adapterinstellingen\nafhankelijkheid bijgewerkt",
12
+ "fr": "ajouté un lien de don dans les paramètres de l'adaptateur\nmise à jour de la dépendance",
13
+ "it": "aggiunto un link di donazione nelle impostazioni dell'adattatore\naggiornamento della dipendenza",
14
+ "es": "añadido un enlace de donación en la configuración del adaptador\nactualización de la dependencia",
15
+ "pl": "dodano link do darowizny w ustawieniach adaptera\nzaktualizowana zależność",
16
+ "uk": "додано посилання пожертвування в налаштуваннях адаптера\nоновлення залежності",
17
+ "zh-cn": "在适配器设置中添加一个捐赠链接\n更新依赖关系"
18
+ },
19
+ "0.10.0": {
20
+ "en": "dependency and configuration updates\nadjust roles in the control path\nBattery control: add backup power SOC #84\nfix: wrong state name `control.battery.targetSOC` with trailing space",
21
+ "de": "abhängigkeits- und konfigurationsupdates\nrollen im kontrollpfad anpassen\nBatteriesteuerung: Backup-Leistung hinzufügen SOC #84\nfix: falscher Zustandsname `control.battery.targetSOC` mit Trailing Space",
22
+ "ru": "обновления зависимости и конфигурации\nкорректировать роли на пути управления\n#84\nисправить: неправильное название состояния `control.battery.targetSOC' с отслеживающим пространством",
23
+ "pt": "atualizações de dependência e configuração\najustar funções no caminho de controle\nControle da bateria: adicionar energia de backup SOC #84\ncorreção: nome de estado errado `control.battery.targetSOC` com espaço de trilha",
24
+ "nl": "afhankelijkheid en configuratie-updates\nde rollen in het controlepad aanpassen\nBatterij controle: voeg back-up vermogen SOC #84\nfix: verkeerde staat naam ",
25
+ "fr": "mises à jour de la dépendance et de la configuration\najuster les rôles dans le chemin de contrôle\nCommande de la batterie: ajouter la puissance de secours SOC #84\ncorrection : nom d'état incorrect `control.battery.targetSOC` avec espace de traînage",
26
+ "it": "aggiornamenti di dipendenza e configurazione\nregolare i ruoli nel percorso di controllo\nControllo della batteria: aggiungere la potenza di backup SOC #84\nfix: nome di stato sbagliato `control.battery.targetSOC` con lo spazio trailing",
27
+ "es": "actualizaciones de dependencia y configuración\najustar funciones en la ruta de control\nControl de batería: añadir potencia de respaldo SOC #84\nfijado: nombre de estado equivocado `control.battery.targetSOC` con espacio de seguimiento",
28
+ "pl": "aktualizacje zależności i konfiguracji\ndostosować role w ścieżce sterowania\nKontrola baterii: dodać zasilanie awaryjne SOC # 84\nfix: błędna nazwa stanu 'control.battery.ActivitSOC' z przepustnicą",
29
+ "uk": "оновлення залежності та конфігурації\nрегулювання ролі в шляху управління\nКонтроль акумулятора: додаємо резервну потужність SOC #84\nвиправити: неправильне ім'я держави `control.battery.targetSOC` з причепом",
30
+ "zh-cn": "依赖和配置更新\n调整控制路径中的角色\n电池控制: 添加备份功率 SOC #84\n修补:错误的州名`control.battery.targetSOC ' ,带有后端空间"
31
+ },
6
32
  "0.9.0": {
7
33
  "en": "dependency and configuration updates\nmodbus device remains active in standby on the inverter M2,M3",
8
34
  "de": "abhängigkeits- und konfigurationsupdates\nmodbus-Gerät bleibt im Standby am Wechselrichter M2,M3 aktiv",
@@ -67,32 +93,6 @@
67
93
  "pl": "korekta detekcji czuwania\nPoprawa dzienników",
68
94
  "uk": "автономне виявлення\nУдосконалення колод",
69
95
  "zh-cn": "经调整的备用检测\n改进日志"
70
- },
71
- "0.6.1": {
72
- "en": "Battery control: After the second failed attempt, the control event is discarded\nBattery control: Adjust the battery maxCharge and Discharge to the actual values",
73
- "de": "Batteriesteuerung: Nach dem zweiten gescheiterten Versuch wird das Kontrollereignis verworfen\nBatteriesteuerung: Einstellen der Batterie maxCharge und Entladen auf die tatsächlichen Werte",
74
- "ru": "Контроль батареи: После второй неудачной попытки, событие управления отбрасывается\nКонтроль батареи: Настройка аккумулятора maxCharge и выгрузка на фактические значения",
75
- "pt": "Controle da bateria: Após a segunda tentativa falhada, o evento de controle é descartado\nControle da bateria: Ajuste a bateria maxCharge e descarga para os valores reais",
76
- "nl": "Controle van de batterij: Na de tweede mislukte poging, de controle gebeurtenis wordt weggegooid\nControle van de batterij: Pas de batterij maxCharge en Discharge aan aan de werkelijke waarden",
77
- "fr": "Contrôle de la batterie: Après la deuxième tentative ratée, l'événement de contrôle est écarté\nContrôle de la batterie: Régler la batterie maxCharge et décharge aux valeurs réelles",
78
- "it": "Controllo della batteria: Dopo il secondo tentativo fallito, l'evento di controllo viene scartato\nControllo della batteria: Regolare la batteria maxCharge e Scaricare i valori effettivi",
79
- "es": "Control de batería: Después del segundo intento fallido, el evento de control es descartado\nControl de batería: Ajustar la batería maxCargue y descarga a los valores reales",
80
- "pl": "Kontrola baterii: Po drugiej nieudanej próbie zdarzenie kontrolne zostaje odrzucone\nKontrola baterii: Dostosuj maxCharge i absolutorium baterii do rzeczywistych wartości",
81
- "uk": "Контроль акумулятора: Після другого невдалого спробу контрольний захід відхилений\nКонтроль акумулятора: Налаштуйте акумулятор maxCharge і відключіть до фактичних значень",
82
- "zh-cn": "电池控制 : 在第二次尝试失败后, 控制事件被丢弃\n电池控制 : 按照实际值调整电池最大充电器和放电装置"
83
- },
84
- "0.6.0": {
85
- "en": "realization the \"battery charge control\" #61\nfix the standby detection #60",
86
- "de": "realisierung der \"batterieladungskontrolle\" #61\nfixieren sie die standby-erkennung #60",
87
- "ru": "#61\nисправить резервное обнаружение #60",
88
- "pt": "realização do \"controle de carga de bateria\" #61\ncorrigir a detecção de espera #60",
89
- "nl": "realisatie van de \"battery charge control\" #61\nfix de stand-by detectie #60",
90
- "fr": "réalisation du \"contrôle de charge de batterie\" #61\nfixer la détection de veille #60",
91
- "it": "realizzazione del \"controllo di carica della batteria\" #61\nfissare il rilevamento standby #60",
92
- "es": "realización del \"control de carga de batería\" #61\narregla la detección de standby #60",
93
- "pl": "realizacja \"kontroli ładunku akumulatora\" # 61\nnaprawić czujnik czuwania # 60",
94
- "uk": "впровадження \"управління платежем\" no61\nзафіксувати виявлення стендів #60",
95
- "zh-cn": "实现\"电池充电控制\"#61\n修复备用检测器 # 60"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -216,7 +216,7 @@
216
216
  ],
217
217
  "dependencies": [
218
218
  {
219
- "js-controller": ">=5.0.0"
219
+ "js-controller": ">=5.0.19"
220
220
  }
221
221
  ],
222
222
  "globalDependencies": [
@@ -12,7 +12,7 @@ class ServiceQueueMap {
12
12
 
13
13
  this.serviceFields = [
14
14
  {
15
- state: {id: 'battery.chargeFromGridFunction', name: 'Charge from Grid', type: 'boolean', role: 'value', desc: 'reg: 47087, len: 1'},
15
+ state: {id: 'battery.chargeFromGridFunction', name: 'Charge from Grid', type: 'boolean', role: 'switch.enable', desc: 'reg: 47087, len: 1'},
16
16
  type : deviceType.battery,
17
17
  fn: async event => {
18
18
  const ret = await this._writeRegisters(47087,event.value === true ? [1]: [0]);
@@ -21,7 +21,7 @@ class ServiceQueueMap {
21
21
  }
22
22
  },
23
23
  {
24
- state: { id: 'battery.maximumChargePower', name: 'MaximumChargePower', type: 'number', unit: 'W', role: 'value.power', desc: 'reg: 47075, len: 2'},
24
+ state: { id: 'battery.maximumChargePower', name: 'MaximumChargePower', type: 'number', unit: 'W', role: 'level.power', desc: 'reg: 47075, len: 2'},
25
25
  type : deviceType.battery,
26
26
  fn: async event => {
27
27
  const max = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.maximumChargePower')?.value ?? 2500;
@@ -31,7 +31,7 @@ class ServiceQueueMap {
31
31
  }
32
32
  },
33
33
  {
34
- state: { id: 'battery.maximumDischargePower', name: 'MaximumDischargePower', type: 'number', unit: 'W', role: 'value.power', desc: 'reg: 47077, len: 2'},
34
+ state: { id: 'battery.maximumDischargePower', name: 'MaximumDischargePower', type: 'number', unit: 'W', role: 'level.power', desc: 'reg: 47077, len: 2'},
35
35
  type : deviceType.battery,
36
36
  fn: async event => {
37
37
  const max = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.maximumDischargePower')?.value ?? 2500;
@@ -41,7 +41,7 @@ class ServiceQueueMap {
41
41
  }
42
42
  },
43
43
  {
44
- state: {id: 'battery.chargingCutoffCapacity', name: 'Charging Cutoff Capacity', type: 'number', unit: '%', role: 'value', desc: 'reg: 47081, len: 1'},
44
+ state: {id: 'battery.chargingCutoffCapacity', name: 'Charging Cutoff Capacity', type: 'number', unit: '%', role: 'level.max', desc: 'reg: 47081, len: 1'},
45
45
  type : deviceType.battery,
46
46
  fn: async (event) => {
47
47
  if (event.value > 100) event.value = 100;
@@ -53,7 +53,7 @@ class ServiceQueueMap {
53
53
  }
54
54
  },
55
55
  {
56
- state: {id: 'battery.dischargeCutoffCapacity', name: 'Discharge Cutoff Capacity', type: 'number', unit: '%', role: 'value', desc: 'reg: 47082, len: 1'},
56
+ state: {id: 'battery.dischargeCutoffCapacity', name: 'Discharge Cutoff Capacity', type: 'number', unit: '%', role: 'level.min', desc: 'reg: 47082, len: 1'},
57
57
  type : deviceType.battery,
58
58
  fn: async event => {
59
59
  if (event.value > 20) event.value = 20;
@@ -64,7 +64,7 @@ class ServiceQueueMap {
64
64
  }
65
65
  },
66
66
  {
67
- state: {id: 'battery.gridChargeCutoffSOC', name: 'Grid Charge Cutoff SOC', type: 'number', unit: '%', role: 'value', desc: 'reg:47088, len:1'},
67
+ state: {id: 'battery.gridChargeCutoffSOC', name: 'Grid Charge Cutoff SOC', type: 'number', unit: '%', role: 'level', desc: 'reg:47088, len:1'},
68
68
  type : deviceType.battery,
69
69
  fn: async event => {
70
70
  if (event.value > 100) event.value = 100;
@@ -75,7 +75,7 @@ class ServiceQueueMap {
75
75
  }
76
76
  },
77
77
  {
78
- state: {id: 'battery.workingModeSettings', name: 'Working Mode Settings', type: 'number', unit: '', role: 'value', desc: 'reg:47086, len:1'},
78
+ state: {id: 'battery.workingModeSettings', name: 'Working Mode Settings', type: 'number', unit: '', role: 'level', desc: 'reg:47086, len:1'},
79
79
  type : deviceType.battery,
80
80
  fn: async event => {
81
81
  if (event.value > 5) event.value = 2;
@@ -86,7 +86,7 @@ class ServiceQueueMap {
86
86
  }
87
87
  },
88
88
  {
89
- state: { id: 'battery.powerOfChargeFromGrid', name: 'power Of charge from grid', type: 'number', unit: 'W', role: 'value.power', desc: 'reg: 47242, len: 2'},
89
+ state: { id: 'battery.powerOfChargeFromGrid', name: 'power Of charge from grid', type: 'number', unit: 'W', role: 'level.power', desc: 'reg: 47242, len: 2'},
90
90
  type : deviceType.battery,
91
91
  fn: async event => {
92
92
  const max = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.maximumChargePower')?.value ?? 2500;
@@ -97,7 +97,7 @@ class ServiceQueueMap {
97
97
  },
98
98
  /*
99
99
  {
100
- state: { id: 'battery.forcedChargingAndDischargingPower', name: 'Forced charging and discharging power', type: 'number', unit: 'W', role: 'value.power', desc: 'reg: 47084, len: 2'},
100
+ state: { id: 'battery.forcedChargingAndDischargingPower', name: 'Forced charging and discharging power', type: 'number', unit: 'W', role: 'level.power', desc: 'reg: 47084, len: 2'},
101
101
  type : deviceType.battery,
102
102
  fn: async event => {
103
103
  const max = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.maximumChargePower')?.value ?? 2500;
@@ -109,7 +109,7 @@ class ServiceQueueMap {
109
109
  */
110
110
  /*
111
111
  {
112
- state: { id: 'battery.maximumPowerOfChargeFromGrid', name: 'Maximum power of charge from grid', type: 'number', unit: 'W', role: 'value.power', desc: 'reg: 47244, len: 2'},
112
+ state: { id: 'battery.maximumPowerOfChargeFromGrid', name: 'Maximum power of charge from grid', type: 'number', unit: 'W', role: 'level.power', desc: 'reg: 47244, len: 2'},
113
113
  type : deviceType.battery,
114
114
  fn: async event => {
115
115
  const max = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.maximumChargePower')?.value ?? 2500;
@@ -120,7 +120,7 @@ class ServiceQueueMap {
120
120
  },
121
121
  */
122
122
  {
123
- state: { id: 'battery.forcibleChargePower', name: 'Forcible charge power', type: 'number', unit: 'W', role: 'value.power', desc: 'reg: 47247, len: 2'},
123
+ state: { id: 'battery.forcibleChargePower', name: 'Forcible charge power', type: 'number', unit: 'W', role: 'level.power', desc: 'reg: 47247, len: 2'},
124
124
  type : deviceType.battery,
125
125
  fn: async event => {
126
126
  const max = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.maximumChargePower')?.value ?? 2500;
@@ -130,7 +130,7 @@ class ServiceQueueMap {
130
130
  }
131
131
  },
132
132
  {
133
- state: { id: 'battery.forcibleDischargePower', name: 'Forcible discharge power', type: 'number', unit: 'W', role: 'value.power', desc: 'reg: 47249, len: 2'},
133
+ state: { id: 'battery.forcibleDischargePower', name: 'Forcible discharge power', type: 'number', unit: 'W', role: 'level.power', desc: 'reg: 47249, len: 2'},
134
134
  type : deviceType.battery,
135
135
  fn: async event => {
136
136
  const max = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.maximumDischargePower')?.value ?? 2500;
@@ -139,8 +139,14 @@ class ServiceQueueMap {
139
139
  return await this._writeRegisters(47249,dataType.numToArray(event.value,dataType.uint32));
140
140
  }
141
141
  },
142
+ /*
142
143
  {
143
- state: { id: 'battery.targetSOC ', name: 'Target SOC ', type: 'number', unit: '%', role: 'value', desc: 'reg: 47101 , len: 1'},
144
+ state: { id: 'battery.targetSOC ', name: 'Target SOC', type: 'number', unit: '%', role: 'level', desc: 'reg: 47101 , len: 1'},
145
+ type : deviceType.gridPowerControl
146
+ },
147
+ */
148
+ {
149
+ state: { id: 'battery.targetSOC', name: 'Target SOC', type: 'number', unit: '%', role: 'level', desc: 'reg: 47101 , len: 1'},
144
150
  type : deviceType.gridPowerControl,
145
151
  fn: async event => {
146
152
  if (event.value > 100) event.value = 100;
@@ -151,7 +157,7 @@ class ServiceQueueMap {
151
157
  }
152
158
  },
153
159
  {
154
- state: { id: 'battery.forcedChargingAndDischargingPeriod', name: 'Forced charging and discharging period', type: 'number', unit: '', role: 'value', desc: 'reg: 47083, len: 1'},
160
+ state: { id: 'battery.forcedChargingAndDischargingPeriod', name: 'Forced charging and discharging period', type: 'number', unit: '', role: 'level', desc: 'reg: 47083, len: 1'},
155
161
  type : deviceType.battery,
156
162
  fn: async event => {
157
163
  if (event.value > 1440) event.value = 1440;
@@ -160,7 +166,7 @@ class ServiceQueueMap {
160
166
  }
161
167
  },
162
168
  {
163
- state: { id: 'battery.forcibleChargeOrDischargeSettingMode', name: 'Forcible charge/discharge setting mode (0: Duration,1: until SOC)', type: 'number', unit: '', role: 'value', desc: 'reg: 47246, len: 1'},
169
+ state: { id: 'battery.forcibleChargeOrDischargeSettingMode', name: 'Forcible charge/discharge setting mode (0: Duration,1: until SOC)', type: 'number', unit: '', role: 'level', desc: 'reg: 47246, len: 1'},
164
170
  type : deviceType.battery,
165
171
  fn: async event => {
166
172
  if (event.value > 1) event.value = 1;
@@ -169,7 +175,7 @@ class ServiceQueueMap {
169
175
  }
170
176
  },
171
177
  {
172
- state: { id: 'battery.forcibleChargeOrDischarge', name: 'Forcible charge/discharge (0: Stop,1: Charge, 2: Discharge)', type: 'number', unit: '', role: 'value', desc: 'reg: 47100, len: 1'},
178
+ state: { id: 'battery.forcibleChargeOrDischarge', name: 'Forcible charge/discharge (0: Stop,1: Charge, 2: Discharge)', type: 'number', unit: '', role: 'level', desc: 'reg: 47100, len: 1'},
173
179
  type : deviceType.battery,
174
180
  fn: async event => {
175
181
  if (event.value > 2) event.value = 2;
@@ -178,7 +184,24 @@ class ServiceQueueMap {
178
184
  }
179
185
  },
180
186
  {
181
- state: { id: 'grid.maximumFeedGridPower', name: 'Maximum Feed Grid Power', type: 'number', unit: 'kW', role: 'value.power', desc: 'reg: 47416, len: 2'},
187
+ state: { id: 'battery.backupPowerSOC', name: 'Backup Power SOC', type: 'number', unit: '%', role: 'level', desc: 'reg: 47102, len: 1'},
188
+ type : deviceType.battery,
189
+ fn: async event => {
190
+ const model = this.inverterInfo.instance.stateCache.get(this.inverterInfo.path+'.battery.productModel')?.value ?? 0;
191
+ if (model === 1) { //LG
192
+ if (event.value > 100) event.value = 100;
193
+ if (event.value < 12) event.value = 12;
194
+ } else { //LUNA
195
+ if (event.value > 100) event.value = 100;
196
+ if (event.value < 0) event.value = 0;
197
+ }
198
+ const ret = await this._writeRegisters(47102,dataType.numToArray(event.value*10,dataType.uint16));
199
+ if (ret) this.inverterInfo.instance.stateCache.set(this.inverterInfo.path+'.'+event.id, event.value);
200
+ return ret;
201
+ }
202
+ },
203
+ {
204
+ state: { id: 'grid.maximumFeedGridPower', name: 'Maximum Feed Grid Power', type: 'number', unit: 'kW', role: 'level.power', desc: 'reg: 47416, len: 2'},
182
205
  type : deviceType.gridPowerControl,
183
206
  fn: async event => {
184
207
  const max = 100; //100 kW
@@ -190,7 +213,7 @@ class ServiceQueueMap {
190
213
  }
191
214
  },
192
215
  {
193
- state: { id: 'grid.maximumFeedGridPower_percent', name: 'Maximum Feed Grid Power %', type: 'number', unit: '%', role: 'value', desc: 'reg: 47418, len: 1'},
216
+ state: { id: 'grid.maximumFeedGridPower_percent', name: 'Maximum Feed Grid Power %', type: 'number', unit: '%', role: 'level', desc: 'reg: 47418, len: 1'},
194
217
  type : deviceType.gridPowerControl,
195
218
  fn: async event => {
196
219
  if (event.value > 100) event.value = 100;
@@ -201,7 +224,7 @@ class ServiceQueueMap {
201
224
  }
202
225
  },
203
226
  {
204
- state: {id: 'grid.activePowerControlMode', name: '(0: Unlimited (default), 1: DIactive scheduling, 5: Zero power grid connection, 6: Power-limited grid connection (kW), 7: Power-limited grid connection (%))', type: 'number', unit: '', role: 'value', desc: 'reg:47415, len:1'},
227
+ state: {id: 'grid.activePowerControlMode', name: '(0: Unlimited (default), 1: DIactive scheduling, 5: Zero power grid connection, 6: Power-limited grid connection (kW), 7: Power-limited grid connection (%))', type: 'number', unit: '', role: 'level', desc: 'reg:47415, len:1'},
205
228
  type : deviceType.gridPowerControl,
206
229
  fn: async event => {
207
230
  if (event.value > 7) event.value = 7;
@@ -226,15 +249,28 @@ class ServiceQueueMap {
226
249
  this._serviceMap.set(item.state.id, item);
227
250
  }
228
251
  }
252
+
229
253
  for (const entry of this._serviceMap.values()) {
230
254
  //await this._initState(this.inverterInfo.path+'.control.',entry.state);
231
255
  const path = this.inverterInfo.path+'.control.';
232
256
  await this._initState(path,entry.state);
233
- const state = await this.adapter.getStateAsync(path+entry.state.id);
257
+ const state = await this.adapter.getState(path+entry.state.id);
234
258
  if (state && state.ack === false) {
235
259
  this.set(entry.state.id,state);
236
260
  }
237
261
  }
262
+
263
+ //Update --
264
+ const tSOC = await this.adapter.getState(this.inverterInfo.path+'.control.battery.targetSOC ');
265
+ if (tSOC) {
266
+ await this.adapter.delObject(this.inverterInfo.path+'.control.battery.targetSOC ',{ recursive: false });
267
+ if (tSOC.val !== null) {
268
+ await this.adapter.setState(this.inverterInfo.path+'.control.battery.targetSOC',{val: tSOC.val, ack: tSOC.ack});
269
+ if (tSOC.ack === false) this.set('battery.targetSOC',tSOC);
270
+ }
271
+ }
272
+ //Update ++
273
+
238
274
  this.adapter.subscribeStates(this.inverterInfo.path+'.control*');
239
275
  this._initialized = true;
240
276
 
@@ -299,7 +335,7 @@ class ServiceQueueMap {
299
335
  service.errorCount = 0;
300
336
  try {
301
337
  event.ack = true;
302
- await this.adapter.setStateAsync(this.inverterInfo.path+'.control.'+event.id, {val: event.value , ack: true});
338
+ await this.adapter.setState(this.inverterInfo.path+'.control.'+event.id, {val: event.value , ack: true});
303
339
  this._eventMap.delete(event.id);
304
340
  this.log.info('Control: write state '+this.inverterInfo.path+'.control.'+event.id+' : '+event.value+' ack: true');
305
341
  } catch {
@@ -342,7 +378,7 @@ class ServiceQueueMap {
342
378
 
343
379
  //state
344
380
  async _initState(path, state) {
345
- await this.adapter.extendObjectAsync(path+state.id, {
381
+ await this.adapter.extendObject(path+state.id, {
346
382
  type: 'state',
347
383
  common: {
348
384
  name: state.name,
@@ -298,7 +298,29 @@ class InverterSun2000 extends DriverBase{
298
298
  {
299
299
  state: {id: 'battery.gridChargeCutoffSOC', name: 'Grid Charge Cutoff SOC', type: 'number', unit: '%', role: 'value', desc: 'reg:47088, len:1'},
300
300
  register: {reg: 47088, type: dataType.uint16, gain: 10}
301
- }]
301
+ }
302
+ ]
303
+ },
304
+ {
305
+ address : 47101,
306
+ length : 6,
307
+ info : 'additional battery information',
308
+ //refresh : dataRefreshRate.low,
309
+ type : deviceType.battery,
310
+ states: [
311
+ {
312
+ state: { id: 'battery.targetSOC', name: 'Target SOC', type: 'number', unit: '%', role: 'value', desc: 'reg: 47101 , len: 1'},
313
+ register: {reg: 47101, type: dataType.uint16, gain: 10}
314
+ },
315
+ {
316
+ state: { id: 'battery.backupPowerSOC', name: 'Backup Power SOC', type: 'number', unit: '%', role: 'value', desc: 'reg: 47102, len: 1'},
317
+ register: {reg: 47102, type: dataType.uint16, gain: 10}
318
+ },
319
+ {
320
+ state: { id: 'battery.productModel', name: 'Product Model', type: 'number', unit: '', role: 'value', desc: 'reg: 47089 , len: 1'},
321
+ register: {reg: 47106, type: dataType.uint16}
322
+ }
323
+ ]
302
324
  },
303
325
  {
304
326
  address : 32000,
@@ -709,7 +731,7 @@ class InverterSun2000 extends DriverBase{
709
731
  let state = this.stateCache.get(path+'battery.unit.1.SN');
710
732
  if (state && state?.value !== '') this.deviceInfo.numberBatteryUnits = 1;
711
733
  state = this.stateCache.get(path+'battery.unit.2.SN');
712
- if (state && state?.value !== '') this.deviceInfo.numberBatteryUnits += 1;
734
+ if (state && state?.value !== '') this.deviceInfo.numberBatteryUnits = 2;
713
735
  }
714
736
  },
715
737
  {
package/lib/register.js CHANGED
@@ -134,7 +134,7 @@ class Registers {
134
134
  //state
135
135
  async initState(path, state) {
136
136
  //this.adapter.log.debug('[_initStat] path+id '+path+state.id);
137
- await this.adapter.extendObjectAsync(path+state.id, {
137
+ await this.adapter.extendObject(path+state.id, {
138
138
  type: 'state',
139
139
  common: {
140
140
  name: state.name,
@@ -157,7 +157,7 @@ class Registers {
157
157
  if (stateEntry.value !== null) {
158
158
  try {
159
159
  stateEntry.stored = true;
160
- await this.adapter.setStateAsync(stateEntry.id, {val: stateEntry.value , ack: true});
160
+ await this.adapter.setState(stateEntry.id, {val: stateEntry.value , ack: true});
161
161
  this.adapter.logger.debug(`Fetched ${stateEntry.id}, val=${stateEntry.value}`);
162
162
  } catch (err) {
163
163
  stateEntry.stored = false;
@@ -203,11 +203,11 @@ class Registers {
203
203
 
204
204
  //state
205
205
  async _loadStates() {
206
- let state = await this.adapter.getStateAsync('collected.gridExportStart');
206
+ let state = await this.adapter.getState('collected.gridExportStart');
207
207
  this.stateCache.set('collected.gridExportStart',state?.val, {type : 'number', stored : true });
208
- state = await this.adapter.getStateAsync('collected.gridImportStart');
208
+ state = await this.adapter.getState('collected.gridImportStart');
209
209
  this.stateCache.set('collected.gridImportStart',state?.val, {type : 'number', stored : true });
210
- state = await this.adapter.getStateAsync('collected.consumptionStart');
210
+ state = await this.adapter.getState('collected.consumptionStart');
211
211
  this.stateCache.set('collected.consumptionStart',state?.val, {type : 'number', stored : true });
212
212
  }
213
213
 
package/main.js CHANGED
@@ -74,14 +74,14 @@ class Sun2000 extends utils.Adapter {
74
74
 
75
75
  async initPath() {
76
76
  //inverter
77
- await this.extendObjectAsync('meter', {
77
+ await this.extendObject('meter', {
78
78
  type: 'device',
79
79
  common: {
80
80
  name: 'device meter'
81
81
  },
82
82
  native: {}
83
83
  });
84
- await this.extendObjectAsync('collected', {
84
+ await this.extendObject('collected', {
85
85
  type: 'channel',
86
86
  common: {
87
87
  name: 'channel collected'
@@ -89,7 +89,7 @@ class Sun2000 extends utils.Adapter {
89
89
  native: {}
90
90
  });
91
91
 
92
- await this.extendObjectAsync('inverter', {
92
+ await this.extendObject('inverter', {
93
93
  type: 'device',
94
94
  common: {
95
95
  name: 'device inverter'
@@ -101,7 +101,7 @@ class Sun2000 extends utils.Adapter {
101
101
  if (item.driverClass == driverClasses.inverter) {
102
102
  const path = 'inverter.'+item.index.toString();
103
103
  item.path = path;
104
- await this.extendObjectAsync(path, {
104
+ await this.extendObject(path, {
105
105
  type: 'channel',
106
106
  common: {
107
107
  name: 'channel inverter '+item.index.toString(),
@@ -110,7 +110,7 @@ class Sun2000 extends utils.Adapter {
110
110
  native: {}
111
111
  });
112
112
 
113
- await this.extendObjectAsync(path+'.grid', {
113
+ await this.extendObject(path+'.grid', {
114
114
  type: 'channel',
115
115
  common: {
116
116
  name: 'channel grid'
@@ -118,7 +118,7 @@ class Sun2000 extends utils.Adapter {
118
118
  native: {}
119
119
  });
120
120
 
121
- await this.extendObjectAsync(path+'.info', {
121
+ await this.extendObject(path+'.info', {
122
122
  type: 'channel',
123
123
  common: {
124
124
  name: 'channel info',
@@ -127,7 +127,7 @@ class Sun2000 extends utils.Adapter {
127
127
  native: {}
128
128
  });
129
129
 
130
- await this.extendObjectAsync(path+'.battery', {
130
+ await this.extendObject(path+'.battery', {
131
131
  type: 'channel',
132
132
  common: {
133
133
  name: 'channel battery'
@@ -135,7 +135,7 @@ class Sun2000 extends utils.Adapter {
135
135
  native: {}
136
136
  });
137
137
 
138
- await this.extendObjectAsync(path+'.string', {
138
+ await this.extendObject(path+'.string', {
139
139
  type: 'channel',
140
140
  common: {
141
141
  name: 'channel string'
@@ -143,7 +143,7 @@ class Sun2000 extends utils.Adapter {
143
143
  native: {}
144
144
  });
145
145
 
146
- await this.extendObjectAsync(path+'.derived', {
146
+ await this.extendObject(path+'.derived', {
147
147
  type: 'channel',
148
148
  common: {
149
149
  name: 'channel derived'
@@ -154,7 +154,7 @@ class Sun2000 extends utils.Adapter {
154
154
 
155
155
  if (item.driverClass == driverClasses.sdongle) {
156
156
  item.path = '';
157
- await this.extendObjectAsync(item.path+'sdongle', {
157
+ await this.extendObject(item.path+'sdongle', {
158
158
  type: 'device',
159
159
  common: {
160
160
  name: 'device SDongle'
@@ -166,7 +166,7 @@ class Sun2000 extends utils.Adapter {
166
166
  //v0.5.x
167
167
  if (item.driverClass == driverClasses.logger) {
168
168
  item.path = '';
169
- await this.extendObjectAsync(item.path+'slogger', {
169
+ await this.extendObject(item.path+'slogger', {
170
170
  type: 'device',
171
171
  common: {
172
172
  name: 'device SmartLogger'
@@ -295,7 +295,7 @@ class Sun2000 extends utils.Adapter {
295
295
  this.logger.warn('Please check your configuration!');
296
296
  }
297
297
  }
298
- await this.setStateAsync('info.modbusUpdateInterval', {val: newHighInterval, ack: true});
298
+ await this.setState('info.modbusUpdateInterval', {val: newHighInterval, ack: true});
299
299
  }
300
300
 
301
301
  /**
@@ -308,13 +308,13 @@ class Sun2000 extends utils.Adapter {
308
308
  this.config.timeout = this.config.timeout*1000;
309
309
  this.updateConfig(this.config);
310
310
  }
311
- await this.setStateAsync('info.ip', {val: this.config.address, ack: true});
312
- await this.setStateAsync('info.port', {val: this.config.port, ack: true});
313
- await this.setStateAsync('info.modbusIds', {val: this.config.modbusIds, ack: true});
314
- await this.setStateAsync('info.modbusTimeout', {val: this.config.timeout, ack: true});
315
- await this.setStateAsync('info.modbusConnectDelay', {val: this.config.connectDelay, ack: true});
316
- await this.setStateAsync('info.modbusDelay', {val: this.config.delay, ack: true});
317
- await this.setStateAsync('info.modbusTcpServer', {val: this.config.ms_active, ack: true});
311
+ await this.setState('info.ip', {val: this.config.address, ack: true});
312
+ await this.setState('info.port', {val: this.config.port, ack: true});
313
+ await this.setState('info.modbusIds', {val: this.config.modbusIds, ack: true});
314
+ await this.setState('info.modbusTimeout', {val: this.config.timeout, ack: true});
315
+ await this.setState('info.modbusConnectDelay', {val: this.config.connectDelay, ack: true});
316
+ await this.setState('info.modbusDelay', {val: this.config.delay, ack: true});
317
+ await this.setState('info.modbusTcpServer', {val: this.config.ms_active, ack: true});
318
318
  // Load user settings
319
319
  if (this.config.address != '' && this.config.port > 0 && this.config.modbusIds != '' && this.config.updateInterval > 0 ) {
320
320
  this.settings.address = this.config.address;
@@ -341,9 +341,9 @@ class Sun2000 extends utils.Adapter {
341
341
  this.settings.cb.tou = this.config.cb_tou;
342
342
 
343
343
  if (this.settings.modbusAdjust) {
344
- await this.setStateAsync('info.JSONhealth', {val: '{message: "Adjust modbus settings"}', ack: true});
344
+ await this.setState('info.JSONhealth', {val: '{message: "Adjust modbus settings"}', ack: true});
345
345
  } else {
346
- await this.setStateAsync('info.JSONhealth', {val: '{message : "Information is collected"}', ack: true});
346
+ await this.setState('info.JSONhealth', {val: '{message : "Information is collected"}', ack: true});
347
347
  }
348
348
 
349
349
  if (this.settings.modbusIds.length > 0 && this.settings.modbusIds.length < 6) {
@@ -443,7 +443,7 @@ class Sun2000 extends utils.Adapter {
443
443
  if (this.isConnected !== lastIsConnected ) this.setState('info.connection', this.isConnected, true);
444
444
  if (!this.settings.modbusAdjust) {
445
445
  if (!this.isConnected) {
446
- this.setStateAsync('info.JSONhealth', {val: '{errno:1, message: "Can\'t connect to inverter"}', ack: true});
446
+ this.setState('info.JSONhealth', {val: '{errno:1, message: "Can\'t connect to inverter"}', ack: true});
447
447
  }
448
448
  const ret = this.state.CheckReadError(this.settings.lowInterval*2);
449
449
  const obj = {...ret,modbus: {...this.modbusClient.info}};
@@ -453,7 +453,7 @@ class Sun2000 extends utils.Adapter {
453
453
  // after 2 Minutes
454
454
  if (this.alreadyRunWatchDog) {
455
455
  if (ret.errno) this.logger.warn(ret.message);
456
- this.setStateAsync('info.JSONhealth', {val: JSON.stringify(obj), ack: true});
456
+ this.setState('info.JSONhealth', {val: JSON.stringify(obj), ack: true});
457
457
  if (this.modbusServer) {
458
458
  !this.modbusServer.isConnected && this.modbusServer.connect();
459
459
  if (this.settings.ms.log) {
@@ -471,7 +471,7 @@ class Sun2000 extends utils.Adapter {
471
471
  this.lastStateUpdatedHigh = 0;
472
472
 
473
473
  if (sinceLastUpdate > this.settings.highInterval*10) {
474
- this.setStateAsync('info.JSONhealth', {val: '{errno:2, message: "Internal loop error"}', ack: true});
474
+ this.setState('info.JSONhealth', {val: '{errno:2, message: "Internal loop error"}', ack: true});
475
475
  this.logger.warn('watchdog: restart Adapter...');
476
476
  this.restart();
477
477
  }
@@ -490,13 +490,13 @@ class Sun2000 extends utils.Adapter {
490
490
  */
491
491
  onUnload(callback) {
492
492
  try {
493
- this.setState('info.connection', false, true);
493
+ this.logger.info('cleaned everything up...');
494
494
  this.modbusServer && this.modbusServer.close();
495
495
  this.pollingTimer && this.clearTimeout(this.pollingTimer);
496
496
  this.mitnightTimer && this.clearTimeout(this.mitnightTimer);
497
497
  this.watchDogHandle && this.clearInterval(this.watchDogHandle);
498
498
  this.modbusClient && this.modbusClient.close();
499
- this.logger.info('cleaned everything up...');
499
+ this.setState('info.connection', false, true);
500
500
  callback();
501
501
  } catch (e) {
502
502
  callback();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.sun2000",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "sun2000",
5
5
  "author": {
6
6
  "name": "bolliy",
@@ -22,34 +22,34 @@
22
22
  "node": ">= 18"
23
23
  },
24
24
  "dependencies": {
25
- "@iobroker/adapter-core": "^3.1.4",
26
- "modbus-serial": "^8.0.16",
25
+ "@iobroker/adapter-core": "^3.1.6",
26
+ "modbus-serial": "^8.0.17",
27
27
  "suncalc2": "^1.8.1",
28
28
  "tcp-port-used": "^1.0.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@alcalzone/release-script": "^3.7.0",
32
- "@alcalzone/release-script-plugin-iobroker": "^3.7.0",
32
+ "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
33
33
  "@alcalzone/release-script-plugin-license": "^3.7.0",
34
34
  "@alcalzone/release-script-plugin-manual-review": "^3.7.0",
35
35
  "@iobroker/adapter-dev": "^1.3.0",
36
36
  "@iobroker/testing": "^4.1.3",
37
37
  "@tsconfig/node16": "^16.1.3",
38
- "@types/chai": "^4.3.14",
38
+ "@types/chai": "^4.3.16",
39
39
  "@types/chai-as-promised": "^7.1.8",
40
- "@types/mocha": "^10.0.4",
41
- "@types/node": "^20.12.2",
40
+ "@types/mocha": "^10.0.7",
41
+ "@types/node": "^20.14.9",
42
42
  "@types/proxyquire": "^1.3.31",
43
43
  "@types/sinon": "^17.0.3",
44
44
  "@types/sinon-chai": "^3.2.12",
45
- "chai": "^4.3.10",
46
- "chai-as-promised": "^7.1.1",
45
+ "chai": "^4.4.1",
46
+ "chai-as-promised": "^7.1.2",
47
47
  "eslint": "^8.57.0",
48
- "mocha": "^10.2.0",
48
+ "mocha": "^10.5.2",
49
49
  "proxyquire": "^2.1.3",
50
- "sinon": "^17.0.1",
50
+ "sinon": "^18.0.0",
51
51
  "sinon-chai": "^3.7.0",
52
- "typescript": "~5.4.3"
52
+ "typescript": "~5.5.2"
53
53
  },
54
54
  "main": "main.js",
55
55
  "files": [