Only mock state after set. #518

This commit is contained in:
Koenkk
2018-11-06 21:20:03 +01:00
parent 9119e54c2c
commit 86a102e081
+1 -1
View File
@@ -107,7 +107,7 @@ class DevicePublish {
endpoint,
(error, rsp) => {
// Devices do not report when they go off, this ensures state (on/off) is always in sync.
if (!error && (key.startsWith('state') || key === 'brightness')) {
if (type === 'set' && !error && (key.startsWith('state') || key === 'brightness')) {
const msg = {};
const _key = prefix ? `state_${prefix}` : 'state';
msg[_key] = key === 'brightness' ? 'ON' : json['state'];