From 408edc3739c4d2a1ac440993a2d1d36b19fba30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Tue, 28 Sep 2021 13:52:00 +0200 Subject: [PATCH] Add keba reconfigure handling --- keba/integrationpluginkeba.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/keba/integrationpluginkeba.cpp b/keba/integrationpluginkeba.cpp index f608b6f0..be661728 100644 --- a/keba/integrationpluginkeba.cpp +++ b/keba/integrationpluginkeba.cpp @@ -100,9 +100,20 @@ void IntegrationPluginKeba::discoverThings(ThingDiscoveryInfo *info) void IntegrationPluginKeba::setupThing(ThingSetupInfo *info) { Thing *thing = info->thing(); - qCDebug(dcKebaKeContact()) << "Setting up" << thing->name() << thing->params(); - if (thing->thingClassId() == wallboxThingClassId) { + + // Handle reconfigure + if (myThings().contains(thing)) { + qCDebug(dcKebaKeContact()) << "Reconfigure" << thing->name() << thing->params(); + KeContact *keba = m_kebaDevices.take(thing->id()); + if (keba) { + delete keba; + // Now continue with the normal setup + } + } + + qCDebug(dcKebaKeContact()) << "Setting up" << thing->name() << thing->params(); + if (!m_kebaDataLayer){ qCDebug(dcKebaKeContact()) << "Creating new Keba data layer..."; m_kebaDataLayer= new KeContactDataLayer(this);