Fixed indentation and added comments.
@@ -958,7 +958,8 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
rspItemState[QString("/lights/%1/state/on").arg(id)] = true;
rspItem["success"] = rspItemState;
rsp.list.append(rspItem);
- if (!isDoorLockDevice)
+
+ if (!isDoorLockDevice) // Avoid reporting the new state before the lock report its state as locking/unlocking operations takes time and can also gets stuck.
taskRef.lightNode->setValue(RStateOn, targetOn);
}
else
@@ -1505,7 +1506,8 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
rspItemState[QString("/lights/%1/state/on").arg(id)] = targetOn;
rspItem["success"] = rspItemState;
rsp.list.append(rspItem);
- if (!isDoorLockDevice)
+
+ if (!isDoorLockDevice) // Avoid reporting the new state before the lock report its state as locking/unlocking operations takes time and can also gets stuck.
taskRef.lightNode->setValue(RStateOn, targetOn);
}
else
