iobroker.senec 1.6.10 → 1.6.12
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 +2 -2
- package/README.md +10 -11
- package/admin/jsonConfig.json +1 -1
- package/io-package.json +27 -27
- package/lib/api_trans.js +6 -6
- package/main.js +19 -14
- package/package.json +16 -16
package/LICENSE
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2024 NoBl <github@bluemle.org>
|
|
2
2
|
|
|
3
3
|
MIT License
|
|
4
4
|
|
|
5
|
-
Copyright (c)
|
|
5
|
+
Copyright (c) 2024 Author <author@mail.com>
|
|
6
6
|
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -298,6 +298,15 @@ This channel contains values polled from SENEC App-API.
|
|
|
298
298
|
|
|
299
299
|
|
|
300
300
|
## Changelog
|
|
301
|
+
|
|
302
|
+
### 1.6.12 (NoBl)
|
|
303
|
+
* Updated license
|
|
304
|
+
|
|
305
|
+
### 1.6.11 (NoBl)
|
|
306
|
+
* Moving from Senec App API 3.12.0 to 4.3.3 (thanks to oakdesign@github for providing the new API!)
|
|
307
|
+
* This WILL invalidate all current API datapoints in the Statistik branch. Easiest solution to this: Delete the Statistik branch.
|
|
308
|
+
* Remember to force a rebuild of historic data in adapter settings!
|
|
309
|
+
|
|
301
310
|
### 1.6.10 (NoBl)
|
|
302
311
|
* Bugfix for AllTimeHistory (should work again)
|
|
303
312
|
|
|
@@ -338,22 +347,12 @@ This channel contains values polled from SENEC App-API.
|
|
|
338
347
|
* Added option to also poll SENEC App API. This requires user credentials for mein-senec.de
|
|
339
348
|
* We are starting with just some information - more to follow. But with Dashboard we at least have current values and day statistics back.
|
|
340
349
|
|
|
341
|
-
### 1.5.1 (NoBl)
|
|
342
|
-
* Added more datapoints. If you experience messages in log - feel free to add them yourself to state_attr on github (pull request)
|
|
343
|
-
* Autarky calculations will stopp working because SENEC removed STATISTICS branch.
|
|
344
|
-
* If you experience issues with connecting to your appliance after it got updated, please activate https connection in settings.
|
|
345
|
-
|
|
346
|
-
### 1.5.0 (NoBl)
|
|
347
|
-
* Added configuration section to add datapoints to high priority polling. Please be aware of the possible issues this could cause (if too many datapoints added) and use at your own risk.
|
|
348
|
-
* ALL Wallbox datapoints have been removed from high priority polling. Only some users even have a SENEC wallbox. Please reconfigure via the new config dialogue.
|
|
349
|
-
* Possible Candidate for stable. Please report any findings!
|
|
350
|
-
|
|
351
350
|
### [Former Updates](CHANGELOG_old.md)
|
|
352
351
|
|
|
353
352
|
## License
|
|
354
353
|
MIT License
|
|
355
354
|
|
|
356
|
-
Copyright (c)
|
|
355
|
+
Copyright (c) 2024 Norbert Bluemle <github@bluemle.org>
|
|
357
356
|
|
|
358
357
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
359
358
|
of this software and associated documentation files (the "Software"), to deal
|
package/admin/jsonConfig.json
CHANGED
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "senec",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.12",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.6.12": {
|
|
7
|
+
"en": "Updated license",
|
|
8
|
+
"de": "Lizenz aktualisiert",
|
|
9
|
+
"ru": "Обновленная лицензия",
|
|
10
|
+
"pt": "Licença atualizada",
|
|
11
|
+
"nl": "Bijgewerkte licentie",
|
|
12
|
+
"fr": "Licence actualisée",
|
|
13
|
+
"it": "Licenza aggiornata",
|
|
14
|
+
"es": "Licencia actualizada",
|
|
15
|
+
"pl": "Aktualizacja licencji",
|
|
16
|
+
"uk": "Оновлена ліцензія",
|
|
17
|
+
"zh-cn": "更新许可证"
|
|
18
|
+
},
|
|
19
|
+
"1.6.11": {
|
|
20
|
+
"en": "Moving from Senec App API 3.12.0 to 4.3.3 (thanks to oakdesign@github for providing the new API!). This WILL invalidate all current API datapoints in the Statistik branch. Easiest solution to this: Delete the Statistik branch. Remember to force a rebuild of historic data in adapter settings!",
|
|
21
|
+
"de": "Update der Senec App API 3.12.0 auf 4.3.3 (Dank an Oakdesign@github für die Analyse der neuen API.)! Dadurch werden leider alle aktuellen API-Datenpunkte im Statistik-Zweig ungültig. Einfachste Lösung hierfür: Den gesamten Statistik-Zweig löschen. Beachten: Die Gesamthistorie muss neu berechnet werden (Parameter in den Adaptereinstellungen)!",
|
|
22
|
+
"ru": "Переезд с Senec App API 3.12.0 до 4.3.3 (спасибо oakdesign@github для предоставления нового API.)! Это недействит все текущие точки API в филиале Statistik. Самое легкое решение для этого: Удалите филиал Statistik. Не забудьте заставить восстановить исторические данные в настройках адаптера!",
|
|
23
|
+
"pt": "Movendo de Senec App API 3.12.0 para 4.3.3 (graças para oakdesign@github para fornecer a nova API.)! Esta WILL invalida todos os datapoints API atuais no ramo Statistik. Solução mais fácil para isso: Excluir o ramo Statistik. Lembre-se de forçar uma reconstrução de dados históricos em configurações de adaptador!",
|
|
24
|
+
"nl": "Verhuizen van Senec App API 3.12.0 tot 4.3.3.3 uur tot Oakdesign @github voor de nieuwe API. Dit zal alle huidige API gegevens in de Statistik Branch invaliden. Verwijder de statistik tak. Vergeet niet een herbouw van historische gegevens te forceren in adapter settings!",
|
|
25
|
+
"fr": "Déplacement de Senec App API 3.12.0 à 4.3.3 (merci à Oakdesign@github pour fournir la nouvelle API.)! Ce WILL invalide tous les points de données API actuels dans la branche Statistik. Solution la plus facile à cela: Supprimer la branche Statistik. N'oubliez pas de forcer une reconstruction des données historiques dans les réglages d'adaptateur!",
|
|
26
|
+
"it": "Passando da Senec App API 3.12.0 a 4.3.3 (grazie a Oakdesign@github per fornire la nuova API.)! Questo WILL invalida tutti i datapoint API attuali nel ramo Statistik. Soluzione più semplice a questo: Elimina il ramo Statistik. Ricordatevi di forzare una ricostruzione dei dati storici nelle impostazioni dell'adattatore!",
|
|
27
|
+
"es": "Moving from Senec App API 3.12.0 to 4.3.3 (gracias a oakdesign@github para proporcionar la nueva API.)! Esto invalidará todos los puntos de datos actuales de la API en la rama Statistik. Solución más fácil: Eliminar la rama Statistik. Recuerde forzar una reconstrucción de datos históricos en la configuración del adaptador!",
|
|
28
|
+
"pl": "Przewidując się z interfejsu Senec App API 3,12.0 to 4.3.3 (dodatki do dębowego @github dla zapewnienia nowego API). WILL uszkodził wszystkie aktualne punkty danych API w oddziale Statistik. Najwięcej rozwiązań do tego: Dete the Statistik branch. Pamiętaj, aby odbudować historyczne dane w ustawieniach adapterów!",
|
|
29
|
+
"uk": "Переміщення від Senec App API 3.12.0 до 4.3.3 (завдяки до дубdesign@github для надання нового API.)! Це недійсне використання всіх поточних точок даних API у відділенні Statistik. Найсвіжіші рішення для цього: Видаліть статутне відділення. Пам'ятайте, що змусити перебудувати історичні дані в налаштуваннях адаптера!",
|
|
30
|
+
"zh-cn": "Moving from Senecapp API3.12.0 to 4.3.3 (as to oakdesign@github for the new API.!) 本协会在斯塔特斯科分处停止了目前所有阿联酋数据点。 最容易解决这一问题:删除斯塔特主义分支。 重新成员在适应环境中重建历史数据!"
|
|
31
|
+
},
|
|
6
32
|
"1.6.10": {
|
|
7
33
|
"en": "Bugfix for AllTimeHistory",
|
|
8
34
|
"de": "Bugfix für AllTimeHistory",
|
|
@@ -119,32 +145,6 @@
|
|
|
119
145
|
"pl": "Wstępne dane z API wraz z kilkoma własnymi obliczeniami.",
|
|
120
146
|
"uk": "Додано значення статистичних даних з API разом з деякими власними підрахунками.",
|
|
121
147
|
"zh-cn": "加上非传染性疾病的统计价值以及一些本身的计算。."
|
|
122
|
-
},
|
|
123
|
-
"1.6.1": {
|
|
124
|
-
"en": "Bugfixes for API reading.",
|
|
125
|
-
"de": "Bugfixes im API Handling.",
|
|
126
|
-
"ru": "Bugfixes для чтения API.",
|
|
127
|
-
"pt": "Bugfixes para leitura de API.",
|
|
128
|
-
"nl": "Bugfixes voor API-lezing.",
|
|
129
|
-
"fr": "Bugfixes pour la lecture de l'API.",
|
|
130
|
-
"it": "Bugfixes per la lettura API.",
|
|
131
|
-
"es": "Bugfixes para la lectura de API.",
|
|
132
|
-
"pl": "Bugfixes for API reading (ang.).",
|
|
133
|
-
"uk": "Виправлення помилок для читання API.",
|
|
134
|
-
"zh-cn": "评 注."
|
|
135
|
-
},
|
|
136
|
-
"1.6.0": {
|
|
137
|
-
"en": "You can now configure to request SENEC App API.",
|
|
138
|
-
"de": "Sie können nun die SENEC App API abfragen.",
|
|
139
|
-
"ru": "Теперь вы можете настроить для запроса SENEC App API.",
|
|
140
|
-
"pt": "Agora você pode configurar para solicitar a API do SENEC App.",
|
|
141
|
-
"nl": "Je kunt nu configureren om SENEC App API te vragen.",
|
|
142
|
-
"fr": "Vous pouvez maintenant configurer pour demander l'API App SENEC.",
|
|
143
|
-
"it": "Ora è possibile configurare per richiedere l'API SENEC App.",
|
|
144
|
-
"es": "Ahora puede configurarse para solicitar SENEC App API.",
|
|
145
|
-
"pl": "Możesz teraz skonfigurować żądanie SENEC App API.",
|
|
146
|
-
"uk": "Ви можете налаштувати запит на SENEC App API.",
|
|
147
|
-
"zh-cn": "如今,你可以准备要求SENECSP。."
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
"docs": {
|
package/lib/api_trans.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
const api_trans = {
|
|
2
2
|
'THIS_DAY': {
|
|
3
|
-
api: '
|
|
3
|
+
api: 'DAY',
|
|
4
4
|
dp: 'Today'
|
|
5
5
|
},
|
|
6
6
|
'LAST_DAY': {
|
|
7
|
-
api: '
|
|
7
|
+
api: 'DAY',
|
|
8
8
|
dp: 'Yesterday'
|
|
9
9
|
},
|
|
10
10
|
'THIS_MONTH': {
|
|
11
|
-
api: '
|
|
11
|
+
api: 'MONTH',
|
|
12
12
|
dp: 'This Month'
|
|
13
13
|
},
|
|
14
14
|
'LAST_MONTH': {
|
|
15
|
-
api: '
|
|
15
|
+
api: 'MONTH',
|
|
16
16
|
dp: 'Last Month'
|
|
17
17
|
},
|
|
18
18
|
'THIS_YEAR': {
|
|
19
|
-
api: '
|
|
19
|
+
api: 'YEAR',
|
|
20
20
|
dp: 'This Year'
|
|
21
21
|
},
|
|
22
22
|
'LAST_YEAR': {
|
|
23
|
-
api: '
|
|
23
|
+
api: 'YEAR',
|
|
24
24
|
dp: 'Last Year'
|
|
25
25
|
}
|
|
26
26
|
|
package/main.js
CHANGED
|
@@ -17,9 +17,10 @@ const state_trans = require(__dirname + '/lib/state_trans.js');
|
|
|
17
17
|
const api_trans = require(__dirname + '/lib/api_trans.js');
|
|
18
18
|
const kiloList = ["W", "Wh"];
|
|
19
19
|
|
|
20
|
-
const apiUrl = "https://app-gateway
|
|
20
|
+
const apiUrl = "https://app-gateway.prod.senec.dev/v1/senec";
|
|
21
21
|
const apiLoginUrl = apiUrl + "/login";
|
|
22
|
-
const apiSystemsUrl = apiUrl + "/
|
|
22
|
+
const apiSystemsUrl = apiUrl + "/systems";
|
|
23
|
+
const apiMonitorUrl = apiUrl + "/monitor";
|
|
23
24
|
const apiKnownSystems = []
|
|
24
25
|
|
|
25
26
|
const batteryOn = '{"ENERGY":{"SAFE_CHARGE_FORCE":"u8_01","SAFE_CHARGE_PROHIBIT":"","SAFE_CHARGE_RUNNING":"","LI_STORAGE_MODE_START":"","LI_STORAGE_MODE_STOP":"","LI_STORAGE_MODE_RUNNING":"","STAT_STATE":""}}';
|
|
@@ -473,6 +474,7 @@ class Senec extends utils.Adapter {
|
|
|
473
474
|
try {
|
|
474
475
|
for (let i = 0; i < apiKnownSystems.length; i++) {
|
|
475
476
|
const baseUrl = apiSystemsUrl + "/" + apiKnownSystems[i];
|
|
477
|
+
const baseUrlMonitor = apiMonitorUrl + "/" + apiKnownSystems[i];
|
|
476
478
|
var url = "";
|
|
477
479
|
const tzObj = await this.getStateAsync("_api.Anlagen." + apiKnownSystems[i] + ".zeitzone");
|
|
478
480
|
const tz = tzObj ? encodeURIComponent(tzObj.val) : encodeURIComponent("Europe/Berlin");
|
|
@@ -484,7 +486,8 @@ class Senec extends utils.Adapter {
|
|
|
484
486
|
|
|
485
487
|
for (let[key, value] of dates.entries()) {
|
|
486
488
|
// statistik for period
|
|
487
|
-
url =
|
|
489
|
+
url = baseUrlMonitor + "/data?period=" + api_trans[key].api + "&date=" + value + "&locale=de_DE&timezone=" + tz;
|
|
490
|
+
this.log.debug("Calling: " + url);
|
|
488
491
|
body = await this.doGet(url, "", this, this.config.pollingTimeout, false);
|
|
489
492
|
await this.decodeStatistik(apiKnownSystems[i], JSON.parse(body), api_trans[key].dp);
|
|
490
493
|
}
|
|
@@ -535,20 +538,20 @@ class Senec extends utils.Adapter {
|
|
|
535
538
|
const pfx = "_api.Anlagen." + system + ".Statistik." + period + ".";
|
|
536
539
|
for (const[key, value] of Object.entries(obj.aggregation)) {
|
|
537
540
|
// only reading 'aggregation' - no interest in fine granular information
|
|
538
|
-
if (key == "
|
|
541
|
+
if (key == "startDate") {
|
|
539
542
|
await this.doState(pfx + key, value, "", "", false);
|
|
540
543
|
} else {
|
|
541
544
|
if (!this.config.api_alltimeRebuild) { // don't update DPs if we are AllTime-Rebuild-Process
|
|
542
|
-
await this.doState(pfx + key, Number((value.
|
|
543
|
-
if (kiloList.includes(value.
|
|
544
|
-
await this.doState(pfx + key + " (k"+ value.
|
|
545
|
+
await this.doState(pfx + key, Number((value.value).toFixed(2)), "", value.unit, false);
|
|
546
|
+
if (kiloList.includes(value.unit)) {
|
|
547
|
+
await this.doState(pfx + key + " (k"+ value.unit + ")", Number((value.value / 1000).toFixed(2)), "", "k" + value.unit, false);
|
|
545
548
|
}
|
|
546
549
|
}
|
|
547
|
-
if (period == api_trans["THIS_YEAR"].dp) await this.insertAllTimeHistory(system, key, new Date(obj.aggregation.
|
|
550
|
+
if (period == api_trans["THIS_YEAR"].dp) await this.insertAllTimeHistory(system, key, new Date(obj.aggregation.startDate).getFullYear(), Number((value.value).toFixed(0)), value.unit);
|
|
548
551
|
}
|
|
549
552
|
}
|
|
550
|
-
if (obj.aggregation.
|
|
551
|
-
const autarky = Number((((obj.aggregation.
|
|
553
|
+
if (obj.aggregation.totalUsage.value != 0) {
|
|
554
|
+
const autarky = Number((((obj.aggregation.generation.value - obj.aggregation.gridFeedIn.value - obj.aggregation.storageLoad.value + obj.aggregation.storageConsumption.value) / obj.aggregation.totalUsage.value) * 100).toFixed(2));
|
|
552
555
|
await this.doState(pfx + "Autarkie", autarky, "", "%", false);
|
|
553
556
|
}
|
|
554
557
|
await this.updateAllTimeHistory(system);
|
|
@@ -558,6 +561,7 @@ class Senec extends utils.Adapter {
|
|
|
558
561
|
* inserts a value for a given key and year into AllTimeValueStore
|
|
559
562
|
*/
|
|
560
563
|
async insertAllTimeHistory(system, key, year, value, einheit) {
|
|
564
|
+
this.log.debug("Insert AllTimeHistory: " + system + "/" + "key" + "/" + year + "/" + value + "/" + einheit);
|
|
561
565
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') return; // Security fix
|
|
562
566
|
if (isNaN(year) || isNaN(value)) return; // Security fix
|
|
563
567
|
const pfx = "_api.Anlagen." + system + ".Statistik.AllTime.";
|
|
@@ -597,8 +601,8 @@ class Senec extends utils.Adapter {
|
|
|
597
601
|
await this.doState(pfx + key, Number(sum.toFixed(0)), "", einheit, false);
|
|
598
602
|
}
|
|
599
603
|
}
|
|
600
|
-
if (sums.
|
|
601
|
-
const autarky = Number((((sums.
|
|
604
|
+
if (sums.totalUsage != 0) {
|
|
605
|
+
const autarky = Number((((sums.generation - sums.gridFeedIn - sums.storageLoad + sums.storageConsumption) / sums.totalUsage) * 100).toFixed(0));
|
|
602
606
|
await this.doState(pfx + "Autarkie", autarky, "", "%", false);
|
|
603
607
|
}
|
|
604
608
|
}
|
|
@@ -618,11 +622,12 @@ class Senec extends utils.Adapter {
|
|
|
618
622
|
try {
|
|
619
623
|
while (new Date(year).getFullYear() > 2008) { // senec was founded in 2009 by Mathias Hammer as Deutsche Energieversorgung GmbH (DEV) - so no way we have older data :)
|
|
620
624
|
this.log.info("Rebuilding AllTime History - Year: " + new Date(year).getFullYear());
|
|
621
|
-
const baseUrl =
|
|
625
|
+
const baseUrl = apiMonitorUrl + "/" + system;
|
|
622
626
|
var url = "";
|
|
623
627
|
const tzObj = await this.getStateAsync("_api.Anlagen." + system + ".zeitzone");
|
|
624
628
|
const tz = tzObj ? encodeURIComponent(tzObj.val) : encodeURIComponent("Europe/Berlin");
|
|
625
|
-
url = baseUrl + "/
|
|
629
|
+
url = baseUrl + "/data?period=YEAR&date=" + year + "&locale=de_DE&timezone=" + tz;
|
|
630
|
+
this.log.debug("Polling: " + url);
|
|
626
631
|
body = await this.doGet(url, "", this, this.config.pollingTimeout, false);
|
|
627
632
|
await this.decodeStatistik(system, JSON.parse(body), api_trans["THIS_YEAR"].dp);
|
|
628
633
|
year = new Date(new Date(year).getFullYear() - 1, 1, 1).toISOString().split('T')[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.senec",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.12",
|
|
4
4
|
"description": "Senec Home",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "NoBl",
|
|
@@ -27,32 +27,32 @@
|
|
|
27
27
|
"url": "https://github.com/nobl/ioBroker.senec.git"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"axios": "^1.
|
|
30
|
+
"axios": "^1.6.3",
|
|
31
31
|
"@iobroker/adapter-core": "^2.6.8"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@alcalzone/release-script": "^3.
|
|
35
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.
|
|
36
|
-
"@alcalzone/release-script-plugin-license": "^3.
|
|
37
|
-
"@alcalzone/release-script-plugin-manual-review": "^3.
|
|
34
|
+
"@alcalzone/release-script": "^3.7.0",
|
|
35
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.7.0",
|
|
36
|
+
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
37
|
+
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
38
38
|
"@iobroker/adapter-dev": "^1.2.0",
|
|
39
39
|
"@iobroker/testing": "^4.1.0",
|
|
40
40
|
"@tsconfig/node14": "^14.1.0",
|
|
41
41
|
"@types/chai": "^4.3.6",
|
|
42
|
-
"@types/chai-as-promised": "^7.1.
|
|
43
|
-
"@types/mocha": "^10.0.
|
|
44
|
-
"@types/node": "^20.
|
|
45
|
-
"@types/proxyquire": "^1.3.
|
|
46
|
-
"@types/sinon": "^
|
|
47
|
-
"@types/sinon-chai": "^3.2.
|
|
48
|
-
"chai": "^4.
|
|
42
|
+
"@types/chai-as-promised": "^7.1.8",
|
|
43
|
+
"@types/mocha": "^10.0.6",
|
|
44
|
+
"@types/node": "^20.11.14",
|
|
45
|
+
"@types/proxyquire": "^1.3.31",
|
|
46
|
+
"@types/sinon": "^17.0.3",
|
|
47
|
+
"@types/sinon-chai": "^3.2.12",
|
|
48
|
+
"chai": "^4.4.1",
|
|
49
49
|
"chai-as-promised": "^7.1.1",
|
|
50
|
-
"eslint": "^8.
|
|
50
|
+
"eslint": "^8.56.0",
|
|
51
51
|
"mocha": "^10.2.0",
|
|
52
52
|
"proxyquire": "^2.1.3",
|
|
53
|
-
"sinon": "^
|
|
53
|
+
"sinon": "^17.0.1",
|
|
54
54
|
"sinon-chai": "^3.7.0",
|
|
55
|
-
"typescript": "~5.
|
|
55
|
+
"typescript": "~5.3.3"
|
|
56
56
|
},
|
|
57
57
|
"main": "main.js",
|
|
58
58
|
"files": [
|