From 053d5410e709c1794973162aecdf5f136417259d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 26 Jul 2024 11:35:37 +0200 Subject: [PATCH] Keba: Add support for P30 PV Edition --- keba/README.md | 1 + keba/integrationpluginkeba.cpp | 14 ++++++++------ keba/kebaproductinfo.cpp | 14 ++++++++------ keba/kebaproductinfo.h | 5 +++-- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/keba/README.md b/keba/README.md index 509c39b7..a667ad10 100644 --- a/keba/README.md +++ b/keba/README.md @@ -9,6 +9,7 @@ This plugin allows to control Keba KeContact EV-Charging stations. * P30 * c-series * x-series + * PV Edition * BMW (certain models) * [Keba Deutschland Edition](https://a.storyblok.com/f/40131/x/fc59dc7bf7/datenblatt_deutschland_edition.pdf) (DE440) (by March 2022) diff --git a/keba/integrationpluginkeba.cpp b/keba/integrationpluginkeba.cpp index 2af19966..9e2c9183 100644 --- a/keba/integrationpluginkeba.cpp +++ b/keba/integrationpluginkeba.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2022, nymea GmbH +* Copyright 2013 - 2024, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -38,10 +38,11 @@ IntegrationPluginKeba::IntegrationPluginKeba() { - // KebaProductInfo bmw("BMW-10-EC240522-E1R"); - // KebaProductInfo ke("KC-P30-EC240122-E0R"); - // KebaProductInfo ge("KC-P30-EC220112-000-DE"); - // KebaProductInfo n("KC-P30-EC2404B2-M0A-GE"); + // KebaProductInfo bmw("BMW-10-EC240522-E1R"); + // KebaProductInfo ke("KC-P30-EC240122-E0R"); + // KebaProductInfo ge("KC-P30-EC220112-000-DE"); + // KebaProductInfo n("KC-P30-EC2404B2-M0A-GE"); + // KebaProductInfo pv("KC-P30-EC2204U2-E00-PV"); } void IntegrationPluginKeba::init() @@ -146,7 +147,7 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info) qCDebug(dcKeba()) << "Setting up" << thing->name() << thing->params(); if (!m_kebaDataLayer){ qCDebug(dcKeba()) << "Creating new Keba data layer..."; - m_kebaDataLayer= new KeContactDataLayer(this); + m_kebaDataLayer = new KeContactDataLayer(this); if (!m_kebaDataLayer->init()) { m_kebaDataLayer->deleteLater(); m_kebaDataLayer = nullptr; @@ -421,6 +422,7 @@ void IntegrationPluginKeba::setupKeba(ThingSetupInfo *info, const QHostAddress & case KebaProductInfo::SeriesXWlan4G: case KebaProductInfo::SeriesX3G: case KebaProductInfo::SeriesX4G: + case KebaProductInfo::SeriesSpecial: qCDebug(dcKeba()) << "The keba" << productInformation.series() << "is capable of communicating using UDP"; supported = true; break; diff --git a/keba/kebaproductinfo.cpp b/keba/kebaproductinfo.cpp index 774f3faa..b1aac8ba 100644 --- a/keba/kebaproductinfo.cpp +++ b/keba/kebaproductinfo.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2022, nymea GmbH +* Copyright 2013 - 2024, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -40,6 +40,7 @@ KebaProductInfo::KebaProductInfo(const QString &productString) : // KC-P30-EC240122-E0R // KC-P30-EC220112-000-DE // KC-P30-EC2404B2-M0A-GE + // KC-P30-EC2204U2-E00-PV qCDebug(dcKeba()) << "Parsing product information from" << productString.count() << productString; if (m_productString.count() < 19) { @@ -69,7 +70,6 @@ KebaProductInfo::KebaProductInfo(const QString &productString) : m_model = subStrings.at(1); qCDebug(dcKeba()) << "Model:" << m_model; - QString descriptor = subStrings.at(2); // EC240522 m_countryCode = descriptor.at(0); // E qCDebug(dcKeba()) << "Country:" << m_countryCode; @@ -117,8 +117,7 @@ KebaProductInfo::KebaProductInfo(const QString &productString) : qCDebug(dcKeba()) << "Current:" << m_current; // KC-P30-EC24 01 22-E0R - - QString cableValue = descriptor.mid(4, 2)/*m_productString.mid(11, 2)*/; + QString cableValue = descriptor.mid(4, 2); if (cableValue == "00") { m_cable = NoCable; qCDebug(dcKeba()) << "Cable: No cable"; @@ -168,12 +167,16 @@ KebaProductInfo::KebaProductInfo(const QString &productString) : } else if (seriesValue.toLower() == QChar('h')) { m_series = SeriesX4G; qCDebug(dcKeba()) << "Series: X (4G)"; + } else if (seriesValue.toLower() == QChar('u')) { + m_series = SeriesSpecial; + qCDebug(dcKeba()) << "Series: Special" + m_productString.right(2); } else { + qCWarning(dcKeba()) << "Series: Unknown" << productString << "value:" << seriesValue; m_isValid = false; return; } - + // KC-P30-EC24012 2 -E0R QChar phaseCountValue = descriptor.at(7); if (phaseCountValue == QChar('1')) { m_phaseCount = 1; @@ -207,7 +210,6 @@ KebaProductInfo::KebaProductInfo(const QString &productString) : return; } - QChar authValue = meterInfos.at(2); if (authValue == QChar('0')) { m_authorization = NoAuthorization; diff --git a/keba/kebaproductinfo.h b/keba/kebaproductinfo.h index 8c7053f5..f45ca87f 100644 --- a/keba/kebaproductinfo.h +++ b/keba/kebaproductinfo.h @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2022, nymea GmbH +* Copyright 2013 - 2024, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -77,7 +77,8 @@ public: SeriesXWlan3G, SeriesXWlan4G, SeriesX3G, - SeriesX4G + SeriesX4G, + SeriesSpecial }; Q_ENUM(Series)