diff --git a/lib/Gateway.js b/lib/Gateway.js index c587edb31b4..c69811069c7 100755 --- a/lib/Gateway.js +++ b/lib/Gateway.js @@ -45,10 +45,12 @@ const watch = (filename, fn) => { } catch { watchers.set( filename, - fs.watch(path.dirname(filename), () => { - watchers.get(filename).close() - watch(filename, fn) - fn() + fs.watch(path.dirname(filename), (e, f) => { + if (!f || f === 'customDevices.js' || f === 'customDevices.json') { + watchers.get(filename).close() + watch(filename, fn) + fn() + } }) ) } @@ -74,7 +76,6 @@ const loadCustomDevices = () => { loaded = customDevicesJsonPath devices = JSON.parse(fs.readFileSync(loaded)) } else { - debug('no custom devices sources found') return } } catch (error) {