From 45d6106826fcbeb5ebd860a7ed7e41d0f66a6319 Mon Sep 17 00:00:00 2001 From: Luke Rhodes Date: Thu, 22 Mar 2018 22:13:20 +1100 Subject: [PATCH] Simplified device discovery --- helpers/getDevice.js | 15 +-------------- index.js | 2 +- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/helpers/getDevice.js b/helpers/getDevice.js index 9039891b..14c4fe9f 100644 --- a/helpers/getDevice.js +++ b/helpers/getDevice.js @@ -27,21 +27,8 @@ const manualDevices = {}; let discovering = false; -const discoverDevices = (count = 0) => { - discovering = true; - - if (count >= 5) { - discovering = false; - - return; - } - +const discoverDevices = () => { broadlink.discover(); - count++; - - setTimeout(() => { - discoverDevices(count); - }, 5 * 1000) } broadlink.on('deviceReady', (device) => { diff --git a/index.js b/index.js index dbe47e74..ad266713 100644 --- a/index.js +++ b/index.js @@ -7,5 +7,5 @@ module.exports = (homebridge) => { homebridge.registerPlatform("homebridge-broadlink-rm", "BroadlinkRM", BroadlinkRMPlatform); - discoverDevices(); + discoverDevices(0, true); } \ No newline at end of file