iobroker.solarviewdatareader 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,6 +60,12 @@ UL3, IL3 = mains voltage, mains power phase 3
60
60
  TKK= Temperature inverter
61
61
 
62
62
  ## Changelog
63
+ ### 1.1.1 (2024-06-28)
64
+ * (afuerhoff) change to typescript
65
+ * (afuerhoff) dependencies updated
66
+ * (afuerhoff) bugfix CCU variable
67
+ * (afuerhoff) documentation changed
68
+
63
69
  ### 1.1.0 (2024-05-29)
64
70
  * (afuerhoff) code optimizations
65
71
  * (afuerhoff) jsonConfig added
@@ -79,11 +85,6 @@ TKK= Temperature inverter
79
85
  * (afuerhoff) Interval settings changed from minutes to seconds
80
86
  * (afuerhoff) States only writen after changes
81
87
 
82
- ### 1.0.5 (2022-02-17)
83
- * (afuerhoff) dependencies updated
84
- * (afuerhoff) test and release updated
85
- * (afuerhoff) smaller changes
86
-
87
88
  ## License
88
89
  MIT License
89
90
 
package/build/main.js ADDED
@@ -0,0 +1,362 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var utils = __toESM(require("@iobroker/adapter-core"));
25
+ var net = __toESM(require("net"));
26
+ const sv_cmd = "00*";
27
+ let conn;
28
+ let jobSchedule;
29
+ let chkCnt = 0;
30
+ let tout;
31
+ class Solarviewdatareader extends utils.Adapter {
32
+ pTimeoutcnt;
33
+ constructor(options = {}) {
34
+ super({
35
+ ...options,
36
+ name: "solarviewdatareader"
37
+ });
38
+ this.pTimeoutcnt = 0;
39
+ this.on("ready", this.onReady.bind(this));
40
+ this.on("unload", this.onUnload.bind(this));
41
+ }
42
+ // Nullen voranstellen - add Leading Zero
43
+ aLZ(n) {
44
+ return n <= 9 ? "0" + n : n.toString();
45
+ }
46
+ calcChecksum(inputString) {
47
+ const buffer = Buffer.from(inputString);
48
+ let sum = 0;
49
+ let index = 0;
50
+ for (let i = 0; i < buffer.length; i++) {
51
+ sum = (sum + buffer[i]) % 128;
52
+ if (buffer[i] === 125) {
53
+ index = i + 2;
54
+ break;
55
+ }
56
+ }
57
+ const result = {
58
+ "result": buffer[index] === sum,
59
+ "chksum": sum,
60
+ "ind": index,
61
+ "data": buffer
62
+ };
63
+ return result;
64
+ }
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
+ async createObject(id, obj) {
67
+ await this.setObjectNotExistsAsync(id, obj);
68
+ const currentState = await this.getStateAsync(id);
69
+ const stCommon = obj.common;
70
+ if (currentState === null && stCommon.def !== void 0) {
71
+ this.setState(id, stCommon.def, true);
72
+ }
73
+ }
74
+ async createGlobalObjects() {
75
+ const options = [
76
+ ["info.connection", { type: "state", common: { name: "connection", type: "boolean", role: "indicator.connected", def: false, read: true, write: false, desc: "Solarview connection state", unit: "" }, native: {} }],
77
+ ["info.lastUpdate", { type: "state", common: { name: "lastUpdate", type: "string", role: "date", def: (/* @__PURE__ */ new Date("1900-01-01T00:00:00")).toString(), read: true, write: false, desc: "Last connection date/time", unit: "" }, native: {} }]
78
+ ];
79
+ for (const option of options) {
80
+ await this.createObject(...option);
81
+ }
82
+ }
83
+ async createSolarviewObjects(device, additional = false) {
84
+ let options = [
85
+ [device + ".current", { type: "state", common: { name: "current", type: "number", role: "value", def: 0, read: true, write: false, desc: "Current PAC", unit: "W" }, native: {} }],
86
+ [device + ".daily", { type: "state", common: { name: "daily", type: "number", role: "value", def: 0, read: true, write: false, desc: "Daily yield", unit: "kWh" }, native: {} }],
87
+ [device + ".monthly", { type: "state", common: { name: "monthly", type: "number", role: "value", def: 0, read: true, write: false, desc: "Monthly yield", unit: "kWh" }, native: {} }],
88
+ [device + ".yearly", { type: "state", common: { name: "yearly", type: "number", role: "value", def: 0, read: true, write: false, desc: "Yearly yield", unit: "kWh" }, native: {} }],
89
+ [device + ".total", { type: "state", common: { name: "total", type: "number", role: "value", def: 0, read: true, write: false, desc: "Total yield", unit: "kWh" }, native: {} }]
90
+ ];
91
+ if (additional) {
92
+ 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: {} }]
108
+ ];
109
+ options = options.concat(additionalOptions);
110
+ }
111
+ for (const option of options) {
112
+ await this.createObject(...option);
113
+ }
114
+ }
115
+ async adjustIntervalToSeconds() {
116
+ const adapterObj = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);
117
+ if (!this.config.interval_seconds) {
118
+ if (adapterObj) {
119
+ adapterObj.native.interval_seconds = true;
120
+ adapterObj.native.intervalVal *= 60;
121
+ this.log.warn("Interval changed to seconds!");
122
+ this.log.info("Interval attribute changed! Please check the configuration");
123
+ this.log.info("Adapter restarts");
124
+ }
125
+ }
126
+ }
127
+ preprocessSolarviewData(response) {
128
+ let sv_data = response.toString("ascii");
129
+ sv_data = sv_data.replace(/[{}]+/g, "");
130
+ return sv_data.split(",");
131
+ }
132
+ getSolarviewPrefix(dataCode) {
133
+ const prefixMap = {
134
+ "00": "pvig.",
135
+ "01": "pvi1.",
136
+ "02": "pvi2.",
137
+ "03": "pvi3.",
138
+ "04": "pvi4.",
139
+ "10": "scm0.",
140
+ "11": "scm1.",
141
+ "12": "scm2.",
142
+ "13": "scm3.",
143
+ "14": "scm4.",
144
+ "21": "d0supply.",
145
+ "22": "d0consumption."
146
+ };
147
+ return prefixMap[dataCode] || "";
148
+ }
149
+ processData = async (data) => {
150
+ const strdata = this.preprocessSolarviewData(data);
151
+ const id = this.getSolarviewPrefix(strdata[0]);
152
+ const cs = this.calcChecksum(data.toString("ascii"));
153
+ if (cs.result) {
154
+ this.handleChecksumSuccess(strdata, id, data);
155
+ } else {
156
+ this.handleChecksumFailure(cs, data);
157
+ }
158
+ };
159
+ handleConnectionError(errorMessage) {
160
+ this.log.error(errorMessage);
161
+ this.setStateChanged("info.connection", { val: false, ack: true });
162
+ }
163
+ handleChecksumSuccess(sv_data, sv_prefix, response) {
164
+ chkCnt = 0;
165
+ this.log.debug(sv_cmd + ": " + response.toString("ascii"));
166
+ this.updateSolarviewStates(sv_data, sv_prefix);
167
+ 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]))}`;
168
+ this.setStateChanged("info.lastUpdate", { val: sDate, ack: true });
169
+ this.setStateChanged("info.connection", { val: true, ack: true });
170
+ }
171
+ handleChecksumFailure(csum, response) {
172
+ chkCnt += 1;
173
+ if (chkCnt > 0 && csum.chksum !== 0) {
174
+ const buf = Buffer.from(response.toString("ascii"));
175
+ this.log.warn(`checksum not correct! <${buf[csum.ind - 1]} ${buf[csum.ind]} ${buf[csum.ind + 1]} ${buf[csum.ind + 2]} ${csum.chksum}>`);
176
+ this.log.warn(`${sv_cmd}: ${csum.data}`);
177
+ }
178
+ }
179
+ updateSolarviewStates(sv_data, sv_prefix) {
180
+ this.updateState(sv_prefix + "current", sv_data, 10);
181
+ if (sv_prefix === "pvig.") {
182
+ this.handleCCUUpdate(sv_data);
183
+ }
184
+ this.updateState(sv_prefix + "daily", sv_data, 6);
185
+ this.updateState(sv_prefix + "monthly", sv_data, 7);
186
+ this.updateState(sv_prefix + "yearly", sv_data, 8);
187
+ this.updateState(sv_prefix + "total", sv_data, 9);
188
+ if (sv_data.length >= 23) {
189
+ this.updateExtendedStates(sv_data, sv_prefix);
190
+ }
191
+ }
192
+ updateState(stateName, sv_data, index) {
193
+ const value = Number(sv_data[index]);
194
+ this.setStateChanged(stateName, { val: value, ack: true });
195
+ }
196
+ async handleCCUUpdate(sv_data) {
197
+ if (this.config.setCCU) {
198
+ const obj = await this.findForeignObjectAsync(this.config.CCUSystemV, "state");
199
+ if (obj && obj.name) {
200
+ this.log.debug("set CCU system variable: " + this.config.CCUSystemV);
201
+ this.setForeignState(this.config.CCUSystemV, { val: Number(sv_data[10]), ack: false });
202
+ } else {
203
+ this.log.error(`CCU system variable ${this.config.CCUSystemV} does not exist!`);
204
+ }
205
+ }
206
+ }
207
+ updateExtendedStates(sv_data, sv_prefix) {
208
+ this.updateState(sv_prefix + "udc", sv_data, 11);
209
+ this.updateState(sv_prefix + "idc", sv_data, 12);
210
+ this.updateState(sv_prefix + "udcb", sv_data, 13);
211
+ this.updateState(sv_prefix + "idcb", sv_data, 14);
212
+ this.updateState(sv_prefix + "udcc", sv_data, 15);
213
+ this.updateState(sv_prefix + "idcc", sv_data, 16);
214
+ this.updateState(sv_prefix + "udcd", sv_data, 17);
215
+ this.updateState(sv_prefix + "idcd", sv_data, 18);
216
+ if (sv_data.length === 27) {
217
+ this.updateState(sv_prefix + "ul1", sv_data, 19);
218
+ this.updateState(sv_prefix + "il1", sv_data, 20);
219
+ this.updateState(sv_prefix + "ul2", sv_data, 21);
220
+ this.updateState(sv_prefix + "il2", sv_data, 22);
221
+ this.updateState(sv_prefix + "ul3", sv_data, 23);
222
+ this.updateState(sv_prefix + "il3", sv_data, 24);
223
+ this.updateState(sv_prefix + "tkk", sv_data, 25);
224
+ } else if (sv_data.length === 23) {
225
+ this.updateState(sv_prefix + "ul1", sv_data, 19);
226
+ this.updateState(sv_prefix + "il1", sv_data, 20);
227
+ this.updateState(sv_prefix + "tkk", sv_data, 21);
228
+ }
229
+ }
230
+ async onReady() {
231
+ const ip_address = this.config.ipaddress;
232
+ const port = this.config.port;
233
+ let chkCnt2 = 0;
234
+ conn = new net.Socket();
235
+ conn.setTimeout(2e3);
236
+ const starttime = this.config.intervalstart.split(":").slice(0, 2).join(":");
237
+ const endtime = this.config.intervalend.split(":").slice(0, 2).join(":");
238
+ this.log.info("start solarview " + ip_address + ":" + port + " - polling interval: " + this.config.intervalVal + "s (" + starttime + " to " + endtime + ")");
239
+ this.log.info("d0 converter: " + this.config.d0converter.toString());
240
+ await this.createGlobalObjects();
241
+ await this.createSolarviewObjects("pvig", false);
242
+ if (this.config.d0converter)
243
+ await this.createSolarviewObjects("d0supply", false);
244
+ if (this.config.d0converter)
245
+ await this.createSolarviewObjects("d0consumption", false);
246
+ if (this.config.scm0)
247
+ await this.createSolarviewObjects("scm0", false);
248
+ if (this.config.scm1)
249
+ await this.createSolarviewObjects("scm1", false);
250
+ if (this.config.scm2)
251
+ await this.createSolarviewObjects("scm2", false);
252
+ if (this.config.scm3)
253
+ await this.createSolarviewObjects("scm3", false);
254
+ if (this.config.scm4)
255
+ await this.createSolarviewObjects("scm4", false);
256
+ if (this.config.pvi1)
257
+ await this.createSolarviewObjects("pvi1", true);
258
+ if (this.config.pvi2)
259
+ await this.createSolarviewObjects("pvi2", true);
260
+ if (this.config.pvi3)
261
+ await this.createSolarviewObjects("pvi3", true);
262
+ if (this.config.pvi4)
263
+ await this.createSolarviewObjects("pvi4", true);
264
+ conn.on("data", async (data) => {
265
+ chkCnt2 = 0;
266
+ clearTimeout(jobSchedule);
267
+ jobSchedule = setTimeout(() => {
268
+ this.getData(port, ip_address);
269
+ }, this.config.intervalVal * 1e3 - this.pTimeoutcnt);
270
+ await this.processData(data);
271
+ });
272
+ conn.on("close", () => {
273
+ this.log.debug("connection closed");
274
+ if (chkCnt2 > 3) {
275
+ this.setState("info.connection", false, true);
276
+ this.log.warn("Solarview Server is not reachable");
277
+ chkCnt2 = 0;
278
+ }
279
+ chkCnt2++;
280
+ clearTimeout(jobSchedule);
281
+ jobSchedule = setTimeout(() => {
282
+ this.getData(port, ip_address);
283
+ }, 1e4);
284
+ });
285
+ conn.on("error", (err) => {
286
+ this.log.error(err.message);
287
+ this.setStateChanged("info.connection", { val: false, ack: true });
288
+ });
289
+ if (this.config.interval_seconds) {
290
+ this.config.intervalVal = this.config.intervalVal;
291
+ } else {
292
+ await this.adjustIntervalToSeconds.call(this);
293
+ }
294
+ jobSchedule = setTimeout(async () => {
295
+ this.getData(port, ip_address);
296
+ }, 1e3);
297
+ }
298
+ async getData(port, ip_address) {
299
+ const { intervalstart, intervalend, d0converter, scm0, scm1, scm2, scm3, scm4, pvi1, pvi2, pvi3, pvi4 } = this.config;
300
+ const starttime = intervalstart.split(":").slice(0, 2).join(":");
301
+ let endtime = intervalend.split(":").slice(0, 2).join(":");
302
+ endtime = endtime === "00:00" ? "23:59" : endtime;
303
+ const dnow = /* @__PURE__ */ new Date();
304
+ const dstart = /* @__PURE__ */ new Date(`${dnow.getFullYear()}-${dnow.getMonth() + 1}-${dnow.getDate()} ${starttime}`);
305
+ const dend = /* @__PURE__ */ new Date(`${dnow.getFullYear()}-${dnow.getMonth() + 1}-${dnow.getDate()} ${endtime}`);
306
+ let timeoutCnt = 0;
307
+ const executeCommand = (cmd) => {
308
+ timeoutCnt += 500;
309
+ tout = setTimeout(() => {
310
+ conn.connect(port, ip_address, () => {
311
+ conn.write(cmd);
312
+ conn.end();
313
+ });
314
+ }, timeoutCnt);
315
+ };
316
+ if (dnow >= dstart && dnow <= dend) {
317
+ executeCommand("00*");
318
+ if (d0converter)
319
+ executeCommand("21*");
320
+ if (pvi1)
321
+ executeCommand("01*");
322
+ if (pvi2)
323
+ executeCommand("02*");
324
+ if (pvi3)
325
+ executeCommand("03*");
326
+ if (pvi4)
327
+ executeCommand("04*");
328
+ }
329
+ if (d0converter)
330
+ executeCommand("22*");
331
+ if (scm0)
332
+ executeCommand("10*");
333
+ if (scm1)
334
+ executeCommand("11*");
335
+ if (scm2)
336
+ executeCommand("12*");
337
+ if (scm3)
338
+ executeCommand("13*");
339
+ if (scm4)
340
+ executeCommand("14*");
341
+ if (this.pTimeoutcnt === 0)
342
+ this.pTimeoutcnt = timeoutCnt;
343
+ }
344
+ onUnload(callback) {
345
+ try {
346
+ clearTimeout(jobSchedule);
347
+ clearTimeout(tout);
348
+ conn.destroy();
349
+ this.setStateChanged("info.connection", { val: false, ack: true });
350
+ this.log.info("cleaned everything up...");
351
+ callback();
352
+ } catch (e) {
353
+ callback();
354
+ }
355
+ }
356
+ }
357
+ if (require.main !== module) {
358
+ module.exports = (options) => new Solarviewdatareader(options);
359
+ } else {
360
+ (() => new Solarviewdatareader())();
361
+ }
362
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 Solar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;AAAA,EAEQ,SAAS,UAA2B;AACxC,QAAI;AACA,mBAAa,WAAW;AACxB,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
+ "names": ["chkCnt"]
7
+ }
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "solarviewdatareader",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "news": {
6
+ "1.1.1": {
7
+ "en": "change to typescript\ndependencies updated\nbugfix CCU variable\ndocumentation changed",
8
+ "de": "änderung der schrift\naktualisierte abhängigkeiten\nbugfix CCU Variable\ndokumentation geändert",
9
+ "ru": "изменения в типографию\nобновленная информация о зависимостях\nbugfix переменная CCU\nдокументация изменена",
10
+ "pt": "mudar para typescript\ndependências atualizadas\nvariável de bugfix CCU\ndocumentação alterada",
11
+ "nl": "wijzigen naar typescript\nafhankelijkheden bijgewerkt\nbugfix CCU variabele\ndocumentatie gewijzigd",
12
+ "fr": "changement de code\ndépendances mises à jour\nbugfix variable CCU\nmodification de la documentation",
13
+ "it": "cambiamento a typescript\ndipendenze aggiornate\nbugfix CCU variabile\ndocumentazione modificata",
14
+ "es": "cambio a la escritura\ndependencias actualizadas\nbugfix CCU variable\ndocumentación modificada",
15
+ "pl": "zmiana na maszynopis\nzaktualizowane zależności\nzmienna CCU bugfix\nzmiana dokumentacji",
16
+ "uk": "зміна за замовчуванням\nоновлені залежності\njavaScript licenses API Веб-сайт\nдокументація",
17
+ "zh-cn": "更改为打字符\n更新依赖关系\nbugfix CCU 变量\n文件已更改"
18
+ },
6
19
  "1.1.0": {
7
20
  "en": "code optimizations\njsonConfig added\ndependencies updated\nnode >= 18, js-controller >= 5.0.19\nadmin >= 6.17.13 due to timePicker failure",
8
21
  "de": "codeoptimierungen\njsonConfig hinzugefügt\naktualisierte abhängigkeiten\nknoten >= 18, js-controller >= 5.19\nadmin >= 6.17.13 aufgrund von timePicker Ausfall",
@@ -80,19 +93,6 @@
80
93
  "pl": "zaktualizowano zależności\nproblem nr 20 naprawiony",
81
94
  "zh-cn": "已更新依赖项\n问题 #20 已修复",
82
95
  "uk": "залежності оновлено\nпроблема №20 виправлена"
83
- },
84
- "1.0.3": {
85
- "en": "dependencies updated",
86
- "de": "Abhängigkeiten aktualisiert",
87
- "ru": "зависимости обновлены",
88
- "pt": "dependências atualizadas",
89
- "nl": "afhankelijkheden bijgewerkt",
90
- "fr": "dépendances mises à jour",
91
- "it": "dipendenze aggiornate",
92
- "es": "dependencias actualizadas",
93
- "pl": "zaktualizowano zależności",
94
- "zh-cn": "依赖项已更新",
95
- "uk": "залежності оновлено"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -136,7 +136,7 @@
136
136
  },
137
137
  "tier": 3,
138
138
  "platform": "Javascript/Node.js",
139
- "main": "main.js",
139
+ "main": "build/main.js",
140
140
  "icon": "solarviewdatareader.png",
141
141
  "enabled": true,
142
142
  "extIcon": "https://raw.githubusercontent.com/afuerhoff/ioBroker.solarviewdatareader/master/admin/solarviewdatareader.png",
@@ -147,6 +147,8 @@
147
147
  "connectionType": "local",
148
148
  "dataSource": "poll",
149
149
  "compact": true,
150
+ "stopBeforeUpdate": true,
151
+ "stopTimeout": 1000,
150
152
  "adminUI": {
151
153
  "config": "json"
152
154
  },
@@ -173,14 +175,36 @@
173
175
  "pvi2": false,
174
176
  "pvi3": false,
175
177
  "pvi4": false,
178
+ "scm0": false,
176
179
  "scm1": false,
177
180
  "scm2": false,
178
181
  "scm3": false,
179
182
  "scm4": false,
180
- "scm5": false,
181
183
  "setCCU": false,
182
184
  "CCUSystemV": "hm-rega.0.xxxxx"
183
185
  },
184
186
  "objects": [],
185
- "instanceObjects": []
187
+ "instanceObjects": [
188
+ {
189
+ "_id": "info",
190
+ "type": "channel",
191
+ "common": {
192
+ "name": "Information"
193
+ },
194
+ "native": {}
195
+ },
196
+ {
197
+ "_id": "info.connection",
198
+ "type": "state",
199
+ "common": {
200
+ "role": "indicator.connected",
201
+ "name": "Device or service connected",
202
+ "type": "boolean",
203
+ "read": true,
204
+ "write": false,
205
+ "def": false
206
+ },
207
+ "native": {}
208
+ }
209
+ ]
186
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.solarviewdatareader",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Get data from SolarView",
5
5
  "author": {
6
6
  "name": "Achim Fürhoff",
@@ -27,35 +27,52 @@
27
27
  "@alcalzone/release-script-plugin-manual-review": "^3.7.0",
28
28
  "@iobroker/adapter-dev": "^1.3.0",
29
29
  "@iobroker/testing": "^4.1.3",
30
+ "@tsconfig/node18": "^18.2.4",
30
31
  "@types/chai": "^4.3.16",
31
32
  "@types/chai-as-promised": "^7.1.8",
32
33
  "@types/mocha": "^10.0.6",
33
- "@types/node": "^20.12.12",
34
+ "@types/node": "^20.13.0",
35
+ "@typescript-eslint/eslint-plugin": "^7.11.0",
36
+ "@typescript-eslint/parser": "^7.11.0",
34
37
  "chai": "^4.4.1",
35
38
  "chai-as-promised": "^7.1.2",
36
39
  "eslint": "^8.57.0",
37
- "mocha": "^10.4.0"
40
+ "mocha": "^10.4.0",
41
+ "rimraf": "^5.0.7",
42
+ "sinon": "^18.0.0",
43
+ "sinon-chai": "^3.7.0",
44
+ "source-map-support": "^0.5.21",
45
+ "ts-node": "^10.9.2",
46
+ "typescript": "^5.4.5"
38
47
  },
39
- "main": "main.js",
48
+ "main": "build/main.js",
49
+ "type": "commonjs",
40
50
  "files": [
41
- "admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
51
+ "admin{,/!(src)/**}/!(tsconfig|tsconfig.*|.eslintrc).json",
42
52
  "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
43
- "lib/",
53
+ "build/",
44
54
  "www/",
45
55
  "io-package.json",
46
- "LICENSE",
47
- "main.js"
56
+ "LICENSE"
48
57
  ],
49
58
  "scripts": {
50
- "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
59
+ "prebuild": "rimraf build",
60
+ "build": "build-adapter ts",
61
+ "watch": "build-adapter ts --watch",
62
+ "prebuild:ts": "rimraf build",
63
+ "build:ts": "build-adapter ts",
64
+ "watch:ts": "build-adapter ts --watch",
65
+ "test:ts": "mocha --config test/mocharc.custom.json src/**/*.test.ts",
51
66
  "test:package": "mocha test/package --exit",
52
67
  "test:integration": "mocha test/integration --exit",
53
- "test": "npm run test:js && npm run test:package",
54
- "aftest": "mocha test/af_test.js --exit",
55
- "check": "tsc --noEmit -p tsconfig.check.json",
56
- "lint": "eslint --ext .js,.jsx .",
68
+ "test": "npm run test:ts && npm run test:package",
69
+ "check": "tsc --noEmit",
70
+ "lint": "eslint --ext .ts src/",
71
+ "translate": "translate-adapter",
57
72
  "release": "release-script",
58
- "translate": "translate-adapter"
73
+ "release-patch": "release-script patch --yes",
74
+ "release-minor": "release-script minor --yes",
75
+ "release-major": "release-script major --yes"
59
76
  },
60
77
  "bugs": {
61
78
  "url": "https://github.com/afuerhoff/ioBroker.solarviewdatareader/issues"