clean up some debug prints and avoid overwriting the device name

master
Michael Zanetti 2020-01-18 20:57:43 +01:00
parent 3c0a4986f0
commit ad614f370a
1 changed files with 3 additions and 4 deletions

View File

@ -356,8 +356,7 @@ void DevicePluginTuya::updateChildDevices(Device *device)
Device *d = myDevices().findByParams(ParamList() << Param(tuyaSwitchDeviceIdParamTypeId, id)); Device *d = myDevices().findByParams(ParamList() << Param(tuyaSwitchDeviceIdParamTypeId, id));
if (d) { if (d) {
qCDebug(dcTuya()) << "Found existing Tuya switch" << id << name; qCDebug(dcTuya()) << "Found existing Tuya switch" << d->name() << id << name << (online ? "online:" : "offline") << (state ? "on": "off");
d->setName(name);
d->setStateValue(tuyaSwitchConnectedStateTypeId, online); d->setStateValue(tuyaSwitchConnectedStateTypeId, online);
d->setStateValue(tuyaSwitchPowerStateTypeId, state); d->setStateValue(tuyaSwitchPowerStateTypeId, state);
} else { } else {
@ -371,8 +370,7 @@ void DevicePluginTuya::updateChildDevices(Device *device)
Device *d = myDevices().findByParams(ParamList() << Param(tuyaClosableDeviceIdParamTypeId, id)); Device *d = myDevices().findByParams(ParamList() << Param(tuyaClosableDeviceIdParamTypeId, id));
if (d) { if (d) {
qCDebug(dcTuya()) << "Found existing Tuya cover" << id << name; qCDebug(dcTuya()) << "Found existing Tuya cover" << d->name() << id << name << (online ? "online" : "offline");
d->setName(name);
d->setStateValue(tuyaClosableConnectedStateTypeId, online); d->setStateValue(tuyaClosableConnectedStateTypeId, online);
} else { } else {
qCDebug(dcTuya()) << "Found new Tuya cover" << id << name; qCDebug(dcTuya()) << "Found new Tuya cover" << id << name;
@ -382,6 +380,7 @@ void DevicePluginTuya::updateChildDevices(Device *device)
} }
} else { } else {
qCWarning(dcTuya()) << "Skipping unsupported device type:" << devType; qCWarning(dcTuya()) << "Skipping unsupported device type:" << devType;
qCWarning(dcTuya()) << "Please report this including the following data:\n" << qUtf8Printable(QJsonDocument::fromVariant(deviceVariant).toJson());
continue; continue;
} }
} }