Open TbsJah opened 2 years ago
just to start and stop zip --> switch timertable
ZIP active //ID_Einst_SuZIP_akt 'hotWaterCircPumpTimerTableSelected': { setParameter: 506, setValue: 0 },
//ID_Einst_SuZIPWo_zeit_0_0 Time on 'hotWaterCircPumpTimerTableWeek'': { setParameter: 507, setValue: "on" ? '60' ; },
//ID_Einst_SuZIPWo_zeit_0_1 Time off 'hotWaterCircPumpTimerTableWeek'': { setParameter: 508, setValue: 0; },
'hotWaterCircPumpOnTime'': { setParameter: 697, setValue: 0; }, 'hotWaterCircPumpOffTime'': { setParameter: 698, setValue: 0; },
ZIP off //ID_Einst_SuZIP_akt 'hotWaterCircPumpTimerTableSelected': { setParameter: 506, setValue: 2 },
//ID_Einst_SuZIPWo_zeit_0_0 Time on 'hotWaterCircPumpTimerTableWeek'': { setParameter: 507, setValue: "on" '0'; },
//ID_Einst_SuZIPWo_zeit_0_1 Time off 'hotWaterCircPumpTimerTableWeek'': { setParameter: 508, setValue: 0; },
@TbsJah The mentioned example was only a idea how a "perfect user abstraction" could look like. But to not wait for a perfect abstraction we added with #20 at least the support to allow any parameter modification. Of course the typical user of this feature might be a power user actually starting the read the parameter descriptions and play around with the different settings.
So, did you finally resolve the issue?
I am personally using the following RAW parameter to control the circulation pump:
// turn on at 09:00
{
"raw_parameter": 507,
"value": 32400
}
// turn off at 22:00
{
"raw_parameter": 508,
"value": 79200
}
// alternatively, turn off completely
{
"raw_parameter": 507,
"value": 0
}
{
"raw_parameter": 508,
"value": 60
}
Thank you @waldbaer for answering the question. It's up to you @TbsJah to bring up a pull request. ;-)
@TbsJah The mentioned example was only a idea how a "perfect user abstraction" could look like. But to not wait for a perfect abstraction we added with #20 at least the support to allow any parameter modification. Of course the typical user of this feature might be a power user actually starting the read the parameter descriptions and play around with the different settings.
So, did you finally resolve the issue?
I am personally using the following RAW parameter to control the circulation pump:
// turn on at 09:00 { "raw_parameter": 507, "value": 32400 } // turn off at 22:00 { "raw_parameter": 508, "value": 79200 } // alternatively, turn off completely { "raw_parameter": 507, "value": 0 } { "raw_parameter": 508, "value": 60 }
Would it be possible to give me an example how to use the possibility with the "raw parameters"? I do not understand how to integrate this code in the example.js. The following code does not function:
pump.write( { "raw_parameter": 506, "value": 0 } );
I'm sure this is false. Could you give me a hint? Thanks a lot!
@Dagobert57
You can use a function node and set msg.raw_parameter
and msg.payload
, then forward the function node output to the 'luxtronik2 write' node.
Function node content:
msg.raw_parameter = 507;
msg.payload = 32400; // seconds since 0:00 (9 * 60 * 60)
return msg;
Or you use a 'change' node and set the two parameters:
In my above example I called it "value" instead of "payload", as I have some custom nodes before doing a queuing of multiple write operations...
Thank you for the explanation. I installed node red and I could reproduce what you did. I thought that the example refers to the version that works with node.js (there is another version for the use with node red: https://github.com/coolchip/node-red-contrib-luxtronik2).
Is it right that you can write these raw values only with the node red version of this code? When I want to change the times of my zirculation pump then I have to use node red, right?
I am trying to set up a smart home with openHAB and it would have been fine to use the node.js version to manipulate the times of the ZIP (unfortunately, the binding luxtronik2 of openHAB does not support to change times of the ZIP).
There was a plugin for node red for an older version of openHAB (version 3), in the version 4 this is no longer available. So I have to think about linking openHAB 4 with node red if this is the only way.
@Dagobert57 The Node-RED module is "just" a wrapper around the node.js package.
So it should be possible to use the writeRaw
directly:
Luxtronik.prototype.writeRaw = function (parameterNumber, rawValue, callback)
The Node-RED wrapper is calling the exact same API and passes msg.raw_parameter
as first and msg.payload
as second parameter.
Many thanks for your reply. Unfortunately, in the last two months I was not able to make more tests due to other obligations. I would be happy if you could look at it again.
When I modify the example.js that comes with the package as follows:
const luxtronik = require('./luxtronik');
const pump = luxtronik.createConnection('192.168.178.37', 8889);
pump.prototype.writeRaw = function (507, 32400, function (err, data) {
if (!err) {
console.log(data);
}
})
I get this error message:
pump.prototype.writeRaw = function (507, 32400, function (err, data) {
^^^
SyntaxError: Unexpected number
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1274:20)
at Module._compile (node:internal/modules/cjs/loader:1320:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49
Node.js v18.19.0
The same error occurs when I change to '507'. what am I doing wrong here?
You don't call a function, you need to define / provide the function.
Luxtronik.prototype.writeRaw = function (parameterNumber, rawValue, callback) {
... do all the stuff here
}
The anonymous function is then called with the listed parameters and can then do the writing.
@Dagobert57 I think you mean this:
const luxtronik = require('./luxtronik');
const pump = luxtronik.createConnection('192.168.178.37', 8889);
pump.prototype.writeRaw(507, 32400, function (err, data) {
if (!err) {
console.log(data);
}
});
I tested your example, but I get this error message:
pump.prototype.writeRaw(507, 32400, function (err, data) {
^
TypeError: Cannot read properties of undefined (reading 'writeRaw')
at Object.<anonymous> (/root/node_modules/luxtronik2/myexample.js:5:16)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49
In the meantime I found another solution that works. In Openhab I write the value for the ZIP, e.g. 32400 in the MQTT Broker. Via node-red I read this value and write it in the luxtronik. A bit fiddly, but it works.
How to use "Support RAW write operations #20" How can i change the timer tables for circpump?
Example has no effect const circPumpTimerTable = [ {on: "07:30", off: "11:00"}, {on: "14:00", off: "22:00"} ]; pump.write("hotWaterCircPumpTimerTableWeek", circPumpTimerTable);