mirror of https://github.com/nymea/nymea.git
Don't call thingRemoved() on the plugin in case of reconfiguring
Reasoning: a) Currently, the API behaves inconsistently. While reconfiguring a "justAdd" thing, it did call thingRemoved, however, reconfiguring a thing that uses pairing did not. b) The old implementation did not consider childs. Reconfiguring a justAdd thing which has childs was calling thingRemoved on the parent only but not its childs. c) If we'd fix this by calling thingRemoved() for all flows and childs we'd end up in hells kitchen as we can't know about the new state of childs after the reconfiguration, so we can't just automatically add all the childs back ourselves, the plugin needs to do that. This in turn would mean that childs would get new ids which then breaks rules and stuff. So the conclusion has been to just re-run the setup and the plugin implementation is in charge for then checking the existing childs and calling autoThingDisappeared() as needed. WARNING: This also implies that we need to fix some plugins which currently rely on thingRemoved to be called for reconfiguration and might create duplicate connections or similar now.pull/309/head
parent
2ca4b2f32f
commit
573a2c061a
|
|
@ -402,9 +402,6 @@ ThingSetupInfo *ThingManagerImplementation::reconfigureThingInternal(Thing *thin
|
|||
}
|
||||
ParamList finalParams = buildParams(thing->thingClass().paramTypes(), params);
|
||||
|
||||
// first remove the thing in the plugin
|
||||
plugin->thingRemoved(thing);
|
||||
|
||||
// mark setup as incomplete
|
||||
thing->setSetupStatus(Thing::ThingSetupStatusInProgress, Thing::ThingErrorNoError);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue