mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-17 02:48:31 -07:00
Refactored light specific transtime to generic readAfterWriteTime value (#910)
* Refactored light specific transtime value to generic readAfterWriteTime value * Added line break
This commit is contained in:
parent
5970e498f3
commit
6dd2926a1d
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user