diff --git a/nodes/ccu-connection.js b/nodes/ccu-connection.js index 08a84d5..3afec56 100644 --- a/nodes/ccu-connection.js +++ b/nodes/ccu-connection.js @@ -894,15 +894,13 @@ module.exports = function (RED) { * @returns {String|null} */ findChannel(name) { - let found; - Object.keys(this.channelNames).forEach(n => { - if (!found) { - if (this.channelNames[n] === name) { - found = n; - } + const arrChannelNames = Object.keys(this.channelNames); + for (let i = 0, len = arrChannelNames.length; i++; i < len) { + if (this.channelNames[arrChannelNames[i]] === name) { + return arrChannelNames[i]; } - }); - return found; + } + return null; } /**