diff --git a/lib/extension/devicePublish.js b/lib/extension/devicePublish.js index 9aa213945..1dbb3fe3f 100644 --- a/lib/extension/devicePublish.js +++ b/lib/extension/devicePublish.js @@ -175,10 +175,11 @@ class DevicePublish { ); }); - // When there is a transition in the message the state of the device gets out of sync. - // Therefore; at the end of the transition, read the new state from the device. - if (topic.type === 'set' && converted.zclData.transtime && entity.type === 'device') { - const time = converted.zclData.transtime * 100; + // It's possible for devices to get out of sync when writing an attribute that's not reportable. + // So here we re-read the value after a specified timeout, this timeout could for example be the + // transition time of a color change. + if (topic.type === 'set' && entity.type === 'device' + && converted.hasOwnProperty('readAfterWriteTime') && converted.readAfterWriteTime !== 0) { const getConverted = converter.convert(key, json[key], json, 'get'); setTimeout(() => { // Add job to queue @@ -188,7 +189,7 @@ class DevicePublish { getConverted.zclData, getConverted.cfg, endpoint, () => queueCallback() ); }); - }, time); + }, converted.readAfterWriteTime); } });