iobroker.senec 1.3.2 → 1.3.5-beta
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 +3 -1
- package/README.md +12 -2
- package/io-package.json +55 -194
- package/lib/adapter-config.d.ts +18 -18
- package/lib/state_attr.js +1541 -269
- package/lib/state_trans.js +282 -0
- package/lib/tools.js +99 -98
- package/main.js +92 -54
- package/package.json +34 -24
- package/CHANGELOG_old.md +0 -68
- package/admin/admin.d.ts +0 -93
- package/docs/de/README.md +0 -574
- package/docs/de/media/mainSettings.png +0 -0
- package/docs/en/README.md +0 -554
- package/docs/en/media/mainSettings.png +0 -0
- package/main.test.js +0 -30
package/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const utils = require('@iobroker/adapter-core');
|
|
4
|
-
const
|
|
4
|
+
const axios = require('axios');
|
|
5
5
|
const state_attr = require(__dirname + '/lib/state_attr.js');
|
|
6
6
|
const state_trans = require(__dirname + '/lib/state_trans.js');
|
|
7
7
|
|
|
@@ -66,29 +66,29 @@ class Senec extends utils.Adapter {
|
|
|
66
66
|
* Fallback to default values in case they are out of scope
|
|
67
67
|
*/
|
|
68
68
|
async checkConfig() {
|
|
69
|
-
this.log.debug("Configured polling interval high priority: " + this.config.interval);
|
|
69
|
+
this.log.debug("(checkConf) Configured polling interval high priority: " + this.config.interval);
|
|
70
70
|
if (this.config.interval < 1 || this.config.interval > 3600) {
|
|
71
|
-
this.log.warn("Config interval high priority " + this.config.interval + " not [1..3600] seconds. Using default: 10");
|
|
71
|
+
this.log.warn("(checkConf) Config interval high priority " + this.config.interval + " not [1..3600] seconds. Using default: 10");
|
|
72
72
|
this.config.interval = 10;
|
|
73
73
|
}
|
|
74
|
-
this.log.debug("Configured polling interval low priority: " + this.config.intervalLow);
|
|
74
|
+
this.log.debug("(checkConf) Configured polling interval low priority: " + this.config.intervalLow);
|
|
75
75
|
if (this.config.intervalLow < 60 || this.config.intervalLow > 3600) {
|
|
76
|
-
this.log.warn("Config interval low priority " + this.config.intervalLow + " not [60..3600] minutes. Using default: 60");
|
|
76
|
+
this.log.warn("(checkConf) Config interval low priority " + this.config.intervalLow + " not [60..3600] minutes. Using default: 60");
|
|
77
77
|
this.config.intervalLow = 60;
|
|
78
78
|
}
|
|
79
|
-
this.log.debug("Configured polling timeout: " + this.config.pollingTimeout);
|
|
79
|
+
this.log.debug("(checkConf) Configured polling timeout: " + this.config.pollingTimeout);
|
|
80
80
|
if (this.config.pollingTimeout < 1000 || this.config.pollingTimeout > 10000) {
|
|
81
|
-
this.log.warn("Config timeout " + this.config.pollingTimeout + " not [1000..10000] ms. Using default: 5000");
|
|
81
|
+
this.log.warn("(checkConf) Config timeout " + this.config.pollingTimeout + " not [1000..10000] ms. Using default: 5000");
|
|
82
82
|
this.config.pollingTimeout = 5000;
|
|
83
83
|
}
|
|
84
|
-
this.log.debug("Configured num of retries: " + this.config.retries);
|
|
84
|
+
this.log.debug("(checkConf) Configured num of retries: " + this.config.retries);
|
|
85
85
|
if (this.config.retries < 0 || this.config.retries > 999) {
|
|
86
|
-
this.log.warn("Config num of retries " + this.config.retries + " not [0..999] seconds. Using default: 10");
|
|
86
|
+
this.log.warn("(checkConf) Config num of retries " + this.config.retries + " not [0..999] seconds. Using default: 10");
|
|
87
87
|
this.config.retries = 10;
|
|
88
88
|
}
|
|
89
|
-
this.log.debug("Configured retry multiplier: " + this.config.retrymultiplier);
|
|
89
|
+
this.log.debug("(checkConf) Configured retry multiplier: " + this.config.retrymultiplier);
|
|
90
90
|
if (this.config.retrymultiplier < 1 || this.config.retrymultiplier > 10) {
|
|
91
|
-
this.log.warn("Config retry multiplier " + this.config.retrymultiplier + " not [1..10] seconds. Using default: 2");
|
|
91
|
+
this.log.warn("(checkConf) Config retry multiplier " + this.config.retrymultiplier + " not [1..10] seconds. Using default: 2");
|
|
92
92
|
this.config.retrymultiplier = 2;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -110,30 +110,45 @@ class Senec extends utils.Adapter {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Read from url via
|
|
113
|
+
* Read from url via axios
|
|
114
114
|
* @param url to read from
|
|
115
115
|
* @param form to post
|
|
116
116
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
117
|
+
async doGet(pUrl, pForm, caller, pollingTimeout) {
|
|
118
|
+
return new Promise(function (resolve, reject) {
|
|
119
|
+
axios({
|
|
120
|
+
method: 'post',
|
|
121
|
+
url: pUrl,
|
|
122
|
+
data: pForm,
|
|
123
|
+
timeout: pollingTimeout
|
|
124
|
+
})
|
|
125
|
+
.then(
|
|
126
|
+
async (response) => {
|
|
127
|
+
const content = response.data;
|
|
128
|
+
caller.log.debug('(Poll) received data (' + response.status + '): ' + JSON.stringify(content));
|
|
129
|
+
resolve(JSON.stringify(content));
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
.catch(
|
|
133
|
+
(error) => {
|
|
134
|
+
if (error.response) {
|
|
135
|
+
// The request was made and the server responded with a status code
|
|
136
|
+
caller.log.warn('(Poll) received error ' + error.response.status + ' response from SENEC with content: ' + JSON.stringify(error.response.data));
|
|
137
|
+
reject(error.response.status);
|
|
138
|
+
} else if (error.request) {
|
|
139
|
+
// The request was made but no response was received
|
|
140
|
+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in node.js<div></div>
|
|
141
|
+
caller.log.info(error.message);
|
|
142
|
+
reject(error.message);
|
|
143
|
+
} else {
|
|
144
|
+
// Something happened in setting up the request that triggered an Error
|
|
145
|
+
caller.log.info(error.message);
|
|
146
|
+
reject(error.status);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
137
152
|
|
|
138
153
|
/**
|
|
139
154
|
* Read values from Senec Home V2.1
|
|
@@ -142,7 +157,7 @@ class Senec extends utils.Adapter {
|
|
|
142
157
|
async readSenecV21() {
|
|
143
158
|
// read by webinterface are the following values. Not all are "high priority" though.
|
|
144
159
|
// "STATISTIC":{"STAT_DAY_E_HOUSE":"","STAT_DAY_E_PV":"","STAT_DAY_BAT_CHARGE":"","STAT_DAY_BAT_DISCHARGE":"","STAT_DAY_E_GRID_IMPORT":"","STAT_DAY_E_GRID_EXPORT":"","STAT_YEAR_E_PU1_ARR":""}
|
|
145
|
-
// "ENERGY":{"STAT_STATE":"","
|
|
160
|
+
// "ENERGY":{"STAT_STATE":"","GUI_BAT_DATA_POWER":"","GUI_INVERTER_POWER":"","GUI_HOUSE_POW":"","GUI_GRID_POW":"","STAT_MAINT_REQUIRED":"","GUI_BAT_DATA_FUEL_CHARGE":"","GUI_CHARGING_INFO":"","GUI_BOOSTING_INFO":""}
|
|
146
161
|
// "WIZARD":{"CONFIG_LOADED":""},"SYS_UPDATE":{"UPDATE_AVAILABLE":""}
|
|
147
162
|
// "PV1":{"POWER_RATIO":""},"WIZARD":{"MAC_ADDRESS_BYTES":""},"BAT1OBJ1":{"BMS_NR_INSTALLED":"","SPECIAL_TIMEOUT":"","INV_CYCLE":"","TEMP1":"","TEMP2":"","TEMP3":"","TEMP4":"","TEMP5":"","SW_VERSION":"","SW_VERSION2":"","SW_VERSION3":"","I_DC":""},"BAT1OBJ2":{"TEMP1":"","TEMP2":"","TEMP3":"","TEMP4":"","TEMP5":"","I_DC":""},"BAT1OBJ3":{"TEMP1":"","TEMP2":"","TEMP3":"","TEMP4":"","TEMP5":"","I_DC":""},"PWR_UNIT":{"POWER_L1":"","POWER_L2":"","POWER_L3":""},"BAT1":{"CEI_LIMIT":""},"BMS":{}
|
|
148
163
|
// "PM1OBJ1":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""},"PM1OBJ2":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""}
|
|
@@ -150,9 +165,8 @@ class Senec extends utils.Adapter {
|
|
|
150
165
|
|
|
151
166
|
const url = 'http://' + this.config.senecip + '/lala.cgi';
|
|
152
167
|
var form = '{';
|
|
153
|
-
form += '"ENERGY":{"STAT_STATE":"","
|
|
154
|
-
|
|
155
|
-
form += ',"PV1":{"POWER_RATIO":"","MPP_POWER":"","MPP_INT":""}';
|
|
168
|
+
form += '"ENERGY":{"STAT_STATE":"","GUI_BAT_DATA_POWER":"","GUI_INVERTER_POWER":"","GUI_HOUSE_POW":"","GUI_GRID_POW":"","GUI_BAT_DATA_FUEL_CHARGE":"","GUI_CHARGING_INFO":"","GUI_BOOSTING_INFO":"","GUI_BAT_DATA_POWER":"","GUI_BAT_DATA_VOLTAGE":"","GUI_BAT_DATA_CURRENT":"","GUI_BAT_DATA_FUEL_CHARGE":"","GUI_BAT_DATA_OA_CHARGING":"","STAT_LIMITED_NET_SKEW":""}';
|
|
169
|
+
form += ',"PV1":{"POWER_RATIO":"","MPP_POWER":""}';
|
|
156
170
|
form += ',"PWR_UNIT":{"POWER_L1":"","POWER_L2":"","POWER_L3":""}';
|
|
157
171
|
form += ',"PM1OBJ1":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""}';
|
|
158
172
|
form += ',"PM1OBJ2":{"FREQ":"","U_AC":"","I_AC":"","P_AC":"","P_TOTAL":""}';
|
|
@@ -160,7 +174,13 @@ class Senec extends utils.Adapter {
|
|
|
160
174
|
form += '}';
|
|
161
175
|
|
|
162
176
|
try {
|
|
163
|
-
|
|
177
|
+
var body = await this.doGet(url, form, this, this.config.pollingTimeout);
|
|
178
|
+
if (body.includes('\\"')) {
|
|
179
|
+
// in rare cases senec reports back extra escape sequences on some machines ...
|
|
180
|
+
this.log.info("(Poll) Double escapes detected! Body inc: " + body);
|
|
181
|
+
body = body.replace(/\\"/g, '"');
|
|
182
|
+
this.log.info("(Poll) Double escapes autofixed! Body out: " + body);
|
|
183
|
+
}
|
|
164
184
|
var obj = JSON.parse(body, reviverNumParse);
|
|
165
185
|
await this.evalPoll(obj);
|
|
166
186
|
|
|
@@ -190,7 +210,13 @@ class Senec extends utils.Adapter {
|
|
|
190
210
|
const form = '{"STATISTIC":{},"ENERGY":{},"FEATURES":{},"LOG":{},"SYS_UPDATE":{},"WIZARD":{},"BMS":{},"BAT1":{},"BAT1OBJ1":{},"BAT1OBJ2":{},"BAT1OBJ2":{},"BAT1OBJ3":{},"BAT1OBJ4":{},"PWR_UNIT":{},"PM1OBJ1":{},"PM1OBJ2":{},"PV1":{},"FACTORY":{},"GRIDCONFIG":{},"EG_CONTROL":{},"RTC":{},"PM1":{},"TEMPMEASURE":{},"DEBUG":{},"SOCKETS":{},"CASC":{},"WALLBOX":{},"CONNX50":{},"STECA":{}}';
|
|
191
211
|
|
|
192
212
|
try {
|
|
193
|
-
|
|
213
|
+
var body = await this.doGet(url, form, this, this.config.pollingTimeout);
|
|
214
|
+
if (body.includes('\\"')) {
|
|
215
|
+
// in rare cases senec reports back extra escape sequences on some machines ...
|
|
216
|
+
this.log.info("(Poll) Double escapes detected! Body inc: " + body);
|
|
217
|
+
body = body.replace(/\\"/g, '"');
|
|
218
|
+
this.log.info("(Poll) Double escapes autofixed! Body out: " + body);
|
|
219
|
+
}
|
|
194
220
|
var obj = JSON.parse(body, reviverNumParse);
|
|
195
221
|
|
|
196
222
|
await this.evalPoll(obj);
|
|
@@ -213,6 +239,12 @@ class Senec extends utils.Adapter {
|
|
|
213
239
|
* sets a state's value and creates the state if it doesn't exist yet
|
|
214
240
|
*/
|
|
215
241
|
async doState(name, value, description, unit, write) {
|
|
242
|
+
if (!isNaN(name.substring(0, 1))) {
|
|
243
|
+
// keys cannot start with digits! Possibly SENEC delivering erraneous data
|
|
244
|
+
this.log.debug('(doState) Invalid datapoint: ' + name + ': ' + value);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
this.log.silly('(doState) Update: ' + name + ': ' + value);
|
|
216
248
|
await this.setObjectNotExistsAsync(name, {
|
|
217
249
|
type: 'state',
|
|
218
250
|
common: {
|
|
@@ -229,19 +261,19 @@ class Senec extends utils.Adapter {
|
|
|
229
261
|
// Check object for changes:
|
|
230
262
|
var obj = await this.getObjectAsync(name);
|
|
231
263
|
if (obj.common.name != description) {
|
|
232
|
-
this.log.debug("Updating object: " + name + " (desc): " + obj.common.name + " -> " + description);
|
|
264
|
+
this.log.debug("(doState) Updating object: " + name + " (desc): " + obj.common.name + " -> " + description);
|
|
233
265
|
await this.extendObject(name, {common: {name: description}});
|
|
234
266
|
}
|
|
235
267
|
if (obj.common.type != typeof(value)) {
|
|
236
|
-
this.log.debug("Updating object: " + name + " (type): " + obj.common.type + " -> " + typeof(value));
|
|
268
|
+
this.log.debug("(doState) Updating object: " + name + " (type): " + obj.common.type + " -> " + typeof(value));
|
|
237
269
|
await this.extendObject(name, {common: {type: typeof(value)}});
|
|
238
270
|
}
|
|
239
271
|
if (obj.common.unit != unit) {
|
|
240
|
-
this.log.debug("Updating object: " + name + " (unit): " + obj.common.unit + " -> " + unit);
|
|
272
|
+
this.log.debug("(doState) Updating object: " + name + " (unit): " + obj.common.unit + " -> " + unit);
|
|
241
273
|
await this.extendObject(name, {common: {unit: unit}});
|
|
242
274
|
}
|
|
243
275
|
if (obj.common.write != write) {
|
|
244
|
-
this.log.debug("Updating object: " + name + " (write): " + obj.common.write + " -> " + write);
|
|
276
|
+
this.log.debug("(doState) Updating object: " + name + " (write): " + obj.common.write + " -> " + write);
|
|
245
277
|
await this.extendObject(name, {common: {write: write}});
|
|
246
278
|
}
|
|
247
279
|
|
|
@@ -251,7 +283,7 @@ class Senec extends utils.Adapter {
|
|
|
251
283
|
await this.checkUpdateSelfStat(name);
|
|
252
284
|
return;
|
|
253
285
|
}
|
|
254
|
-
this.log.
|
|
286
|
+
this.log.debug('(doState) Update: ' + name + ': ' + oldState.val + ' -> ' + value);
|
|
255
287
|
}
|
|
256
288
|
await this.setStateAsync(name, {
|
|
257
289
|
val: value,
|
|
@@ -270,15 +302,15 @@ class Senec extends utils.Adapter {
|
|
|
270
302
|
var lang = 1; // fallback to english
|
|
271
303
|
var langState = await this.getStateAsync('WIZARD.GUI_LANG');
|
|
272
304
|
if (langState) lang = langState.val;
|
|
273
|
-
this.log.silly("Senec language: " + lang);
|
|
305
|
+
this.log.silly("(Decode) Senec language: " + lang);
|
|
274
306
|
var key = name;
|
|
275
307
|
if (!isNaN(name.substring(name.lastIndexOf('.')) + 1)) key = name.substring(0, name.lastIndexOf('.'));
|
|
276
|
-
this.log.silly("Checking: " + name + " -> " + key);
|
|
308
|
+
this.log.silly("(Decode) Checking: " + name + " -> " + key);
|
|
277
309
|
|
|
278
310
|
if (state_trans[key + "." + lang] !== undefined) {
|
|
279
|
-
this.log.silly("Trans found for: " + key + "." + lang);
|
|
311
|
+
this.log.silly("(Decode) Trans found for: " + key + "." + lang);
|
|
280
312
|
const trans = (state_trans[key + "." + lang] !== undefined ? (state_trans[key + "." + lang][value] !== undefined ? state_trans[key + "." + lang][value] : "(unknown)") : "(unknown)");
|
|
281
|
-
this.log.
|
|
313
|
+
this.log.silly("(Decode) Trans " + key + ":" + value + " = " + trans);
|
|
282
314
|
const desc = (state_attr[key + "_Text"] !== undefined) ? state_attr[key + "_Text"].name : key;
|
|
283
315
|
await this.doState(name + "_Text", trans, desc, "", true);
|
|
284
316
|
}
|
|
@@ -303,7 +335,7 @@ class Senec extends utils.Adapter {
|
|
|
303
335
|
if (value2 !== "VARIABLE_NOT_FOUND" && key2 !== "OBJECT_NOT_FOUND") {
|
|
304
336
|
const key = key1 + '.' + key2;
|
|
305
337
|
if (state_attr[key] === undefined) {
|
|
306
|
-
this.log.
|
|
338
|
+
this.log.info('REPORT_TO_DEV: State attribute definition missing for: ' + key + ', Val: ' + value2);
|
|
307
339
|
}
|
|
308
340
|
const desc = (state_attr[key] !== undefined) ? state_attr[key].name : key2;
|
|
309
341
|
const unit = (state_attr[key] !== undefined) ? state_attr[key].unit : "";
|
|
@@ -352,14 +384,18 @@ class Senec extends utils.Adapter {
|
|
|
352
384
|
const unitRefDay = (state_attr[key + ".ref" + day] !== undefined) ? state_attr[key + ".ref" + day].unit : "";
|
|
353
385
|
|
|
354
386
|
if (refDay != curDay) {
|
|
355
|
-
this.log.debug("New " + day + " (or first value seen). Updating stat data for: " + name.substring(10));
|
|
387
|
+
this.log.debug("(Calc) New " + day + " (or first value seen). Updating stat data for: " + name.substring(10));
|
|
356
388
|
// Change of day
|
|
357
389
|
await this.doState(key + ".ref" + day, curDay, descRefDay, unitRefDay, false);
|
|
358
390
|
await this.doState(key + yesterday, valToday, descYesterday, unitYesterday, false);
|
|
359
391
|
await this.doState(key + today, 0, descToday, unitToday, false);
|
|
360
|
-
|
|
392
|
+
if (valRef < valCur) {
|
|
393
|
+
await this.doState(key + refValue, valCur, descRef, unitRef, true);
|
|
394
|
+
} else {
|
|
395
|
+
this.log.warning("(Calc) Not updating reference value for: " + name.substring(10) + "! Old RefValue (" + valRef + ") >= new RefValue (" + valCur + "). Impossible situation. If this is intentional, please update via admin!");
|
|
396
|
+
}
|
|
361
397
|
} else {
|
|
362
|
-
this.log.
|
|
398
|
+
this.log.silly("(Calc) Updating " + day +" value for: " + name.substring(10) + ": " + Number((valCur - valRef).toFixed(2)));
|
|
363
399
|
// update today's value
|
|
364
400
|
await this.doState(key + today, Number((valCur - valRef).toFixed(2)), descToday, unitToday, false);
|
|
365
401
|
}
|
|
@@ -400,16 +436,18 @@ class Senec extends utils.Adapter {
|
|
|
400
436
|
const unitRefDay = (state_attr[key + ".ref" + day] !== undefined) ? state_attr[key + ".ref" + day].unit : "";
|
|
401
437
|
|
|
402
438
|
if (refDay != curDay) {
|
|
403
|
-
this.log.debug("New " + day + " (or first value seen). Updating Autarky data for: " + key + " " + day);
|
|
439
|
+
this.log.debug("(Autarky) New " + day + " (or first value seen). Updating Autarky data for: " + key + " " + day);
|
|
404
440
|
// Change of day
|
|
405
441
|
await this.doState(key + ".ref" + day, curDay, descRefDay, unitRefDay, false);
|
|
406
442
|
await this.doState(key + yesterday, valToday, descYesterday, unitYesterday, false);
|
|
407
443
|
// await this.doState(key + today, 0, descToday, unitToday, false); // we don't need to reset autarky to 0 because it is calculated by reference values.
|
|
408
444
|
// instead do the regular calc right after the change of day
|
|
409
445
|
}
|
|
410
|
-
this.log.debug("Updating Autarky " + day +" value for: " + key + today);
|
|
411
446
|
// update today's value - but beware of div/0
|
|
412
|
-
|
|
447
|
+
var newVal = 0;
|
|
448
|
+
if (valHouseCons > 0) newVal = Number((((valPVGen - valGridExp - valBatCharge + valBatDischarge) / valHouseCons) * 100).toFixed(0));
|
|
449
|
+
this.log.silly("(Autarky) Updating Autarky " + day +" value for: " + key + today + ": " + newVal);
|
|
450
|
+
if (valHouseCons > 0) await this.doState(key + today, newVal, descToday, unitToday, false);
|
|
413
451
|
}
|
|
414
452
|
|
|
415
453
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.senec",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5-beta",
|
|
4
4
|
"description": "Senec Home",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "NoBl",
|
|
@@ -24,39 +24,49 @@
|
|
|
24
24
|
"url": "https://github.com/nobl/ioBroker.senec.git"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"@iobroker/adapter-core": "^2.
|
|
27
|
+
"axios": "^0.25.0",
|
|
28
|
+
"@iobroker/adapter-core": "^2.5.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@types/chai
|
|
34
|
-
"@types/
|
|
35
|
-
"@types/
|
|
36
|
-
"@types/
|
|
31
|
+
"@alcalzone/release-script": "^3.5.2",
|
|
32
|
+
"@iobroker/testing": "^2.5.2",
|
|
33
|
+
"@types/chai": "^4.3.0",
|
|
34
|
+
"@types/chai-as-promised": "^7.1.4",
|
|
35
|
+
"@types/gulp": "^4.0.9",
|
|
36
|
+
"@types/mocha": "^9.0.0",
|
|
37
|
+
"@types/node": "^17.0.17",
|
|
37
38
|
"@types/proxyquire": "^1.3.28",
|
|
38
|
-
"@types/sinon": "^
|
|
39
|
-
"@types/sinon-chai": "^3.2.
|
|
40
|
-
"
|
|
41
|
-
"chai": "^4.3.4",
|
|
39
|
+
"@types/sinon": "^10.0.6",
|
|
40
|
+
"@types/sinon-chai": "^3.2.8",
|
|
41
|
+
"chai": "^4.3.6",
|
|
42
42
|
"chai-as-promised": "^7.1.1",
|
|
43
|
-
"eslint": "^
|
|
43
|
+
"eslint": "^8.8.0",
|
|
44
44
|
"gulp": "^4.0.2",
|
|
45
|
-
"mocha": "^
|
|
45
|
+
"mocha": "^9.1.3",
|
|
46
46
|
"proxyquire": "^2.1.3",
|
|
47
|
-
"sinon": "^
|
|
48
|
-
"sinon-chai": "^3.
|
|
49
|
-
|
|
47
|
+
"sinon": "^12.0.1",
|
|
48
|
+
"sinon-chai": "^3.7.0",
|
|
49
|
+
"typescript": "~4.5.5"
|
|
50
50
|
},
|
|
51
51
|
"main": "main.js",
|
|
52
|
+
"files": [
|
|
53
|
+
"admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
|
|
54
|
+
"admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
|
|
55
|
+
"lib/",
|
|
56
|
+
"www/",
|
|
57
|
+
"io-package.json",
|
|
58
|
+
"LICENSE",
|
|
59
|
+
"main.js"
|
|
60
|
+
],
|
|
52
61
|
"scripts": {
|
|
53
62
|
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
"test:package": "mocha test/package --exit",
|
|
64
|
+
"test:unit": "mocha test/unit --exit",
|
|
65
|
+
"test:integration": "mocha test/integration --exit",
|
|
66
|
+
"test": "npm run test:js && npm run test:package",
|
|
67
|
+
"check": "tsc --noEmit -p tsconfig.check.json",
|
|
68
|
+
"lint": "eslint",
|
|
69
|
+
"release": "release-script"
|
|
60
70
|
},
|
|
61
71
|
"bugs": {
|
|
62
72
|
"url": "https://github.com/nobl/ioBroker.senec/issues"
|
package/CHANGELOG_old.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
The newest change log is [README.md](README.md)
|
|
2
|
-
|
|
3
|
-
### 1.0.13 (NoBl)
|
|
4
|
-
* Added System Description 19 for Senec.Home V3 Hybrid (Credits to noffycws)
|
|
5
|
-
* Added Mode Descriptions for 86-91. (Credits to noffycws)
|
|
6
|
-
|
|
7
|
-
### 1.0.12 (NoBl)
|
|
8
|
-
* Just set 'supportCustoms' to false so it won't show up in admin custom config.
|
|
9
|
-
|
|
10
|
-
### 1.0.11 (NoBl)
|
|
11
|
-
* Update to current adapter template
|
|
12
|
-
* Added Datapoints: PV1.MPP_CUR, MPP_VOL, MPP_POWER (former: MPP_INT which is unused at this moment but does still exist)
|
|
13
|
-
* Added Datapoints (please feedback any improvements for their descriptions, ...): FEATURES.SGREADY, WIZARD.SETUP_WALLBOX_MAX_TOTAL_CURRENT_BY_GRID, WIZARD.SG_READY_CURR_MODE, BMS.ERROR, BMS.RECOVERLOCKED, BMS.SERIAL, BMS.START_SELFTEST, BAT1.RESET, BAT1.SELFTEST_ACT, BAT1.SELFTEST_LIMIT, BAT1.SELFTEST_OFF, BAT1.SELFTEST_OVERALL_STATE, BAT1.SELFTEST_STATE, BAT1.SELFTEST_STEP, BAT1.SELFTEST_TIME, BAT1.SERIAL, BAT1.TRIG_ITALY_SELF, BAT1OBJ1.COMM, GRIDCONFIG.AU_SOFT_RAMP_EN, GRIDCONFIG.AU_VRR_MAX, GRIDCONFIG.AU_VRR_MIN, GRIDCONFIG.AU_VVAR_PERCENTAGE, GRIDCONFIG.AU_VVAR_P_MAX, GRIDCONFIG.AU_VVAR_P_MIN, GRIDCONFIG.AU_VVAR_VOLTAGE, GRIDCONFIG.AU_VWC_VOLTAGE, GRIDCONFIG.AU_VWD_VOLTAGE, GRIDCONFIG.CEI_SEGNALE_ESTERNO, GRIDCONFIG.VDELVFRTDISABLE, GRIDCONFIG.VDEURMSMAX10
|
|
14
|
-
|
|
15
|
-
### 1.0.10 (NoBl, smartpran)
|
|
16
|
-
* DateType objects are stored as date again
|
|
17
|
-
* changed WIZARD.SETUP_POWER_RULE unit to '%'
|
|
18
|
-
* changed name of STATISTIC.STAT_SUM_E_PU to "STAT_SUM Energy PowerUnit"
|
|
19
|
-
* changed name of STATISTIC.STAT_SUM_E_WB to "STAT_SUM Energy Wallbox"
|
|
20
|
-
* changed name of STATISTIC.LIVE_WB_ENERGY to "Live Wallbox Energy"
|
|
21
|
-
* changed name of STATISTIC.LIVE_PU_ENERGY to "Live PowerUnit Energy"
|
|
22
|
-
* changed name of WIZARD.PWRCFG_PEAK_PV_POWER to "Configured Peak PV Power"
|
|
23
|
-
* enforcing conversion of number values to Number(). Otherwise they are created as String in ioBroker (manually delete existing datapoints in ioBroker to change them!)
|
|
24
|
-
* fixed representation for temp values (off by *10)
|
|
25
|
-
* json delivers a non-value (apparently an error message produced by senec itself). Ignoring that.
|
|
26
|
-
* Added variable mpp_int to high priority and changed unit it. (smartpran)
|
|
27
|
-
|
|
28
|
-
### 1.0.9 (NoBl)
|
|
29
|
-
* IP types are shown as IP again.
|
|
30
|
-
* added datapoints for FACTORY along with more state descriptions for Battery Type, Country and System Type.
|
|
31
|
-
* added datapoints for GRIDCONFIG
|
|
32
|
-
|
|
33
|
-
### 1.0.8 (NoBl)
|
|
34
|
-
* Added more states to known states (please feedback if they need special handling (unit, special description, value modification, ...))
|
|
35
|
-
* Bugfix in creating debug data
|
|
36
|
-
* Unknown states are now reported in debug instead of info.
|
|
37
|
-
* Code cleanup
|
|
38
|
-
|
|
39
|
-
### 1.0.7 (NoBl)
|
|
40
|
-
* Reading all known states from SENEC.
|
|
41
|
-
* Split states into high/low priority (heavy requesting the SENEC system renders it unable to sync with the SENEC datacenter!).
|
|
42
|
-
* Updated adapter-core and testing versions along with current dev dependencies. Removed node 8 support.
|
|
43
|
-
* Added more state descriptions to manual. But need input on these and those that are still not documented.
|
|
44
|
-
|
|
45
|
-
### 1.0.6 (NoBl)
|
|
46
|
-
* Moved senec states and state attributes to libs
|
|
47
|
-
* Added missing state descriptions
|
|
48
|
-
|
|
49
|
-
### 1.0.5 (2020-03-07) (NoBl)
|
|
50
|
-
* Added States for: Energy: GUI_BAT_DATA_VOLTAGE, GUI_BAT_DATA_CURRENT, STAT_HOURS_OF_OPERATION; Sys_update: NPU_VER, NPU_IMAGE_VERSION, Wizard: APPLICATION_VERSION, INTERFACE_VERSION
|
|
51
|
-
* Readme and Documentation (EN exists, now) updated
|
|
52
|
-
* Changed behavior for unknown values completely. They will now be stored as string plus prefixed with "REPORT TO DEV:" so users can easily report back what needs updating.
|
|
53
|
-
* added handling for "st_" values in json
|
|
54
|
-
* added additional configuration options
|
|
55
|
-
* changed retry-behaviour in case of connection issues, ...
|
|
56
|
-
|
|
57
|
-
### 1.0.4 (2020-03-06)
|
|
58
|
-
* (NoBl) Repo URL updated
|
|
59
|
-
### 1.0.3 (2020-03-06)
|
|
60
|
-
* (NoBl) added link to documentation in german
|
|
61
|
-
### 1.0.2 (2020-03-04)
|
|
62
|
-
* (NoBl) added missing status codes (85 in total now)
|
|
63
|
-
* (NoBl) added status code to status message for easier reference
|
|
64
|
-
* (NoBl) added states for wallboxes and battery modules
|
|
65
|
-
### 1.0.1
|
|
66
|
-
* (NoBl) updated readme
|
|
67
|
-
### 1.0.0
|
|
68
|
-
* (NoBl) initial release
|
package/admin/admin.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
declare let systemDictionary: Record<string, Record<string, string>>;
|
|
2
|
-
|
|
3
|
-
declare let load: (settings: Record<string, unknown>, onChange: (hasChanges: boolean) => void) => void;
|
|
4
|
-
declare let save: (callback: (settings: Record<string, unknown>) => void) => void;
|
|
5
|
-
|
|
6
|
-
// make load and save exist on the window object
|
|
7
|
-
interface Window {
|
|
8
|
-
load: typeof load;
|
|
9
|
-
save: typeof save;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare const instance: number;
|
|
13
|
-
declare const adapter: string;
|
|
14
|
-
/** Translates text */
|
|
15
|
-
declare function _(text: string, arg1?: string, arg2?: string, arg3?: string): string;
|
|
16
|
-
declare const socket: ioBrokerSocket;
|
|
17
|
-
declare function sendTo(
|
|
18
|
-
instance: any | null,
|
|
19
|
-
command: string,
|
|
20
|
-
message: any,
|
|
21
|
-
callback: (result: SendToResult) => void | Promise<void>,
|
|
22
|
-
): void;
|
|
23
|
-
|
|
24
|
-
interface SendToResult {
|
|
25
|
-
error?: string | Error;
|
|
26
|
-
result?: any;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// tslint:disable-next-line:class-name
|
|
30
|
-
interface ioBrokerSocket {
|
|
31
|
-
emit(
|
|
32
|
-
command: 'subscribeObjects',
|
|
33
|
-
pattern: string,
|
|
34
|
-
callback?: (err?: string) => void | Promise<void>,
|
|
35
|
-
): void;
|
|
36
|
-
emit(
|
|
37
|
-
command: 'subscribeStates',
|
|
38
|
-
pattern: string,
|
|
39
|
-
callback?: (err?: string) => void | Promise<void>,
|
|
40
|
-
): void;
|
|
41
|
-
emit(
|
|
42
|
-
command: 'unsubscribeObjects',
|
|
43
|
-
pattern: string,
|
|
44
|
-
callback?: (err?: string) => void | Promise<void>,
|
|
45
|
-
): void;
|
|
46
|
-
emit(
|
|
47
|
-
command: 'unsubscribeStates',
|
|
48
|
-
pattern: string,
|
|
49
|
-
callback?: (err?: string) => void | Promise<void>,
|
|
50
|
-
): void;
|
|
51
|
-
|
|
52
|
-
emit(
|
|
53
|
-
event: 'getObjectView',
|
|
54
|
-
view: 'system',
|
|
55
|
-
type: 'device',
|
|
56
|
-
options: ioBroker.GetObjectViewParams,
|
|
57
|
-
callback: (
|
|
58
|
-
err: string | undefined,
|
|
59
|
-
result?: any,
|
|
60
|
-
) => void | Promise<void>,
|
|
61
|
-
): void;
|
|
62
|
-
emit(
|
|
63
|
-
event: 'getStates',
|
|
64
|
-
callback: (
|
|
65
|
-
err: string | undefined,
|
|
66
|
-
result?: Record<string, any>,
|
|
67
|
-
) => void,
|
|
68
|
-
): void;
|
|
69
|
-
emit(
|
|
70
|
-
event: 'getState',
|
|
71
|
-
id: string,
|
|
72
|
-
callback: (err: string | undefined, result?: ioBroker.State) => void,
|
|
73
|
-
): void;
|
|
74
|
-
emit(
|
|
75
|
-
event: 'setState',
|
|
76
|
-
id: string,
|
|
77
|
-
state: unknown,
|
|
78
|
-
callback: (err: string | undefined, result?: any) => void,
|
|
79
|
-
): void;
|
|
80
|
-
|
|
81
|
-
on(event: 'objectChange', handler: ioBroker.ObjectChangeHandler): void;
|
|
82
|
-
on(event: 'stateChange', handler: ioBroker.StateChangeHandler): void;
|
|
83
|
-
removeEventHandler(
|
|
84
|
-
event: 'objectChange',
|
|
85
|
-
handler: ioBroker.ObjectChangeHandler,
|
|
86
|
-
): void;
|
|
87
|
-
removeEventHandler(
|
|
88
|
-
event: 'stateChange',
|
|
89
|
-
handler: ioBroker.StateChangeHandler,
|
|
90
|
-
): void;
|
|
91
|
-
|
|
92
|
-
// TODO: other events
|
|
93
|
-
}
|