iobroker.solarviewdatareader 1.1.1 → 1.1.2
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 +5 -5
- package/build/main.js +26 -31
- package/build/main.js.map +2 -2
- package/io-package.json +14 -15
- package/package.json +16 -14
package/README.md
CHANGED
|
@@ -60,6 +60,11 @@ UL3, IL3 = mains voltage, mains power phase 3
|
|
|
60
60
|
TKK= Temperature inverter
|
|
61
61
|
|
|
62
62
|
## Changelog
|
|
63
|
+
### 1.1.2 (2024-09-13)
|
|
64
|
+
* (afuerhoff) adapter checker changes
|
|
65
|
+
* (afuerhoff) dependencies updated
|
|
66
|
+
* (afuerhoff) automatic restart [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)
|
|
67
|
+
|
|
63
68
|
### 1.1.1 (2024-06-28)
|
|
64
69
|
* (afuerhoff) change to typescript
|
|
65
70
|
* (afuerhoff) dependencies updated
|
|
@@ -80,11 +85,6 @@ TKK= Temperature inverter
|
|
|
80
85
|
### 1.0.7 (2022-12-21)
|
|
81
86
|
* (afuerhoff) dependencies updated
|
|
82
87
|
|
|
83
|
-
### 1.0.6 (2022-07-04)
|
|
84
|
-
* (afuerhoff) dependencies updated
|
|
85
|
-
* (afuerhoff) Interval settings changed from minutes to seconds
|
|
86
|
-
* (afuerhoff) States only writen after changes
|
|
87
|
-
|
|
88
88
|
## License
|
|
89
89
|
MIT License
|
|
90
90
|
|
package/build/main.js
CHANGED
|
@@ -65,6 +65,7 @@ class Solarviewdatareader extends utils.Adapter {
|
|
|
65
65
|
//async createObject(that: Solarviewdatareader, id: string, typeVal: ioBroker.CommonType, name: string, commonType: string, role: string, def: any, rd: boolean, wr: boolean, desc: string, unit: string) {
|
|
66
66
|
async createObject(id, obj) {
|
|
67
67
|
await this.setObjectNotExistsAsync(id, obj);
|
|
68
|
+
this.extendObject(id, obj);
|
|
68
69
|
const currentState = await this.getStateAsync(id);
|
|
69
70
|
const stCommon = obj.common;
|
|
70
71
|
if (currentState === null && stCommon.def !== void 0) {
|
|
@@ -82,29 +83,30 @@ class Solarviewdatareader extends utils.Adapter {
|
|
|
82
83
|
}
|
|
83
84
|
async createSolarviewObjects(device, additional = false) {
|
|
84
85
|
let options = [
|
|
85
|
-
[device
|
|
86
|
-
[device + ".
|
|
87
|
-
[device + ".
|
|
88
|
-
[device + ".
|
|
89
|
-
[device + ".
|
|
86
|
+
[device, { type: "channel", common: { name: device }, native: {} }],
|
|
87
|
+
[device + ".current", { type: "state", common: { name: "current", type: "number", role: "value.power", def: 0, read: true, write: false, desc: "Current PAC", unit: "W" }, native: {} }],
|
|
88
|
+
[device + ".daily", { type: "state", common: { name: "daily", type: "number", role: "value.energy", def: 0, read: true, write: false, desc: "Daily yield", unit: "kWh" }, native: {} }],
|
|
89
|
+
[device + ".monthly", { type: "state", common: { name: "monthly", type: "number", role: "value.energy", def: 0, read: true, write: false, desc: "Monthly yield", unit: "kWh" }, native: {} }],
|
|
90
|
+
[device + ".yearly", { type: "state", common: { name: "yearly", type: "number", role: "value.energy", def: 0, read: true, write: false, desc: "Yearly yield", unit: "kWh" }, native: {} }],
|
|
91
|
+
[device + ".total", { type: "state", common: { name: "total", type: "number", role: "value.energy", def: 0, read: true, write: false, desc: "Total yield", unit: "kWh" }, native: {} }]
|
|
90
92
|
];
|
|
91
93
|
if (additional) {
|
|
92
94
|
const additionalOptions = [
|
|
93
|
-
[device + ".udc", { type: "state", common: { name: "udc", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
94
|
-
[device + ".idc", { type: "state", common: { name: "idc", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
95
|
-
[device + ".udcb", { type: "state", common: { name: "udcb", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
96
|
-
[device + ".idcb", { type: "state", common: { name: "idcb", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
97
|
-
[device + ".udcc", { type: "state", common: { name: "udcc", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
98
|
-
[device + ".idcc", { type: "state", common: { name: "idcc", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
99
|
-
[device + ".udcd", { type: "state", common: { name: "udcd", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
100
|
-
[device + ".idcd", { type: "state", common: { name: "idcd", type: "number", role: "value", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
101
|
-
[device + ".ul1", { type: "state", common: { name: "ul1", type: "number", role: "value", def: 0, read: true, write: false, desc: "Mains voltage", unit: "V" }, native: {} }],
|
|
102
|
-
[device + ".il1", { type: "state", common: { name: "il1", type: "number", role: "value", def: 0, read: true, write: false, desc: "Mains current", unit: "A" }, native: {} }],
|
|
103
|
-
[device + ".ul2", { type: "state", common: { name: "ul2", type: "number", role: "value", def: 0, read: true, write: false, desc: "Mains voltage", unit: "V" }, native: {} }],
|
|
104
|
-
[device + ".il2", { type: "state", common: { name: "il2", type: "number", role: "value", def: 0, read: true, write: false, desc: "Mains current", unit: "A" }, native: {} }],
|
|
105
|
-
[device + ".ul3", { type: "state", common: { name: "ul3", type: "number", role: "value", def: 0, read: true, write: false, desc: "Mains voltage", unit: "V" }, native: {} }],
|
|
106
|
-
[device + ".il3", { type: "state", common: { name: "il3", type: "number", role: "value", def: 0, read: true, write: false, desc: "Mains current", unit: "A" }, native: {} }],
|
|
107
|
-
[device + ".tkk", { type: "state", common: { name: "tkk", type: "number", role: "value", def: 0, read: true, write: false, desc: "Temperature", unit: "\xB0C" }, native: {} }]
|
|
95
|
+
[device + ".udc", { type: "state", common: { name: "udc", type: "number", role: "value.voltage", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
96
|
+
[device + ".idc", { type: "state", common: { name: "idc", type: "number", role: "value.current", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
97
|
+
[device + ".udcb", { type: "state", common: { name: "udcb", type: "number", role: "value.voltage", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
98
|
+
[device + ".idcb", { type: "state", common: { name: "idcb", type: "number", role: "value.current", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
99
|
+
[device + ".udcc", { type: "state", common: { name: "udcc", type: "number", role: "value.voltage", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
100
|
+
[device + ".idcc", { type: "state", common: { name: "idcc", type: "number", role: "value.current", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
101
|
+
[device + ".udcd", { type: "state", common: { name: "udcd", type: "number", role: "value.voltage", def: 0, read: true, write: false, desc: "Generator voltage", unit: "V" }, native: {} }],
|
|
102
|
+
[device + ".idcd", { type: "state", common: { name: "idcd", type: "number", role: "value.current", def: 0, read: true, write: false, desc: "Generator current", unit: "A" }, native: {} }],
|
|
103
|
+
[device + ".ul1", { type: "state", common: { name: "ul1", type: "number", role: "value.voltage", def: 0, read: true, write: false, desc: "Mains voltage", unit: "V" }, native: {} }],
|
|
104
|
+
[device + ".il1", { type: "state", common: { name: "il1", type: "number", role: "value.current", def: 0, read: true, write: false, desc: "Mains current", unit: "A" }, native: {} }],
|
|
105
|
+
[device + ".ul2", { type: "state", common: { name: "ul2", type: "number", role: "value.voltage", def: 0, read: true, write: false, desc: "Mains voltage", unit: "V" }, native: {} }],
|
|
106
|
+
[device + ".il2", { type: "state", common: { name: "il2", type: "number", role: "value.current", def: 0, read: true, write: false, desc: "Mains current", unit: "A" }, native: {} }],
|
|
107
|
+
[device + ".ul3", { type: "state", common: { name: "ul3", type: "number", role: "value.voltage", def: 0, read: true, write: false, desc: "Mains voltage", unit: "V" }, native: {} }],
|
|
108
|
+
[device + ".il3", { type: "state", common: { name: "il3", type: "number", role: "value.current", def: 0, read: true, write: false, desc: "Mains current", unit: "A" }, native: {} }],
|
|
109
|
+
[device + ".tkk", { type: "state", common: { name: "tkk", type: "number", role: "value.temperature", def: 0, read: true, write: false, desc: "Temperature", unit: "\xB0C" }, native: {} }]
|
|
108
110
|
];
|
|
109
111
|
options = options.concat(additionalOptions);
|
|
110
112
|
}
|
|
@@ -263,10 +265,6 @@ class Solarviewdatareader extends utils.Adapter {
|
|
|
263
265
|
await this.createSolarviewObjects("pvi4", true);
|
|
264
266
|
conn.on("data", async (data) => {
|
|
265
267
|
chkCnt2 = 0;
|
|
266
|
-
clearTimeout(jobSchedule);
|
|
267
|
-
jobSchedule = setTimeout(() => {
|
|
268
|
-
this.getData(port, ip_address);
|
|
269
|
-
}, this.config.intervalVal * 1e3 - this.pTimeoutcnt);
|
|
270
268
|
await this.processData(data);
|
|
271
269
|
});
|
|
272
270
|
conn.on("close", () => {
|
|
@@ -277,10 +275,6 @@ class Solarviewdatareader extends utils.Adapter {
|
|
|
277
275
|
chkCnt2 = 0;
|
|
278
276
|
}
|
|
279
277
|
chkCnt2++;
|
|
280
|
-
clearTimeout(jobSchedule);
|
|
281
|
-
jobSchedule = setTimeout(() => {
|
|
282
|
-
this.getData(port, ip_address);
|
|
283
|
-
}, 1e4);
|
|
284
278
|
});
|
|
285
279
|
conn.on("error", (err) => {
|
|
286
280
|
this.log.error(err.message);
|
|
@@ -291,9 +285,10 @@ class Solarviewdatareader extends utils.Adapter {
|
|
|
291
285
|
} else {
|
|
292
286
|
await this.adjustIntervalToSeconds.call(this);
|
|
293
287
|
}
|
|
294
|
-
|
|
288
|
+
this.getData(port, ip_address);
|
|
289
|
+
jobSchedule = setInterval(async () => {
|
|
295
290
|
this.getData(port, ip_address);
|
|
296
|
-
}, 1e3);
|
|
291
|
+
}, this.config.intervalVal * 1e3);
|
|
297
292
|
}
|
|
298
293
|
async getData(port, ip_address) {
|
|
299
294
|
const { intervalstart, intervalend, d0converter, scm0, scm1, scm2, scm3, scm4, pvi1, pvi2, pvi3, pvi4 } = this.config;
|
|
@@ -343,7 +338,7 @@ class Solarviewdatareader extends utils.Adapter {
|
|
|
343
338
|
}
|
|
344
339
|
onUnload(callback) {
|
|
345
340
|
try {
|
|
346
|
-
|
|
341
|
+
clearInterval(jobSchedule);
|
|
347
342
|
clearTimeout(tout);
|
|
348
343
|
conn.destroy();
|
|
349
344
|
this.setStateChanged("info.connection", { val: false, ack: true });
|
package/build/main.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["'use strict';\n/*\n * Created with @iobroker/create-adapter v1.14.0\n */\n\n// The adapter-core module gives you access to the core ioBroker functions\nimport * as utils from '@iobroker/adapter-core';\n\n// Load your modules here, e.g.:\nimport * as net from 'net';\n\nconst sv_cmd : string = '00*';\nlet conn: net.Socket;\nlet jobSchedule: NodeJS.Timeout;\nlet chkCnt: number = 0;\n\n//Timeout\nlet tout: NodeJS.Timeout;\n//let to1, to2, to3, to4, to5, to6, to7, to8, to9, to10, to11;\n\ninterface ChecksumResult {\n result: boolean;\n chksum: number;\n ind: number;\n data: Buffer;\n}\n\nclass Solarviewdatareader extends utils.Adapter {\n pTimeoutcnt!: number;\n\n public constructor(options: Partial<utils.AdapterOptions> = {}) {\n super({\n ...options,\n name: 'solarviewdatareader',\n });\n this.pTimeoutcnt = 0;\n this.on('ready', this.onReady.bind(this));\n this.on('unload', this.onUnload.bind(this));\n }\n\n // Nullen voranstellen - add Leading Zero\n aLZ(n: number): string {\n return n <= 9 ? '0' + n : n.toString();\n }\n\n calcChecksum(inputString:string): ChecksumResult {\n const buffer = Buffer.from(inputString);\n let sum = 0;\n let index = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n sum = (sum + buffer[i]) % 128;\n if (buffer[i] === 125) {\n index = i + 2;\n break;\n }\n }\n\n const result: ChecksumResult = {\n 'result': buffer[index] === sum,\n 'chksum': sum,\n 'ind': index,\n 'data': buffer\n };\n\n return result;\n }\n\n //async createObject(that: Solarviewdatareader, id: string, typeVal: ioBroker.CommonType, name: string, commonType: string, role: string, def: any, rd: boolean, wr: boolean, desc: string, unit: string) {\n async createObject(id: string, obj: ioBroker.SettableObject): Promise<void> {\n await this.setObjectNotExistsAsync(id, obj);\n\n const currentState = await this.getStateAsync(id);\n const stCommon: ioBroker.StateCommon = obj.common as ioBroker.StateCommon; // Type Assertion\n if (currentState === null && stCommon.def !== undefined) {\n this.setState(id, stCommon.def, true); // set default\n }\n }\n\n async createGlobalObjects(): Promise<void> {\n const options: [string, ioBroker.SettableObject][] =[\n ['info.connection', {type: 'state', common: {name: 'connection', type: 'boolean', role: 'indicator.connected', def: false, read: true, write: false, desc: 'Solarview connection state', unit: ''}, native: {}}],\n ['info.lastUpdate', {type: 'state', common: {name: 'lastUpdate', type: 'string', role: 'date', def: (new Date('1900-01-01T00:00:00')).toString(), read: true, write: false, desc: 'Last connection date/time', unit: ''}, native: {}}],\n ];\n\n for (const option of options) {\n await this.createObject(...option);\n }\n }\n\n async createSolarviewObjects(device: string, additional: boolean = false): Promise<void> {\n let options: [string, ioBroker.SettableObject][] =[\n [device + '.current', {type: 'state', common: {name: 'current', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Current PAC', unit: 'W'}, native: {}}],\n [device + '.daily', {type: 'state', common: {name: 'daily', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Daily yield', unit: 'kWh'}, native: {}}],\n [device + '.monthly', {type: 'state', common: {name: 'monthly', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Monthly yield', unit: 'kWh'}, native: {}}],\n [device + '.yearly', {type: 'state', common: {name: 'yearly', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Yearly yield', unit: 'kWh'}, native: {}}],\n [device + '.total', {type: 'state', common: {name: 'total', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Total yield', unit: 'kWh'}, native: {}}],\n ];\n\n if (additional) {\n const additionalOptions: [string, ioBroker.SettableObject][] =[\n [device + '.udc', {type: 'state', common: {name: 'udc', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idc', {type: 'state', common: {name: 'idc', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.udcb', {type: 'state', common: {name: 'udcb', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idcb', {type: 'state', common: {name: 'idcb', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.udcc', {type: 'state', common: {name: 'udcc', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idcc', {type: 'state', common: {name: 'idcc', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.udcd', {type: 'state', common: {name: 'udcd', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idcd', {type: 'state', common: {name: 'idcd', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.ul1', {type: 'state', common: {name: 'ul1', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Mains voltage', unit: 'V'}, native: {}}],\n [device + '.il1', {type: 'state', common: {name: 'il1', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Mains current', unit: 'A'}, native: {}}],\n [device + '.ul2', {type: 'state', common: {name: 'ul2', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Mains voltage', unit: 'V'}, native: {}}],\n [device + '.il2', {type: 'state', common: {name: 'il2', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Mains current', unit: 'A'}, native: {}}],\n [device + '.ul3', {type: 'state', common: {name: 'ul3', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Mains voltage', unit: 'V'}, native: {}}],\n [device + '.il3', {type: 'state', common: {name: 'il3', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Mains current', unit: 'A'}, native: {}}],\n [device + '.tkk', {type: 'state', common: {name: 'tkk', type: 'number', role: 'value', def: 0, read: true, write: false, desc: 'Temperature', unit: '\u00B0C'}, native: {}}],\n ];\n options = options.concat(additionalOptions);\n }\n\n for (const option of options) {\n await this.createObject(...option);\n }\n }\n\n async adjustIntervalToSeconds(): Promise<void> {\n const adapterObj: ioBroker.Object | null | undefined = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);\n if (!this.config.interval_seconds) {\n if (adapterObj) {\n adapterObj.native.interval_seconds = true;\n adapterObj.native.intervalVal *= 60;\n this.log.warn('Interval changed to seconds!');\n this.log.info('Interval attribute changed! Please check the configuration');\n this.log.info('Adapter restarts');\n }\n }\n }\n\n preprocessSolarviewData(response: Buffer): string[] {\n let sv_data = response.toString('ascii');\n sv_data = sv_data.replace(/[{}]+/g, ''); // Remove \"{}\"\n return sv_data.split(',');\n }\n\n getSolarviewPrefix(dataCode: string): string {\n const prefixMap: { [key: string]: string } = {\n '00': 'pvig.',\n '01': 'pvi1.',\n '02': 'pvi2.',\n '03': 'pvi3.',\n '04': 'pvi4.',\n '10': 'scm0.',\n '11': 'scm1.',\n '12': 'scm2.',\n '13': 'scm3.',\n '14': 'scm4.',\n '21': 'd0supply.',\n '22': 'd0consumption.'\n };\n return prefixMap[dataCode] || '';\n }\n\n processData = async (data: Buffer): Promise<void> => {\n const strdata: string[] = this.preprocessSolarviewData(data);\n const id = this.getSolarviewPrefix(strdata[0]);\n const cs: ChecksumResult = this.calcChecksum(data.toString('ascii'));\n if (cs.result) {\n this.handleChecksumSuccess(strdata, id, data);\n } else {\n this.handleChecksumFailure(cs, data);\n }\n };\n\n handleConnectionError(errorMessage: string): void {\n this.log.error(errorMessage);\n this.setStateChanged('info.connection', { val: false, ack: true });\n }\n\n handleChecksumSuccess(sv_data: string[], sv_prefix: string, response: Buffer): void {\n chkCnt = 0;\n this.log.debug(sv_cmd + ': ' + response.toString('ascii'));\n\n this.updateSolarviewStates(sv_data, sv_prefix);\n\n const sDate = `${sv_data[3]}-${this.aLZ(parseInt(sv_data[2]))}-${this.aLZ(parseInt(sv_data[1]))} ${this.aLZ(parseInt(sv_data[4]))}:${this.aLZ(parseInt(sv_data[5]))}`;\n this.setStateChanged('info.lastUpdate', { val: sDate, ack: true });\n this.setStateChanged('info.connection', { val: true, ack: true });\n }\n\n handleChecksumFailure(csum: ChecksumResult, response: Buffer): void {\n chkCnt += 1;\n if (chkCnt > 0 && csum.chksum !== 0) {\n const buf = Buffer.from(response.toString('ascii'));\n this.log.warn(`checksum not correct! <${buf[csum.ind - 1]} ${buf[csum.ind]} ${buf[csum.ind + 1]} ${buf[csum.ind + 2]} ${csum.chksum}>`);\n this.log.warn(`${sv_cmd}: ${csum.data}`);\n }\n }\n\n updateSolarviewStates(sv_data: string[], sv_prefix: string): void {\n this.updateState(sv_prefix + 'current', sv_data, 10);\n if (sv_prefix === 'pvig.') {\n this.handleCCUUpdate(sv_data);\n }\n this.updateState(sv_prefix + 'daily', sv_data, 6);\n this.updateState(sv_prefix + 'monthly', sv_data, 7);\n this.updateState(sv_prefix + 'yearly', sv_data, 8);\n this.updateState(sv_prefix + 'total', sv_data, 9);\n\n if (sv_data.length >= 23) {\n this.updateExtendedStates(sv_data, sv_prefix);\n }\n }\n\n updateState(stateName: string, sv_data: string[], index: number): void {\n const value = Number(sv_data[index]);\n this.setStateChanged(stateName, { val: value, ack: true });\n }\n\n async handleCCUUpdate(sv_data: string[]): Promise<void> {\n if (this.config.setCCU) {\n const obj = await this.findForeignObjectAsync(this.config.CCUSystemV, 'state');\n if (obj && obj.name) {\n this.log.debug('set CCU system variable: ' + this.config.CCUSystemV);\n this.setForeignState(this.config.CCUSystemV, { val: Number(sv_data[10]), ack: false });\n } else {\n this.log.error(`CCU system variable ${this.config.CCUSystemV} does not exist!`);\n }\n }\n }\n\n updateExtendedStates(sv_data: string[], sv_prefix: string): void {\n this.updateState(sv_prefix + 'udc', sv_data, 11);\n this.updateState(sv_prefix + 'idc', sv_data, 12);\n this.updateState(sv_prefix + 'udcb', sv_data, 13);\n this.updateState(sv_prefix + 'idcb', sv_data, 14);\n this.updateState(sv_prefix + 'udcc', sv_data, 15);\n this.updateState(sv_prefix + 'idcc', sv_data, 16);\n this.updateState(sv_prefix + 'udcd', sv_data, 17);\n this.updateState(sv_prefix + 'idcd', sv_data, 18);\n\n if (sv_data.length === 27) { // Neue Version Solarview\n this.updateState(sv_prefix + 'ul1', sv_data, 19);\n this.updateState(sv_prefix + 'il1', sv_data, 20);\n this.updateState(sv_prefix + 'ul2', sv_data, 21);\n this.updateState(sv_prefix + 'il2', sv_data, 22);\n this.updateState(sv_prefix + 'ul3', sv_data, 23);\n this.updateState(sv_prefix + 'il3', sv_data, 24);\n this.updateState(sv_prefix + 'tkk', sv_data, 25);\n } else if (sv_data.length === 23) { // Alte Version Solarview\n this.updateState(sv_prefix + 'ul1', sv_data, 19);\n this.updateState(sv_prefix + 'il1', sv_data, 20);\n this.updateState(sv_prefix + 'tkk', sv_data, 21);\n }\n }\n\n private async onReady(): Promise<void> {\n const ip_address: string = this.config.ipaddress;\n const port: number = this.config.port;\n let chkCnt = 0;\n\n conn = new net.Socket();\n conn.setTimeout(2000);\n\n const starttime = this.config.intervalstart.split(':').slice(0, 2).join(':');\n const endtime = this.config.intervalend.split(':').slice(0, 2).join(':');\n\n this.log.info('start solarview ' + ip_address + ':' + port + ' - polling interval: ' + this.config.intervalVal + 's (' + starttime + ' to ' + endtime + ')');\n this.log.info('d0 converter: ' + this.config.d0converter.toString());\n\n await this.createGlobalObjects();\n\n await this.createSolarviewObjects('pvig', false);\n if (this.config.d0converter) await this.createSolarviewObjects('d0supply', false);\n if (this.config.d0converter) await this.createSolarviewObjects('d0consumption', false);\n if (this.config.scm0) await this.createSolarviewObjects('scm0', false);\n if (this.config.scm1) await this.createSolarviewObjects('scm1', false);\n if (this.config.scm2) await this.createSolarviewObjects('scm2', false);\n if (this.config.scm3) await this.createSolarviewObjects('scm3', false);\n if (this.config.scm4) await this.createSolarviewObjects('scm4', false);\n if (this.config.pvi1) await this.createSolarviewObjects('pvi1', true);\n if (this.config.pvi2) await this.createSolarviewObjects('pvi2', true);\n if (this.config.pvi3) await this.createSolarviewObjects('pvi3', true);\n if (this.config.pvi4) await this.createSolarviewObjects('pvi4', true);\n\n conn.on('data', async (data) => {\n chkCnt = 0;\n clearTimeout(jobSchedule);\n jobSchedule = setTimeout(() => {\n this.getData(port, ip_address);\n }, this.config.intervalVal * 1000 - this.pTimeoutcnt);\n await this.processData(data);\n });\n\n conn.on('close', () => {\n this.log.debug('connection closed');\n if (chkCnt > 3) {\n this.setState('info.connection', false, true);\n this.log.warn('Solarview Server is not reachable');\n chkCnt = 0;\n }\n chkCnt++;\n clearTimeout(jobSchedule);\n jobSchedule = setTimeout(() => {\n this.getData(port, ip_address);\n }, 10000);\n });\n\n conn.on('error', (err) => {\n this.log.error(err.message);\n this.setStateChanged('info.connection', { val: false, ack: true });\n });\n\n if (this.config.interval_seconds) {\n this.config.intervalVal = this.config.intervalVal;\n } else {\n await this.adjustIntervalToSeconds.call(this);\n }\n\n //First start of getData\n jobSchedule = setTimeout(async () => {\n this.getData(port, ip_address);\n }, 1000);\n }\n\n async getData(port: number, ip_address: string): Promise<void> {\n const { intervalstart, intervalend, d0converter, scm0, scm1, scm2, scm3, scm4, pvi1, pvi2, pvi3, pvi4 } = this.config;\n\n const starttime = intervalstart.split(':').slice(0, 2).join(':');\n let endtime = intervalend.split(':').slice(0, 2).join(':');\n endtime = endtime === '00:00' ? '23:59' : endtime;\n\n const dnow = new Date();\n const dstart = new Date(`${dnow.getFullYear()}-${dnow.getMonth() + 1}-${dnow.getDate()} ${starttime}`);\n const dend = new Date(`${dnow.getFullYear()}-${dnow.getMonth() + 1}-${dnow.getDate()} ${endtime}`);\n\n let timeoutCnt = 0;\n\n const executeCommand = (cmd: string):void => {\n timeoutCnt += 500;\n tout = setTimeout(() => {\n conn.connect(port, ip_address, () => {\n conn.write(cmd);\n conn.end();\n });\n }, timeoutCnt);\n };\n\n if (dnow >= dstart && dnow <= dend) {\n executeCommand('00*'); // pvig\n\n if (d0converter) executeCommand('21*');\n if (pvi1) executeCommand('01*');\n if (pvi2) executeCommand('02*');\n if (pvi3) executeCommand('03*');\n if (pvi4) executeCommand('04*');\n }\n\n if (d0converter) executeCommand('22*');\n if (scm0) executeCommand('10*');\n if (scm1) executeCommand('11*');\n if (scm2) executeCommand('12*');\n if (scm3) executeCommand('13*');\n if (scm4) executeCommand('14*');\n if (this.pTimeoutcnt === 0) this.pTimeoutcnt = timeoutCnt;\n }\n\n private onUnload(callback: () => void): void{\n try {\n clearTimeout(jobSchedule);\n clearTimeout(tout);\n conn.destroy();\n this.setStateChanged('info.connection', { val: false, ack: true });\n this.log.info('cleaned everything up...');\n callback();\n } catch (e) {\n callback();\n }\n }\n}\n\nif (require.main !== module) {\n module.exports = (options: Partial<utils.AdapterOptions> | undefined) => new Solarviewdatareader(options);\n} else {\n (() => new Solarviewdatareader())();\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAMA,YAAuB;AAGvB,UAAqB;AAErB,MAAM,SAAkB;AACxB,IAAI;AACJ,IAAI;AACJ,IAAI,SAAiB;AAGrB,IAAI;AAUJ,MAAM,4BAA4B,MAAM,QAAQ;AAAA,EAC5C;AAAA,EAEO,YAAY,UAAyC,CAAC,GAAG;AAC5D,UAAM;AAAA,MACF,GAAG;AAAA,MACH,MAAM;AAAA,IACV,CAAC;AACD,SAAK,cAAc;AACnB,SAAK,GAAG,SAAS,KAAK,QAAQ,KAAK,IAAI,CAAC;AACxC,SAAK,GAAG,UAAU,KAAK,SAAS,KAAK,IAA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ent": ["'use strict';\n/*\n * Created with @iobroker/create-adapter v1.14.0\n */\n\n// The adapter-core module gives you access to the core ioBroker functions\nimport * as utils from '@iobroker/adapter-core';\n\n// Load your modules here, e.g.:\nimport * as net from 'net';\n\nconst sv_cmd : string = '00*';\nlet conn: net.Socket;\nlet jobSchedule: NodeJS.Timeout;\nlet chkCnt: number = 0;\n\n//Timeout\nlet tout: NodeJS.Timeout;\n//let to1, to2, to3, to4, to5, to6, to7, to8, to9, to10, to11;\n\ninterface ChecksumResult {\n result: boolean;\n chksum: number;\n ind: number;\n data: Buffer;\n}\n\nclass Solarviewdatareader extends utils.Adapter {\n pTimeoutcnt!: number;\n\n public constructor(options: Partial<utils.AdapterOptions> = {}) {\n super({\n ...options,\n name: 'solarviewdatareader',\n });\n this.pTimeoutcnt = 0;\n this.on('ready', this.onReady.bind(this));\n this.on('unload', this.onUnload.bind(this));\n }\n\n // Nullen voranstellen - add Leading Zero\n aLZ(n: number): string {\n return n <= 9 ? '0' + n : n.toString();\n }\n\n calcChecksum(inputString:string): ChecksumResult {\n const buffer = Buffer.from(inputString);\n let sum = 0;\n let index = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n sum = (sum + buffer[i]) % 128;\n if (buffer[i] === 125) {\n index = i + 2;\n break;\n }\n }\n\n const result: ChecksumResult = {\n 'result': buffer[index] === sum,\n 'chksum': sum,\n 'ind': index,\n 'data': buffer\n };\n\n return result;\n }\n\n //async createObject(that: Solarviewdatareader, id: string, typeVal: ioBroker.CommonType, name: string, commonType: string, role: string, def: any, rd: boolean, wr: boolean, desc: string, unit: string) {\n async createObject(id: string, obj: ioBroker.SettableObject): Promise<void> {\n await this.setObjectNotExistsAsync(id, obj);\n this.extendObject(id, obj);\n\n const currentState = await this.getStateAsync(id);\n const stCommon: ioBroker.StateCommon = obj.common as ioBroker.StateCommon; // Type Assertion\n if (currentState === null && stCommon.def !== undefined) {\n this.setState(id, stCommon.def, true); // set default\n }\n }\n\n async createGlobalObjects(): Promise<void> {\n const options: [string, ioBroker.SettableObject][] =[\n ['info.connection', {type: 'state', common: {name: 'connection', type: 'boolean', role: 'indicator.connected', def: false, read: true, write: false, desc: 'Solarview connection state', unit: ''}, native: {}}],\n ['info.lastUpdate', {type: 'state', common: {name: 'lastUpdate', type: 'string', role: 'date', def: (new Date('1900-01-01T00:00:00')).toString(), read: true, write: false, desc: 'Last connection date/time', unit: ''}, native: {}}],\n ];\n\n for (const option of options) {\n await this.createObject(...option);\n }\n }\n\n async createSolarviewObjects(device: string, additional: boolean = false): Promise<void> {\n let options: [string, ioBroker.SettableObject][] =[\n [device, {type: 'channel', common: {name: device}, native: {}}],\n [device + '.current', {type: 'state', common: {name: 'current', type: 'number', role: 'value.power', def: 0, read: true, write: false, desc: 'Current PAC', unit: 'W'}, native: {}}],\n [device + '.daily', {type: 'state', common: {name: 'daily', type: 'number', role: 'value.energy', def: 0, read: true, write: false, desc: 'Daily yield', unit: 'kWh'}, native: {}}],\n [device + '.monthly', {type: 'state', common: {name: 'monthly', type: 'number', role: 'value.energy', def: 0, read: true, write: false, desc: 'Monthly yield', unit: 'kWh'}, native: {}}],\n [device + '.yearly', {type: 'state', common: {name: 'yearly', type: 'number', role: 'value.energy', def: 0, read: true, write: false, desc: 'Yearly yield', unit: 'kWh'}, native: {}}],\n [device + '.total', {type: 'state', common: {name: 'total', type: 'number', role: 'value.energy', def: 0, read: true, write: false, desc: 'Total yield', unit: 'kWh'}, native: {}}],\n ];\n\n if (additional) {\n const additionalOptions: [string, ioBroker.SettableObject][] =[\n [device + '.udc', {type: 'state', common: {name: 'udc', type: 'number', role: 'value.voltage', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idc', {type: 'state', common: {name: 'idc', type: 'number', role: 'value.current', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.udcb', {type: 'state', common: {name: 'udcb', type: 'number', role: 'value.voltage', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idcb', {type: 'state', common: {name: 'idcb', type: 'number', role: 'value.current', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.udcc', {type: 'state', common: {name: 'udcc', type: 'number', role: 'value.voltage', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idcc', {type: 'state', common: {name: 'idcc', type: 'number', role: 'value.current', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.udcd', {type: 'state', common: {name: 'udcd', type: 'number', role: 'value.voltage', def: 0, read: true, write: false, desc: 'Generator voltage', unit: 'V'}, native: {}}],\n [device + '.idcd', {type: 'state', common: {name: 'idcd', type: 'number', role: 'value.current', def: 0, read: true, write: false, desc: 'Generator current', unit: 'A'}, native: {}}],\n [device + '.ul1', {type: 'state', common: {name: 'ul1', type: 'number', role: 'value.voltage', def: 0, read: true, write: false, desc: 'Mains voltage', unit: 'V'}, native: {}}],\n [device + '.il1', {type: 'state', common: {name: 'il1', type: 'number', role: 'value.current', def: 0, read: true, write: false, desc: 'Mains current', unit: 'A'}, native: {}}],\n [device + '.ul2', {type: 'state', common: {name: 'ul2', type: 'number', role: 'value.voltage', def: 0, read: true, write: false, desc: 'Mains voltage', unit: 'V'}, native: {}}],\n [device + '.il2', {type: 'state', common: {name: 'il2', type: 'number', role: 'value.current', def: 0, read: true, write: false, desc: 'Mains current', unit: 'A'}, native: {}}],\n [device + '.ul3', {type: 'state', common: {name: 'ul3', type: 'number', role: 'value.voltage', def: 0, read: true, write: false, desc: 'Mains voltage', unit: 'V'}, native: {}}],\n [device + '.il3', {type: 'state', common: {name: 'il3', type: 'number', role: 'value.current', def: 0, read: true, write: false, desc: 'Mains current', unit: 'A'}, native: {}}],\n [device + '.tkk', {type: 'state', common: {name: 'tkk', type: 'number', role: 'value.temperature', def: 0, read: true, write: false, desc: 'Temperature', unit: '\u00B0C'}, native: {}}],\n ];\n options = options.concat(additionalOptions);\n }\n\n for (const option of options) {\n await this.createObject(...option);\n }\n }\n\n async adjustIntervalToSeconds(): Promise<void> {\n const adapterObj: ioBroker.Object | null | undefined = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);\n if (!this.config.interval_seconds) {\n if (adapterObj) {\n adapterObj.native.interval_seconds = true;\n adapterObj.native.intervalVal *= 60;\n this.log.warn('Interval changed to seconds!');\n this.log.info('Interval attribute changed! Please check the configuration');\n this.log.info('Adapter restarts');\n }\n }\n }\n\n preprocessSolarviewData(response: Buffer): string[] {\n let sv_data = response.toString('ascii');\n sv_data = sv_data.replace(/[{}]+/g, ''); // Remove \"{}\"\n return sv_data.split(',');\n }\n\n getSolarviewPrefix(dataCode: string): string {\n const prefixMap: { [key: string]: string } = {\n '00': 'pvig.',\n '01': 'pvi1.',\n '02': 'pvi2.',\n '03': 'pvi3.',\n '04': 'pvi4.',\n '10': 'scm0.',\n '11': 'scm1.',\n '12': 'scm2.',\n '13': 'scm3.',\n '14': 'scm4.',\n '21': 'd0supply.',\n '22': 'd0consumption.'\n };\n return prefixMap[dataCode] || '';\n }\n\n processData = async (data: Buffer): Promise<void> => {\n const strdata: string[] = this.preprocessSolarviewData(data);\n const id = this.getSolarviewPrefix(strdata[0]);\n const cs: ChecksumResult = this.calcChecksum(data.toString('ascii'));\n if (cs.result) {\n this.handleChecksumSuccess(strdata, id, data);\n } else {\n this.handleChecksumFailure(cs, data);\n }\n };\n\n handleConnectionError(errorMessage: string): void {\n this.log.error(errorMessage);\n this.setStateChanged('info.connection', { val: false, ack: true });\n }\n\n handleChecksumSuccess(sv_data: string[], sv_prefix: string, response: Buffer): void {\n chkCnt = 0;\n this.log.debug(sv_cmd + ': ' + response.toString('ascii'));\n\n this.updateSolarviewStates(sv_data, sv_prefix);\n\n const sDate = `${sv_data[3]}-${this.aLZ(parseInt(sv_data[2]))}-${this.aLZ(parseInt(sv_data[1]))} ${this.aLZ(parseInt(sv_data[4]))}:${this.aLZ(parseInt(sv_data[5]))}`;\n this.setStateChanged('info.lastUpdate', { val: sDate, ack: true });\n this.setStateChanged('info.connection', { val: true, ack: true });\n }\n\n handleChecksumFailure(csum: ChecksumResult, response: Buffer): void {\n chkCnt += 1;\n if (chkCnt > 0 && csum.chksum !== 0) {\n const buf = Buffer.from(response.toString('ascii'));\n this.log.warn(`checksum not correct! <${buf[csum.ind - 1]} ${buf[csum.ind]} ${buf[csum.ind + 1]} ${buf[csum.ind + 2]} ${csum.chksum}>`);\n this.log.warn(`${sv_cmd}: ${csum.data}`);\n }\n }\n\n updateSolarviewStates(sv_data: string[], sv_prefix: string): void {\n this.updateState(sv_prefix + 'current', sv_data, 10);\n if (sv_prefix === 'pvig.') {\n this.handleCCUUpdate(sv_data);\n }\n this.updateState(sv_prefix + 'daily', sv_data, 6);\n this.updateState(sv_prefix + 'monthly', sv_data, 7);\n this.updateState(sv_prefix + 'yearly', sv_data, 8);\n this.updateState(sv_prefix + 'total', sv_data, 9);\n\n if (sv_data.length >= 23) {\n this.updateExtendedStates(sv_data, sv_prefix);\n }\n }\n\n updateState(stateName: string, sv_data: string[], index: number): void {\n const value = Number(sv_data[index]);\n this.setStateChanged(stateName, { val: value, ack: true });\n }\n\n async handleCCUUpdate(sv_data: string[]): Promise<void> {\n if (this.config.setCCU) {\n const obj = await this.findForeignObjectAsync(this.config.CCUSystemV, 'state');\n if (obj && obj.name) {\n this.log.debug('set CCU system variable: ' + this.config.CCUSystemV);\n this.setForeignState(this.config.CCUSystemV, { val: Number(sv_data[10]), ack: false });\n } else {\n this.log.error(`CCU system variable ${this.config.CCUSystemV} does not exist!`);\n }\n }\n }\n\n updateExtendedStates(sv_data: string[], sv_prefix: string): void {\n this.updateState(sv_prefix + 'udc', sv_data, 11);\n this.updateState(sv_prefix + 'idc', sv_data, 12);\n this.updateState(sv_prefix + 'udcb', sv_data, 13);\n this.updateState(sv_prefix + 'idcb', sv_data, 14);\n this.updateState(sv_prefix + 'udcc', sv_data, 15);\n this.updateState(sv_prefix + 'idcc', sv_data, 16);\n this.updateState(sv_prefix + 'udcd', sv_data, 17);\n this.updateState(sv_prefix + 'idcd', sv_data, 18);\n\n if (sv_data.length === 27) { // Neue Version Solarview\n this.updateState(sv_prefix + 'ul1', sv_data, 19);\n this.updateState(sv_prefix + 'il1', sv_data, 20);\n this.updateState(sv_prefix + 'ul2', sv_data, 21);\n this.updateState(sv_prefix + 'il2', sv_data, 22);\n this.updateState(sv_prefix + 'ul3', sv_data, 23);\n this.updateState(sv_prefix + 'il3', sv_data, 24);\n this.updateState(sv_prefix + 'tkk', sv_data, 25);\n } else if (sv_data.length === 23) { // Alte Version Solarview\n this.updateState(sv_prefix + 'ul1', sv_data, 19);\n this.updateState(sv_prefix + 'il1', sv_data, 20);\n this.updateState(sv_prefix + 'tkk', sv_data, 21);\n }\n }\n\n private async onReady(): Promise<void> {\n const ip_address: string = this.config.ipaddress;\n const port: number = this.config.port;\n let chkCnt = 0;\n\n conn = new net.Socket();\n conn.setTimeout(2000);\n\n const starttime = this.config.intervalstart.split(':').slice(0, 2).join(':');\n const endtime = this.config.intervalend.split(':').slice(0, 2).join(':');\n\n this.log.info('start solarview ' + ip_address + ':' + port + ' - polling interval: ' + this.config.intervalVal + 's (' + starttime + ' to ' + endtime + ')');\n this.log.info('d0 converter: ' + this.config.d0converter.toString());\n\n await this.createGlobalObjects();\n\n await this.createSolarviewObjects('pvig', false);\n if (this.config.d0converter) await this.createSolarviewObjects('d0supply', false);\n if (this.config.d0converter) await this.createSolarviewObjects('d0consumption', false);\n if (this.config.scm0) await this.createSolarviewObjects('scm0', false);\n if (this.config.scm1) await this.createSolarviewObjects('scm1', false);\n if (this.config.scm2) await this.createSolarviewObjects('scm2', false);\n if (this.config.scm3) await this.createSolarviewObjects('scm3', false);\n if (this.config.scm4) await this.createSolarviewObjects('scm4', false);\n if (this.config.pvi1) await this.createSolarviewObjects('pvi1', true);\n if (this.config.pvi2) await this.createSolarviewObjects('pvi2', true);\n if (this.config.pvi3) await this.createSolarviewObjects('pvi3', true);\n if (this.config.pvi4) await this.createSolarviewObjects('pvi4', true);\n\n conn.on('data', async (data) => {\n chkCnt = 0;\n await this.processData(data);\n });\n\n conn.on('close', () => {\n this.log.debug('connection closed');\n if (chkCnt > 3) {\n this.setState('info.connection', false, true);\n this.log.warn('Solarview Server is not reachable');\n chkCnt = 0;\n }\n chkCnt++;\n });\n\n conn.on('error', (err) => {\n this.log.error(err.message);\n this.setStateChanged('info.connection', { val: false, ack: true });\n });\n\n if (this.config.interval_seconds) {\n this.config.intervalVal = this.config.intervalVal;\n } else {\n await this.adjustIntervalToSeconds.call(this);\n }\n\n //First start of getData\n this.getData(port, ip_address);\n\n jobSchedule = setInterval(async () => {\n this.getData(port, ip_address);\n }, this.config.intervalVal * 1000);\n }\n\n async getData(port: number, ip_address: string): Promise<void> {\n const { intervalstart, intervalend, d0converter, scm0, scm1, scm2, scm3, scm4, pvi1, pvi2, pvi3, pvi4 } = this.config;\n\n const starttime = intervalstart.split(':').slice(0, 2).join(':');\n let endtime = intervalend.split(':').slice(0, 2).join(':');\n endtime = endtime === '00:00' ? '23:59' : endtime;\n\n const dnow = new Date();\n const dstart = new Date(`${dnow.getFullYear()}-${dnow.getMonth() + 1}-${dnow.getDate()} ${starttime}`);\n const dend = new Date(`${dnow.getFullYear()}-${dnow.getMonth() + 1}-${dnow.getDate()} ${endtime}`);\n\n let timeoutCnt = 0;\n\n const executeCommand = (cmd: string):void => {\n timeoutCnt += 500;\n tout = setTimeout(() => {\n conn.connect(port, ip_address, () => {\n conn.write(cmd);\n conn.end();\n });\n }, timeoutCnt);\n };\n\n if (dnow >= dstart && dnow <= dend) {\n executeCommand('00*'); // pvig\n\n if (d0converter) executeCommand('21*');\n if (pvi1) executeCommand('01*');\n if (pvi2) executeCommand('02*');\n if (pvi3) executeCommand('03*');\n if (pvi4) executeCommand('04*');\n }\n\n if (d0converter) executeCommand('22*');\n if (scm0) executeCommand('10*');\n if (scm1) executeCommand('11*');\n if (scm2) executeCommand('12*');\n if (scm3) executeCommand('13*');\n if (scm4) executeCommand('14*');\n if (this.pTimeoutcnt === 0) this.pTimeoutcnt = timeoutCnt;\n }\n\n private onUnload(callback: () => void): void{\n try {\n clearInterval(jobSchedule);\n clearTimeout(tout);\n conn.destroy();\n this.setStateChanged('info.connection', { val: false, ack: true });\n this.log.info('cleaned everything up...');\n callback();\n } catch (e) {\n callback();\n }\n }\n}\n\nif (require.main !== module) {\n module.exports = (options: Partial<utils.AdapterOptions> | undefined) => new Solarviewdatareader(options);\n} else {\n (() => new Solarviewdatareader())();\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAMA,YAAuB;AAGvB,UAAqB;AAErB,MAAM,SAAkB;AACxB,IAAI;AACJ,IAAI;AACJ,IAAI,SAAiB;AAGrB,IAAI;AAUJ,MAAM,4BAA4B,MAAM,QAAQ;AAAA,EAC5C;AAAA,EAEO,YAAY,UAAyC,CAAC,GAAG;AAC5D,UAAM;AAAA,MACF,GAAG;AAAA,MACH,MAAM;AAAA,IACV,CAAC;AACD,SAAK,cAAc;AACnB,SAAK,GAAG,SAAS,KAAK,QAAQ,KAAK,IAAI,CAAC;AACxC,SAAK,GAAG,UAAU,KAAK,SAAS,KAAK,IAAI,CAAC;AAAA,EAC9C;AAAA;AAAA,EAGA,IAAI,GAAmB;AACnB,WAAO,KAAK,IAAI,MAAM,IAAI,EAAE,SAAS;AAAA,EACzC;AAAA,EAEA,aAAa,aAAoC;AAC7C,UAAM,SAAS,OAAO,KAAK,WAAW;AACtC,QAAI,MAAM;AACV,QAAI,QAAQ;AAEZ,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACpC,aAAO,MAAM,OAAO,CAAC,KAAK;AAC1B,UAAI,OAAO,CAAC,MAAM,KAAK;AACnB,gBAAQ,IAAI;AACZ;AAAA,MACJ;AAAA,IACJ;AAEA,UAAM,SAAyB;AAAA,MAC3B,UAAU,OAAO,KAAK,MAAM;AAAA,MAC5B,UAAU;AAAA,MACV,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,UAAI;AAAM,uBAAe,KAAK;AAC9B,UAAI;AAAM,uBAAe,KAAK;AAAA,IAClC;AAEA,QAAI;AAAa,qBAAe,KAAK;AACrC,QAAI;AAAM,qBAAe,KAAK;AAC9B,QAAI;AAAM,qBAAe,KAAK;AAC9B,QAAI;AAAM,qBAAe,KAAK;AAC9B,QAAI;AAAM,qBAAe,KAAK;AAC9B,QAAI;AAAM,qBAAe,KAAK;AAC9B,QAAI,KAAK,gBAAgB;AAAG,WAAK,cAAc;AAAA,EACnD;AAAA,EAEQ,SAAS,UAA2B;AACxC,QAAI;AACA,oBAAc,WAAW;AACzB,mBAAa,IAAI;AACjB,WAAK,QAAQ;AACb,WAAK,gBAAgB,mBAAmB,EAAE,KAAK,OAAO,KAAK,KAAK,CAAC;AACjE,WAAK,IAAI,KAAK,0BAA0B;AACxC,eAAS;AAAA,IACb,SAAS,GAAG;AACR,eAAS;AAAA,IACb;AAAA,EACJ;AACJ;AAEA,IAAI,QAAQ,SAAS,QAAQ;AACzB,SAAO,UAAU,CAAC,YAAuD,IAAI,oBAAoB,OAAO;AAC5G,OAAO;AACH,GAAC,MAAM,IAAI,oBAAoB,GAAG;AACtC;",
|
|
6
6
|
"names": ["chkCnt"]
|
|
7
7
|
}
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "solarviewdatareader",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.1.2": {
|
|
7
|
+
"en": "adapter checker changes\ndependencies updated\nautomatic restart [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
8
|
+
"de": "adapter checker änderungen\naktualisierte abhängigkeiten\nautomatischer Neustart [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
9
|
+
"ru": "изменения адаптера\nобновленная информация о зависимостях\nавтоматический перезапуск [#170] (https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
10
|
+
"pt": "alterações do verificador do adaptador\ndependências atualizadas\nautomatic restart [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
11
|
+
"nl": "wijzigingen in de adaptercontrole\nafhankelijkheden bijgewerkt\nautomatische herstart [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
12
|
+
"fr": "changement d'adaptateur\ndépendances mises à jour\nredémarrage automatique [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
13
|
+
"it": "adattatore checker modifiche\ndipendenze aggiornate\nriavvio automatico [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
14
|
+
"es": "cambios de control de adaptador\ndependencias actualizadas\nreinicio automático [#170](https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170)",
|
|
15
|
+
"pl": "zmiany w kontrolerze adaptera\nzaktualizowane zależności\nw załączniku II wprowadza się następujące zmiany:",
|
|
16
|
+
"uk": "зміни адаптера\nоновлені залежності\nавтоматичний перезапуск [#170] (https://github.com/afuerhoff/ioBroker.solarviewdatareader/products/170)",
|
|
17
|
+
"zh-cn": "适配器检查器更改\n更新依赖关系\n自动重启 [# 170] (https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues/170) (中文(简体) )"
|
|
18
|
+
},
|
|
6
19
|
"1.1.1": {
|
|
7
20
|
"en": "change to typescript\ndependencies updated\nbugfix CCU variable\ndocumentation changed",
|
|
8
21
|
"de": "änderung der schrift\naktualisierte abhängigkeiten\nbugfix CCU Variable\ndokumentation geändert",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "zaktualizowano zależności\nzaktualizowano test i wydanie\nmniejsze zmiany",
|
|
81
94
|
"zh-cn": "已更新依赖项\n测试和发布更新\n较小的变化",
|
|
82
95
|
"uk": "залежності оновлено\nтестування та випуск оновлено\nменші зміни"
|
|
83
|
-
},
|
|
84
|
-
"1.0.4": {
|
|
85
|
-
"en": "dependencies updated\nissue #20 fixed",
|
|
86
|
-
"de": "Abhängigkeiten aktualisiert\nProblem Nr. 20 behoben",
|
|
87
|
-
"ru": "зависимости обновлены\nпроблема №20 исправлена",
|
|
88
|
-
"pt": "dependências atualizadas\nproblema nº 20 corrigido",
|
|
89
|
-
"nl": "afhankelijkheden bijgewerkt\nprobleem #20 opgelost",
|
|
90
|
-
"fr": "dépendances mises à jour\nproblème #20 corrigé",
|
|
91
|
-
"it": "dipendenze aggiornate\nproblema n. 20 risolto",
|
|
92
|
-
"es": "dependencias actualizadas\nproblema #20 solucionado",
|
|
93
|
-
"pl": "zaktualizowano zależności\nproblem nr 20 naprawiony",
|
|
94
|
-
"zh-cn": "已更新依赖项\n问题 #20 已修复",
|
|
95
|
-
"uk": "залежності оновлено\nпроблема №20 виправлена"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -136,7 +136,6 @@
|
|
|
136
136
|
},
|
|
137
137
|
"tier": 3,
|
|
138
138
|
"platform": "Javascript/Node.js",
|
|
139
|
-
"main": "build/main.js",
|
|
140
139
|
"icon": "solarviewdatareader.png",
|
|
141
140
|
"enabled": true,
|
|
142
141
|
"extIcon": "https://raw.githubusercontent.com/afuerhoff/ioBroker.solarviewdatareader/master/admin/solarviewdatareader.png",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.solarviewdatareader",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Get data from SolarView",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Achim Fürhoff",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"homepage": "https://github.com/afuerhoff/ioBroker.solarviewdatareader",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"keywords": [
|
|
12
|
+
"ioBroker",
|
|
12
13
|
"SolarView",
|
|
13
14
|
"Data Logger",
|
|
14
15
|
"Photovoltaik"
|
|
@@ -18,32 +19,32 @@
|
|
|
18
19
|
"url": "https://github.com/afuerhoff/ioBroker.solarviewdatareader"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
|
-
"@iobroker/adapter-core": "^3.1.
|
|
22
|
+
"@iobroker/adapter-core": "^3.1.6"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@alcalzone/release-script": "^3.
|
|
25
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.7.
|
|
25
|
+
"@alcalzone/release-script": "^3.8.0",
|
|
26
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
|
|
26
27
|
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
27
28
|
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
28
29
|
"@iobroker/adapter-dev": "^1.3.0",
|
|
29
30
|
"@iobroker/testing": "^4.1.3",
|
|
30
31
|
"@tsconfig/node18": "^18.2.4",
|
|
31
|
-
"@types/chai": "^4.3.
|
|
32
|
+
"@types/chai": "^4.3.19",
|
|
32
33
|
"@types/chai-as-promised": "^7.1.8",
|
|
33
|
-
"@types/mocha": "^10.0.
|
|
34
|
-
"@types/node": "^20.
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
36
|
-
"@typescript-eslint/parser": "^7.
|
|
37
|
-
"chai": "^4.
|
|
34
|
+
"@types/mocha": "^10.0.8",
|
|
35
|
+
"@types/node": "^20.16.5",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
37
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
38
|
+
"chai": "^4.5.0",
|
|
38
39
|
"chai-as-promised": "^7.1.2",
|
|
39
40
|
"eslint": "^8.57.0",
|
|
40
|
-
"mocha": "^10.
|
|
41
|
-
"rimraf": "^5.0.
|
|
42
|
-
"sinon": "^18.0.
|
|
41
|
+
"mocha": "^10.7.3",
|
|
42
|
+
"rimraf": "^5.0.10",
|
|
43
|
+
"sinon": "^18.0.1",
|
|
43
44
|
"sinon-chai": "^3.7.0",
|
|
44
45
|
"source-map-support": "^0.5.21",
|
|
45
46
|
"ts-node": "^10.9.2",
|
|
46
|
-
"typescript": "^5.
|
|
47
|
+
"typescript": "^5.6.2"
|
|
47
48
|
},
|
|
48
49
|
"main": "build/main.js",
|
|
49
50
|
"type": "commonjs",
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
"prebuild:ts": "rimraf build",
|
|
63
64
|
"build:ts": "build-adapter ts",
|
|
64
65
|
"watch:ts": "build-adapter ts --watch",
|
|
66
|
+
"devserver:debug": "dev-server debug --wait",
|
|
65
67
|
"test:ts": "mocha --config test/mocharc.custom.json src/**/*.test.ts",
|
|
66
68
|
"test:package": "mocha test/package --exit",
|
|
67
69
|
"test:integration": "mocha test/integration --exit",
|