diff --git a/keba/integrationpluginkeba.cpp b/keba/integrationpluginkeba.cpp index 07ff9096..bfd28382 100644 --- a/keba/integrationpluginkeba.cpp +++ b/keba/integrationpluginkeba.cpp @@ -185,12 +185,32 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info) return; } - // Parse the product code and check if the model actually supports the communication - // Only series X and C support UDP/Modbus + // Parse the product code and check if the model actually supports the UDP/Modbus communication + // Supported are: + // - The A series (german edition), no meter DE440 (green edition) + // - The B series (german edition), no meter DE440 + // - All C series + // - All X series + if (productInformation.isValid()) { + bool supported = false; - // This model does not support communication with smart devices. + + qCDebug(dcKeba()) << "Product information are valid. Evaluating if model supports UDP/Modbus communication..."; + switch (productInformation.series()) { + case KebaProductInfo::SeriesA: + if (productInformation.model() == "P30" && productInformation.germanEdition()) { + qCDebug(dcKeba()) << "The P30 A series german edition is supported (DE440 GREEN EDITION)"; + supported = true; + } + break; + case KebaProductInfo::SeriesB: + if (productInformation.model() == "P30" && productInformation.germanEdition()) { + qCDebug(dcKeba()) << "The P30 B series german edition is supported (DE440)"; + supported = true; + } + break; case KebaProductInfo::SeriesC: case KebaProductInfo::SeriesXWlan: case KebaProductInfo::SeriesXWlan3G: @@ -205,10 +225,12 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info) } if (!supported) { - qCWarning(dcKeba()) << "Connected successfully to Keba but this" << productInformation.series() << "has no communication module."; + qCWarning(dcKeba()) << "Connected successfully to Keba but this model" << productInformation.series() << "has no communication module."; info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("This model does not support communication with smart devices.")); return; } + } else { + qCWarning(dcKeba()) << "Product information are not valid. Cannot determin if this model supports UDP/Modbus communication, assuming yes so let's try to init..."; } m_kebaDevices.insert(thing->id(), keba); diff --git a/keba/kebaproductinfo.cpp b/keba/kebaproductinfo.cpp index 2a5daf26..a850afec 100644 --- a/keba/kebaproductinfo.cpp +++ b/keba/kebaproductinfo.cpp @@ -186,6 +186,8 @@ KebaProductInfo::KebaProductInfo(const QString &productString) : return; } + m_germanEdition = m_productString.toUpper().endsWith("DE"); + qCDebug(dcKeba()) << "German Edition:" << m_germanEdition; } bool KebaProductInfo::isValid() const @@ -247,3 +249,8 @@ KebaProductInfo::Authorization KebaProductInfo::authorization() const { return m_authorization; } + +bool KebaProductInfo::germanEdition() const +{ + return m_germanEdition; +} diff --git a/keba/kebaproductinfo.h b/keba/kebaproductinfo.h index fd40eb0c..4363d08a 100644 --- a/keba/kebaproductinfo.h +++ b/keba/kebaproductinfo.h @@ -112,6 +112,7 @@ public: int phaseCount() const; // 1 or 3 Meter meter() const; // No meter, Calibrated, ... Authorization authorization() const; + bool germanEdition() const; private: bool m_isValid = true; @@ -127,6 +128,7 @@ private: int m_phaseCount; Meter m_meter; Authorization m_authorization; + bool m_germanEdition = false; }; #endif // KEBAPRODUCTINFO_H