Skip to content

Commit

Permalink
refactor payload generation (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Feb 15, 2019
1 parent b039b37 commit 38d2b91
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nodes/ccu-signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ module.exports = function (RED) {
REPETITIONS: Number(config.repetitions),
OUTPUT_SELECT_SIZE: config.dimmer_list.length
};
for (let index = 0; index < config.dimmer_list.length; index++) {
const item = config.dimmer_list[index] || {color: 0, ontime: 0};
params['COLOR_LIST_' + (index + 1)] = Number(item.color);
params['ON_TIME_LIST_' + (index + 1)] = Number(item.ontime);
}
this.debug(params);
config.dimmer_list.forEach((item, i) => {
const index = i + 1;
params['COLOR_LIST_' + index] = Number(item.color);
params['ON_TIME_LIST_' + index] = Number(item.ontime);
});
this.ccu.methodCall(config.iface, 'putParamset', [config.channel, 'VALUES', params]);
break;
default:
Expand Down

0 comments on commit 38d2b91

Please sign in to comment.