From 04f48ecbaba6d40f0c76ae899f5bf45dc683bd26 Mon Sep 17 00:00:00 2001 From: Thomas Kluge Date: Sat, 31 Oct 2015 12:02:06 +0100 Subject: [PATCH] fixed thermostats --- platforms/HomeMatic.js | 6 ++++++ platforms/HomematicChannel.js | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/platforms/HomeMatic.js b/platforms/HomeMatic.js index 30244e5..f140f3d 100644 --- a/platforms/HomeMatic.js +++ b/platforms/HomeMatic.js @@ -360,6 +360,12 @@ HomeMaticPlatform.prototype = { }, + setRegaValue: function(channel, datapoint, value) { + var rega = new RegaRequest(this.log, this.ccuIP); + rega.setValue(channel, datapoint, value); + return; + }, + getValue: function(channel, datapoint, callback) { if (channel.indexOf("BidCos-RF.") > -1)  { diff --git a/platforms/HomematicChannel.js b/platforms/HomematicChannel.js index 2322fed..786b556 100644 --- a/platforms/HomematicChannel.js +++ b/platforms/HomematicChannel.js @@ -32,11 +32,11 @@ HomeMaticGenericChannel.prototype = { var that = this; if (this.state[dp] != undefined) { - callback(this.state[dp]); + if (callback!=undefined){callback(this.state[dp]);} } else { // that.log("No cached Value found start fetching and send temp 0 back"); this.remoteGetValue(dp); - callback(0); + if (callback!=undefined){callback(0);} } }, @@ -107,16 +107,22 @@ HomeMaticGenericChannel.prototype = { }, command: function(mode,dp,value,callback) { - + if (this.eventupdate==true) { return; } var that = this; if (mode == "set") { - //this.log("Send " + value + " to Datapoint " + dp + " at " + that.adress); + this.log("Send " + value + " to Datapoint " + dp + " at " + that.adress); that.platform.setValue(that.adress,dp,value); } + + if (mode == "setrega") { + this.log("Send " + value + " to Datapoint " + dp + " at " + that.adress); + that.platform.setRegaValue(that.adress,dp,value); + } + }, informationCharacteristics: function() { @@ -580,11 +586,15 @@ HomeMaticGenericChannel.prototype = { { cType: types.TARGET_TEMPERATURE_CTYPE, onUpdate: function(value) { - //that.delayed("set", "SET_TEMPERATURE", value,500); - that.delayed("set", "MANU_MODE", value,500); + if (that.state["CONTROL_MODE"]!=1) { + that.delayed("setrega", "MANU_MODE",value,500); + } else { + that.delayed("set", "SET_TEMPERATURE", value,500); + } }, onRead: function(callback) { that.query("SET_TEMPERATURE",callback); + that.query("CONTROL_MODE",undefined); }, onRegister: function(characteristic) {