Skip to content

Commit

Permalink
allow iface, channel, datapoint and sysvar to be overwritten by msg (c…
Browse files Browse the repository at this point in the history
…lose #49)
  • Loading branch information
hobbyquaker committed May 12, 2019
1 parent 032e257 commit 3eb37af
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nodes/ccu-get-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ module.exports = function (RED) {

this.on('input', msg => {
let value;
if (config.iface === 'ReGaHSS') {
value = this.ccu.sysvar[config.sysvar];
const iface = msg.iface || config.iface;
const channel = msg.channel || config.channel.split(' ')[0];
const datapoint = msg.datapoint || config.datapoint;
const sysvar = msg.sysvar || config.sysvar;

if (iface === 'ReGaHSS') {
value = this.ccu.sysvar[sysvar];
} else {
const address = config.iface + '.' + config.channel.split(' ')[0] + '.' + config.datapoint;
const address = iface + '.' + channel + '.' + datapoint;
value = this.ccu.values[address];
}

Expand Down

0 comments on commit 3eb37af

Please sign in to comment.