diff --git a/lib/devices/gateway/subdevice.js b/lib/devices/gateway/subdevice.js index 01c1186..2e81d8f 100644 --- a/lib/devices/gateway/subdevice.js +++ b/lib/devices/gateway/subdevice.js @@ -168,11 +168,32 @@ module.exports = Thing.type(Parent => class SubDevice extends Parent { resolve(this.getProperties(props)); }; - // Reject this promise in 5 seconds + /* + * Fallback behavior, use a regular call if properties have not + * been resolved in a second. + */ setTimeout(() => { - this._currentRead = null; - reject(new Error('Timeout while waiting for sub-device properties')); - }, 5000); + this.debug('Read via DEV timed out, using fallback API'); + this._parent.call('get_device_prop_exp', [ [ 'lumi.' + this.internalId, ...this._propertiesToMonitor ]]) + .then(result => { + for(let i=0; i { + this._currentRead = null; + reject(err); + }); + }, 1000); }); return this._currentRead.promise;