diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5dc8a4f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + // Verwendet IntelliSense zum Ermitteln möglicher Attribute. + // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. + // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-node", + "request": "launch", + "name": "Mocha integration test", + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "outFiles": [ + "${workspaceFolder}/**/*.js" + ], + "args": [ + "test/integration", + "--exit" + ] + } + ] +} \ No newline at end of file diff --git a/build/src/main.js b/build/src/main.js index 1a4c37a..879240e 100644 --- a/build/src/main.js +++ b/build/src/main.js @@ -71,14 +71,14 @@ class HdgBavaria extends utils.Adapter { }, native: {}, }); - this.createLogStates(); - this.createStatisticsStates(); + this.nodes += await this.createLogStates(); + await this.createStatisticsStates(); + this.log.info("All states created! Using " + this.nodes + " to query HDG"); // Fix nodes string and do a first query this.nodes = this.nodes.substring(1); this.nodes = "nodes=" + this.nodes; this.hdgComm = new hdgcomm_1.HdgComm(this.config.ip, this.nodes); - this.log.info(this.nodes); - await new Promise(r => setTimeout(r, 1000)); + await new Promise(r => setTimeout(r, 2000)); this.poll(); // Schedule regular polling this.job = schedule.scheduleJob("*/" + this.config.pollIntervalMins + " * * * *", () => { @@ -206,12 +206,14 @@ class HdgBavaria extends utils.Adapter { } return (false); } - createLogStates() { + //private async createLogStates(): Promise { + async createLogStates() { + let nodes = ""; for (let i = 0; i < this.components.length; i++) { const c = this.components[i]; const channel = c.channel; this.log.info("Create channel " + this.config.name + "." + c.channel); - this.setObject(this.config.name + "." + c.channel, { + await this.setObjectNotExistsAsync(this.config.name + "." + c.channel, { type: "channel", common: { name: c.name, @@ -231,33 +233,23 @@ class HdgBavaria extends utils.Adapter { read: true, write: true, }; - this.createState(this.config.name, c.channel, state.id, stateCommon); - this.nodes += "-" + state.dataid + "T"; + await this.createStateAsync(this.config.name, c.channel, state.id, stateCommon); + nodes += "-" + state.dataid + "T"; } } + console.log("createLogStates returning " + nodes); + return nodes; //new Promise(() => {console.log("resolving");resolve(nodes)}); } - createStatisticsStates() { + async createStatisticsStates() { // Create statistics channel - this.setObject(this.config.name + ".statistics", { + await this.setObjectNotExistsAsync(this.config.name + ".statistics", { type: "channel", common: { name: "statistics", }, native: {}, }); - this.createBufferEnergyStates(); - } - createBufferEnergyStates() { - //if(this.bufferEnergy.datapoints.length == 0) return; - //this.createState(this.config.name, "statistics", "PufferEnergieabgabeHeute", { - // name: "Puffer Energieabgabe heute", - // type: "number", - // role: "value", - // unit: "Wh", - // read: true, - // write: false, - //}); - this.createState(this.config.name, "statistics", "ThermischeKapazitaet", { + await this.createStateAsync(this.config.name, "statistics", "ThermischeKapazitaet", { name: "Aktuelle thermische Kapazität des Puffers", type: "number", role: "level", @@ -265,6 +257,7 @@ class HdgBavaria extends utils.Adapter { read: true, write: false, }); + return; } poll() { var _a; @@ -283,7 +276,6 @@ class HdgBavaria extends utils.Adapter { try { const value = this.parseDatapoint(state, data[dpCnt].text); if (value != undefined) { - console.log("Setting " + state.id + " to " + value); this.setState(this.config.name + "." + c.channel + "." + state.id, { val: value, ack: true }); state.value = value; } diff --git a/build/src/main.js.map b/build/src/main.js.map index 326358b..b3bd2f3 100644 --- a/build/src/main.js.map +++ b/build/src/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0EAA0E;AAC1E,gCAAgC;AAChC,8DAAgD;AAChD,wDAA0C;AAC1C,uCAAmC;AACnC,6EAAiE;AAGjE,0DAAkC;AAClC,sDAA8B;AAC9B,0DAAkC;AAClC,4DAAoC;AAEpC,MAAM,UAAW,SAAQ,KAAK,CAAC,OAAO;IAWl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B;aAAM,IAAI,KAAK,CAAC,OAAO,IAAI,QAAQ,EAAE;YAClC,OAAO,IAAI,CAAC;SACf;aAAM;YACH,OAAO,EAAE,CAAA;SACZ;IACL,CAAC;CACJ;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IACzB,yCAAyC;IACzC,MAAM,CAAC,OAAO,GAAG,CAAC,OAAkD,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;CACpG;KAAM;IACH,wCAAwC;IACxC,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,CAAC;CAC9B"} \ No newline at end of file diff --git a/io-package.json b/io-package.json index 0664ab5..dc7e7e5 100644 --- a/io-package.json +++ b/io-package.json @@ -1,9 +1,9 @@ { "common": { "name": "hdg-bavaria", - "version": "0.3.1", + "version": "0.3.2", "news": { - "0.3.1": { + "0.3.2": { "en": "Integration test added", "de": "Integrationstest hinzugefügt" }, diff --git a/package-lock.json b/package-lock.json index 7c1b2df..b8675e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "iobroker.hdg-bavaria", - "version": "0.3.0", + "version": "0.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bbb8440..4cc2e5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.hdg-bavaria", - "version": "0.3.1", + "version": "0.3.2", "description": "Access HDG Control of HDG Bavaria boilers", "author": { "name": "stemaker", diff --git a/src/main.ts b/src/main.ts index 187b09c..fd35d61 100644 --- a/src/main.ts +++ b/src/main.ts @@ -58,15 +58,14 @@ class HdgBavaria extends utils.Adapter { native: {}, }); - this.createLogStates(); - this.createStatisticsStates(); + this.nodes += await this.createLogStates(); + await this.createStatisticsStates(); + this.log.info("All states created! Using "+this.nodes+" to query HDG"); // Fix nodes string and do a first query this.nodes = this.nodes.substring(1); this.nodes = "nodes="+this.nodes; this.hdgComm = new HdgComm(this.config.ip, this.nodes) - this.log.info(this.nodes); - await new Promise(r => setTimeout(r, 1000)); this.poll(); // Schedule regular polling @@ -193,12 +192,13 @@ class HdgBavaria extends utils.Adapter { return (false); } - private createLogStates(): void { + private async createLogStates(): Promise { + let nodes = ""; for (let i = 0; i < this.components.length; i++) { const c = this.components[i]; const channel = c!.channel; this.log.info("Create channel " + this.config.name + "." + c!.channel); - this.setObject(this.config.name + "." + c!.channel, { + await this.setObjectNotExistsAsync(this.config.name + "." + c!.channel, { type: "channel", common: { name: c!.name, @@ -219,35 +219,24 @@ class HdgBavaria extends utils.Adapter { read: true, write: true, } - this.createState(this.config.name, c!.channel, state.id, stateCommon); - this.nodes += "-" + state.dataid + "T"; + await this.createStateAsync(this.config.name, c!.channel, state.id, stateCommon); + nodes += "-" + state.dataid + "T"; } } + console.log("createLogStates returning "+nodes) + return nodes//new Promise(() => {console.log("resolving");resolve(nodes)}); } - private createStatisticsStates(): void { + private async createStatisticsStates(): Promise { // Create statistics channel - this.setObject(this.config.name + ".statistics", { + await this.setObjectNotExistsAsync(this.config.name + ".statistics", { type: "channel", common: { name: "statistics", }, native: {}, }); - this.createBufferEnergyStates(); - } - - private createBufferEnergyStates(): void { - //if(this.bufferEnergy.datapoints.length == 0) return; - //this.createState(this.config.name, "statistics", "PufferEnergieabgabeHeute", { - // name: "Puffer Energieabgabe heute", - // type: "number", - // role: "value", - // unit: "Wh", - // read: true, - // write: false, - //}); - this.createState(this.config.name, "statistics", "ThermischeKapazitaet", { + await this.createStateAsync(this.config.name, "statistics", "ThermischeKapazitaet", { name: "Aktuelle thermische Kapazität des Puffers", type: "number", role: "level", @@ -255,6 +244,7 @@ class HdgBavaria extends utils.Adapter { read: true, write: false, }); + return } private poll(): void { @@ -273,7 +263,6 @@ class HdgBavaria extends utils.Adapter { try { const value = this.parseDatapoint(state, data[dpCnt].text); if (value != undefined) { - console.log("Setting "+state.id+" to "+value); this.setState(this.config.name + "." + c.channel + "." + state.id, { val: value, ack: true }); state.value = value; } diff --git a/test/integration.js b/test/integration.js index ac459dd..d403b88 100644 --- a/test/integration.js +++ b/test/integration.js @@ -3,6 +3,7 @@ require('log-timestamp'); const path = require("path"); const ServerMock = require("mock-http-server"); const { tests, utils } = require("@iobroker/testing"); +const { expect } = require('chai'); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); @@ -50,7 +51,11 @@ tests.integration(path.join(__dirname, ".."), { status: 200, headers: { "content-type": "application/json" }, body: function(req) { - console.log("mock server reply POST"); + expect(req).to.be.a("object"); + expect(req).to.have.property("body") + expect(req.body).to.have.property("nodes") + expect(req.body.nodes.search("26000T")).to.be.greaterThanOrEqual(0) + console.log("mock server reply POST to request "+JSON.stringify(req.body)); return requestJson } } @@ -59,15 +64,21 @@ tests.integration(path.join(__dirname, ".."), { console.log("Starting Adapter"); await harness.startAdapterAndWait(); console.log("Adapter started"); - await sleep(2000); + await sleep(5000); console.log("Checking state ..."); - harness.states.getState("hdg-bavaria.0.Test.heizkreis.vorlauftemperatur", function(err, state) { + harness.states.getState("hdg-bavaria.0.Test.heizkreis.vorlauftemperatur", function (err, state) { if (err) console.error(err); - if (state.val == valueInt) { - console.log("Got the correct value :): "+state.val); - resolve(0); + expect(state).to.exist; + if(!state) { + console.log("Could not retrieve state hdg-bavaria.0.Test.heizkreis.vorlauftemperatur"); } else { - console.log("Got an incorrect value :(: "+state.val); + expect(state.val).to.exist + if(!state.val) { + console.log("Could not retrieve value of state hdg-bavaria.0.Test.heizkreis.vorlauftemperatur"); + } else { + expect(state.val).to.be.equal(valueInt); + resolve(0); + } } }); });