test smth

This commit is contained in:
Michael Zanetti 2023-05-15 12:17:00 +02:00
parent 846ded780e
commit 1141805763

View File

@ -1613,7 +1613,7 @@ void IntegrationPluginShelly::setupGen2(ThingSetupInfo *info)
} }
if (info->thing()->thingClassId() == shellyPlus25ThingClassId) { if (info->thing()->thingClassId() == shellyPlus25ThingClassId) {
// Make sure the shelly 2.5 is in the mode we expect it to be (roller/cover or relay/switch) // Make sure the shelly plus 2PM is in the mode we expect it to be (roller/cover or relay/switch)
bool rollerMode = info->thing()->paramValue("rollerMode").toBool(); bool rollerMode = info->thing()->paramValue("rollerMode").toBool();
QVariantMap params; QVariantMap params;
if(rollerMode) { if(rollerMode) {
@ -1622,14 +1622,13 @@ void IntegrationPluginShelly::setupGen2(ThingSetupInfo *info)
params.insert("name", "switch"); params.insert("name", "switch");
} }
ShellyRpcReply *reply2 = client->sendRequest("Shelly.SetProfile", params); ShellyRpcReply *reply2 = client->sendRequest("Shelly.SetProfile", params);
connect(reply2, &ShellyRpcReply::finished, info, [info](ShellyRpcReply::Status status, const QVariantMap &/*response*/){ connect(reply2, &ShellyRpcReply::finished, info, [this, info, rollerMode](ShellyRpcReply::Status status, const QVariantMap &/*response*/){
if (status != ShellyRpcReply::StatusSuccess) { if (status != ShellyRpcReply::StatusSuccess) {
qCWarning(dcShelly) << "Error during shelly setup"; qCWarning(dcShelly) << "Error during shelly setup";
info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Unable to configure shelly device.")); info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Unable to configure shelly device."));
return; return;
} }
info->finish(Thing::ThingErrorNoError); info->finish(Thing::ThingErrorNoError);
});
qCDebug(dcShelly()) << "***** Child count:" << myThings().filterByParentId(info->thing()->id()).count(); qCDebug(dcShelly()) << "***** Child count:" << myThings().filterByParentId(info->thing()->id()).count();
if (myThings().filterByParentId(info->thing()->id()).count() == 0) { if (myThings().filterByParentId(info->thing()->id()).count() == 0) {
@ -1656,6 +1655,8 @@ void IntegrationPluginShelly::setupGen2(ThingSetupInfo *info)
} }
emit autoThingsAppeared(children); emit autoThingsAppeared(children);
} }
});
return; return;
} }