Update keba debug category and fix set current
This commit is contained in:
parent
a21cf98aa4
commit
e23ddd4a54
@ -49,16 +49,16 @@ void IntegrationPluginKeba::init()
|
|||||||
void IntegrationPluginKeba::discoverThings(ThingDiscoveryInfo *info)
|
void IntegrationPluginKeba::discoverThings(ThingDiscoveryInfo *info)
|
||||||
{
|
{
|
||||||
if (info->thingClassId() == wallboxThingClassId) {
|
if (info->thingClassId() == wallboxThingClassId) {
|
||||||
qCDebug(dcKebaKeContact()) << "Discovering Keba Wallbox...";
|
qCDebug(dcKeba()) << "Discovering Keba Wallbox...";
|
||||||
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
||||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
||||||
ThingDescriptors descriptors;
|
ThingDescriptors descriptors;
|
||||||
qCDebug(dcKebaKeContact()) << "Discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "devices";
|
qCDebug(dcKeba()) << "Discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "devices";
|
||||||
foreach (const NetworkDeviceInfo &networkDeviceInfo, discoveryReply->networkDeviceInfos()) {
|
foreach (const NetworkDeviceInfo &networkDeviceInfo, discoveryReply->networkDeviceInfos()) {
|
||||||
if (!networkDeviceInfo.macAddressManufacturer().contains("keba", Qt::CaseSensitivity::CaseInsensitive))
|
if (!networkDeviceInfo.macAddressManufacturer().contains("keba", Qt::CaseSensitivity::CaseInsensitive))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << " - Keba Wallbox" << networkDeviceInfo;
|
qCDebug(dcKeba()) << " - Keba Wallbox" << networkDeviceInfo;
|
||||||
QString title = "Keba Wallbox ";
|
QString title = "Keba Wallbox ";
|
||||||
if (networkDeviceInfo.hostName().isEmpty()) {
|
if (networkDeviceInfo.hostName().isEmpty()) {
|
||||||
title += "(" + networkDeviceInfo.address().toString() + ")";
|
title += "(" + networkDeviceInfo.address().toString() + ")";
|
||||||
@ -78,7 +78,7 @@ void IntegrationPluginKeba::discoverThings(ThingDiscoveryInfo *info)
|
|||||||
// Check if we already have set up this device
|
// Check if we already have set up this device
|
||||||
Things existingThings = myThings().filterByParam(wallboxThingMacAddressParamTypeId, networkDeviceInfo.macAddress());
|
Things existingThings = myThings().filterByParam(wallboxThingMacAddressParamTypeId, networkDeviceInfo.macAddress());
|
||||||
if (existingThings.count() == 1) {
|
if (existingThings.count() == 1) {
|
||||||
qCDebug(dcKebaKeContact()) << "This wallbox already exists in the system!" << networkDeviceInfo;
|
qCDebug(dcKeba()) << "This wallbox already exists in the system!" << networkDeviceInfo;
|
||||||
descriptor.setThingId(existingThings.first()->id());
|
descriptor.setThingId(existingThings.first()->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ void IntegrationPluginKeba::discoverThings(ThingDiscoveryInfo *info)
|
|||||||
info->finish(Thing::ThingErrorNoError);
|
info->finish(Thing::ThingErrorNoError);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Could not discover things because of unhandled thing class id" << info->thingClassId().toString();
|
qCWarning(dcKeba()) << "Could not discover things because of unhandled thing class id" << info->thingClassId().toString();
|
||||||
info->finish(Thing::ThingErrorThingClassNotFound);
|
info->finish(Thing::ThingErrorThingClassNotFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info)
|
|||||||
|
|
||||||
// Handle reconfigure
|
// Handle reconfigure
|
||||||
if (myThings().contains(thing)) {
|
if (myThings().contains(thing)) {
|
||||||
qCDebug(dcKebaKeContact()) << "Reconfigure" << thing->name() << thing->params();
|
qCDebug(dcKeba()) << "Reconfigure" << thing->name() << thing->params();
|
||||||
KeContact *keba = m_kebaDevices.take(thing->id());
|
KeContact *keba = m_kebaDevices.take(thing->id());
|
||||||
if (keba) {
|
if (keba) {
|
||||||
delete keba;
|
delete keba;
|
||||||
@ -112,10 +112,10 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Setting up" << thing->name() << thing->params();
|
qCDebug(dcKeba()) << "Setting up" << thing->name() << thing->params();
|
||||||
|
|
||||||
if (!m_kebaDataLayer){
|
if (!m_kebaDataLayer){
|
||||||
qCDebug(dcKebaKeContact()) << "Creating new Keba data layer...";
|
qCDebug(dcKeba()) << "Creating new Keba data layer...";
|
||||||
m_kebaDataLayer= new KeContactDataLayer(this);
|
m_kebaDataLayer= new KeContactDataLayer(this);
|
||||||
if (!m_kebaDataLayer->init()) {
|
if (!m_kebaDataLayer->init()) {
|
||||||
m_kebaDataLayer->deleteLater();
|
m_kebaDataLayer->deleteLater();
|
||||||
@ -138,12 +138,12 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info)
|
|||||||
connect(keba, &KeContact::reportOneReceived, info, [info, this, keba] (const KeContact::ReportOne &report) {
|
connect(keba, &KeContact::reportOneReceived, info, [info, this, keba] (const KeContact::ReportOne &report) {
|
||||||
Thing *thing = info->thing();
|
Thing *thing = info->thing();
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Report one received for" << thing->name();
|
qCDebug(dcKeba()) << "Report one received for" << thing->name();
|
||||||
qCDebug(dcKebaKeContact()) << " - Firmware" << report.firmware;
|
qCDebug(dcKeba()) << " - Firmware" << report.firmware;
|
||||||
qCDebug(dcKebaKeContact()) << " - Serial" << report.serialNumber;
|
qCDebug(dcKeba()) << " - Serial" << report.serialNumber;
|
||||||
qCDebug(dcKebaKeContact()) << " - Product" << report.product;
|
qCDebug(dcKeba()) << " - Product" << report.product;
|
||||||
qCDebug(dcKebaKeContact()) << " - Uptime" << report.seconds/60 << "[min]";
|
qCDebug(dcKeba()) << " - Uptime" << report.seconds/60 << "[min]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Com Module" << report.comModule;
|
qCDebug(dcKeba()) << " - Com Module" << report.comModule;
|
||||||
|
|
||||||
thing->setStateValue(wallboxConnectedStateTypeId, true);
|
thing->setStateValue(wallboxConnectedStateTypeId, true);
|
||||||
thing->setStateValue(wallboxFirmwareStateTypeId, report.firmware);
|
thing->setStateValue(wallboxFirmwareStateTypeId, report.firmware);
|
||||||
@ -163,22 +163,22 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info)
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Could not setup thing: unhandled device class" << thing->thingClass();
|
qCWarning(dcKeba()) << "Could not setup thing: unhandled device class" << thing->thingClass();
|
||||||
info->finish(Thing::ThingErrorThingClassNotFound);
|
info->finish(Thing::ThingErrorThingClassNotFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntegrationPluginKeba::postSetupThing(Thing *thing)
|
void IntegrationPluginKeba::postSetupThing(Thing *thing)
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "Post setup" << thing->name();
|
qCDebug(dcKeba()) << "Post setup" << thing->name();
|
||||||
if (thing->thingClassId() != wallboxThingClassId) {
|
if (thing->thingClassId() != wallboxThingClassId) {
|
||||||
qCWarning(dcKebaKeContact()) << "Thing class id not supported" << thing->thingClassId();
|
qCWarning(dcKeba()) << "Thing class id not supported" << thing->thingClassId();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeContact *keba = m_kebaDevices.value(thing->id());
|
KeContact *keba = m_kebaDevices.value(thing->id());
|
||||||
if (!keba) {
|
if (!keba) {
|
||||||
qCWarning(dcKebaKeContact()) << "No Keba connection found for this thing";
|
qCWarning(dcKeba()) << "No Keba connection found for this thing";
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
keba->getReport2();
|
keba->getReport2();
|
||||||
@ -196,7 +196,7 @@ void IntegrationPluginKeba::postSetupThing(Thing *thing)
|
|||||||
foreach (Thing *thing, myThings().filterByThingClassId(wallboxThingClassId)) {
|
foreach (Thing *thing, myThings().filterByThingClassId(wallboxThingClassId)) {
|
||||||
KeContact *keba = m_kebaDevices.value(thing->id());
|
KeContact *keba = m_kebaDevices.value(thing->id());
|
||||||
if (!keba) {
|
if (!keba) {
|
||||||
qCWarning(dcKebaKeContact()) << "No Keba connection found for" << thing->name();
|
qCWarning(dcKeba()) << "No Keba connection found for" << thing->name();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
keba->getReport2();
|
keba->getReport2();
|
||||||
@ -217,7 +217,7 @@ void IntegrationPluginKeba::postSetupThing(Thing *thing)
|
|||||||
foreach (Thing *thing, myThings().filterByThingClassId(wallboxThingClassId)) {
|
foreach (Thing *thing, myThings().filterByThingClassId(wallboxThingClassId)) {
|
||||||
KeContact *keba = m_kebaDevices.value(thing->id());
|
KeContact *keba = m_kebaDevices.value(thing->id());
|
||||||
if (!keba) {
|
if (!keba) {
|
||||||
qCWarning(dcKebaKeContact()) << "No Keba connection found for" << thing->name();
|
qCWarning(dcKeba()) << "No Keba connection found for" << thing->name();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,18 +234,18 @@ void IntegrationPluginKeba::postSetupThing(Thing *thing)
|
|||||||
|
|
||||||
void IntegrationPluginKeba::thingRemoved(Thing *thing)
|
void IntegrationPluginKeba::thingRemoved(Thing *thing)
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "Deleting" << thing->name();
|
qCDebug(dcKeba()) << "Deleting" << thing->name();
|
||||||
if (thing->thingClassId() == wallboxThingClassId) {
|
if (thing->thingClassId() == wallboxThingClassId) {
|
||||||
KeContact *keba = m_kebaDevices.take(thing->id());
|
KeContact *keba = m_kebaDevices.take(thing->id());
|
||||||
keba->deleteLater();
|
keba->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myThings().empty()) {
|
if (myThings().empty()) {
|
||||||
qCDebug(dcKebaKeContact()) << "Closing UDP Ports";
|
qCDebug(dcKeba()) << "Closing UDP Ports";
|
||||||
m_kebaDataLayer->deleteLater();
|
m_kebaDataLayer->deleteLater();
|
||||||
m_kebaDataLayer= nullptr;
|
m_kebaDataLayer= nullptr;
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Stopping plugin timers ...";
|
qCDebug(dcKeba()) << "Stopping plugin timers ...";
|
||||||
if (m_reconnectTimer) {
|
if (m_reconnectTimer) {
|
||||||
hardwareManager()->pluginTimerManager()->unregisterTimer(m_reconnectTimer);
|
hardwareManager()->pluginTimerManager()->unregisterTimer(m_reconnectTimer);
|
||||||
m_reconnectTimer = nullptr;
|
m_reconnectTimer = nullptr;
|
||||||
@ -311,11 +311,11 @@ void IntegrationPluginKeba::setDevicePlugState(Thing *thing, KeContact::PlugStat
|
|||||||
|
|
||||||
void IntegrationPluginKeba::searchNetworkDevices()
|
void IntegrationPluginKeba::searchNetworkDevices()
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "Start searching for things...";
|
qCDebug(dcKeba()) << "Start searching for things...";
|
||||||
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
||||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
||||||
ThingDescriptors descriptors;
|
ThingDescriptors descriptors;
|
||||||
qCDebug(dcKebaKeContact()) << "Discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "devices";
|
qCDebug(dcKeba()) << "Discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "devices";
|
||||||
foreach (const NetworkDeviceInfo &networkDeviceInfo, discoveryReply->networkDeviceInfos()) {
|
foreach (const NetworkDeviceInfo &networkDeviceInfo, discoveryReply->networkDeviceInfos()) {
|
||||||
if (!networkDeviceInfo.hostName().contains("keba", Qt::CaseSensitivity::CaseInsensitive))
|
if (!networkDeviceInfo.hostName().contains("keba", Qt::CaseSensitivity::CaseInsensitive))
|
||||||
continue;
|
continue;
|
||||||
@ -324,22 +324,22 @@ void IntegrationPluginKeba::searchNetworkDevices()
|
|||||||
if (existingThing->paramValue(wallboxThingMacAddressParamTypeId).toString().isEmpty()) {
|
if (existingThing->paramValue(wallboxThingMacAddressParamTypeId).toString().isEmpty()) {
|
||||||
//This device got probably manually setup, to enable auto rediscovery the MAC address needs to setup
|
//This device got probably manually setup, to enable auto rediscovery the MAC address needs to setup
|
||||||
if (existingThing->paramValue(wallboxThingIpAddressParamTypeId).toString() == networkDeviceInfo.address().toString()) {
|
if (existingThing->paramValue(wallboxThingIpAddressParamTypeId).toString() == networkDeviceInfo.address().toString()) {
|
||||||
qCDebug(dcKebaKeContact()) << "Keba Wallbox MAC Address has been discovered" << existingThing->name() << networkDeviceInfo.macAddress();
|
qCDebug(dcKeba()) << "Keba Wallbox MAC Address has been discovered" << existingThing->name() << networkDeviceInfo.macAddress();
|
||||||
existingThing->setParamValue(wallboxThingMacAddressParamTypeId, networkDeviceInfo.macAddress());
|
existingThing->setParamValue(wallboxThingMacAddressParamTypeId, networkDeviceInfo.macAddress());
|
||||||
}
|
}
|
||||||
} else if (existingThing->paramValue(wallboxThingMacAddressParamTypeId).toString() == networkDeviceInfo.macAddress()) {
|
} else if (existingThing->paramValue(wallboxThingMacAddressParamTypeId).toString() == networkDeviceInfo.macAddress()) {
|
||||||
// We found the existing keba thing, lets check if the ip has changed
|
// We found the existing keba thing, lets check if the ip has changed
|
||||||
if (existingThing->paramValue(wallboxThingIpAddressParamTypeId).toString() != networkDeviceInfo.address().toString()) {
|
if (existingThing->paramValue(wallboxThingIpAddressParamTypeId).toString() != networkDeviceInfo.address().toString()) {
|
||||||
qCDebug(dcKebaKeContact()) << "Keba Wallbox IP Address has changed, from" << existingThing->paramValue(wallboxThingIpAddressParamTypeId).toString() << "to" << networkDeviceInfo.address().toString();
|
qCDebug(dcKeba()) << "Keba Wallbox IP Address has changed, from" << existingThing->paramValue(wallboxThingIpAddressParamTypeId).toString() << "to" << networkDeviceInfo.address().toString();
|
||||||
existingThing->setParamValue(wallboxThingIpAddressParamTypeId, networkDeviceInfo.address().toString());
|
existingThing->setParamValue(wallboxThingIpAddressParamTypeId, networkDeviceInfo.address().toString());
|
||||||
KeContact *keba = m_kebaDevices.value(existingThing->id());
|
KeContact *keba = m_kebaDevices.value(existingThing->id());
|
||||||
if (keba) {
|
if (keba) {
|
||||||
keba->setAddress(QHostAddress(networkDeviceInfo.address()));
|
keba->setAddress(QHostAddress(networkDeviceInfo.address()));
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Could not update IP address, for" << existingThing;
|
qCWarning(dcKeba()) << "Could not update IP address, for" << existingThing;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCDebug(dcKebaKeContact()) << "Keba Wallbox" << existingThing->name() << "IP address has not changed" << networkDeviceInfo.address().toString();
|
qCDebug(dcKeba()) << "Keba Wallbox" << existingThing->name() << "IP address has not changed" << networkDeviceInfo.address().toString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ void IntegrationPluginKeba::onConnectionChanged(bool status)
|
|||||||
KeContact *keba = static_cast<KeContact *>(sender());
|
KeContact *keba = static_cast<KeContact *>(sender());
|
||||||
Thing *thing = myThings().findById(m_kebaDevices.key(keba));
|
Thing *thing = myThings().findById(m_kebaDevices.key(keba));
|
||||||
if (!thing) {
|
if (!thing) {
|
||||||
qCWarning(dcKebaKeContact()) << "On connection changed: missing device object";
|
qCWarning(dcKeba()) << "On connection changed: missing device object";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ void IntegrationPluginKeba::onCommandExecuted(QUuid requestId, bool success)
|
|||||||
|
|
||||||
Thing *thing = myThings().findById(m_kebaDevices.key(keba));
|
Thing *thing = myThings().findById(m_kebaDevices.key(keba));
|
||||||
if (!thing) {
|
if (!thing) {
|
||||||
qCWarning(dcKebaKeContact()) << "On command executed: missing device object";
|
qCWarning(dcKeba()) << "On command executed: missing device object";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,25 +392,25 @@ void IntegrationPluginKeba::onReportTwoReceived(const KeContact::ReportTwo &repo
|
|||||||
if (!thing)
|
if (!thing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Report 2 received for" << thing->name() << "Serial number:" << thing->stateValue(wallboxSerialnumberStateTypeId).toString();
|
qCDebug(dcKeba()) << "Report 2 received for" << thing->name() << "Serial number:" << thing->stateValue(wallboxSerialnumberStateTypeId).toString();
|
||||||
qCDebug(dcKebaKeContact()) << " - State:" << reportTwo.state;
|
qCDebug(dcKeba()) << " - State:" << reportTwo.state;
|
||||||
qCDebug(dcKebaKeContact()) << " - Error 1:" << reportTwo.error1;
|
qCDebug(dcKeba()) << " - Error 1:" << reportTwo.error1;
|
||||||
qCDebug(dcKebaKeContact()) << " - Error 2:" << reportTwo.error2;
|
qCDebug(dcKeba()) << " - Error 2:" << reportTwo.error2;
|
||||||
qCDebug(dcKebaKeContact()) << " - Plug:" << reportTwo.plugState;
|
qCDebug(dcKeba()) << " - Plug:" << reportTwo.plugState;
|
||||||
qCDebug(dcKebaKeContact()) << " - Enable sys:" << reportTwo.enableSys;
|
qCDebug(dcKeba()) << " - Enable sys:" << reportTwo.enableSys;
|
||||||
qCDebug(dcKebaKeContact()) << " - Enable user:" << reportTwo.enableUser;
|
qCDebug(dcKeba()) << " - Enable user:" << reportTwo.enableUser;
|
||||||
qCDebug(dcKebaKeContact()) << " - Max curr:" << reportTwo.maxCurrent;
|
qCDebug(dcKeba()) << " - Max curr:" << reportTwo.maxCurrent;
|
||||||
qCDebug(dcKebaKeContact()) << " - Max curr %:" << reportTwo.maxCurrentPercentage;
|
qCDebug(dcKeba()) << " - Max curr %:" << reportTwo.maxCurrentPercentage;
|
||||||
qCDebug(dcKebaKeContact()) << " - Curr HW:" << reportTwo.currentHardwareLimitation;
|
qCDebug(dcKeba()) << " - Curr HW:" << reportTwo.currentHardwareLimitation;
|
||||||
qCDebug(dcKebaKeContact()) << " - Curr User:" << reportTwo.currentUser;
|
qCDebug(dcKeba()) << " - Curr User:" << reportTwo.currentUser;
|
||||||
qCDebug(dcKebaKeContact()) << " - Curr FS:" << reportTwo.currentFailsafe;
|
qCDebug(dcKeba()) << " - Curr FS:" << reportTwo.currentFailsafe;
|
||||||
qCDebug(dcKebaKeContact()) << " - Tmo FS:" << reportTwo.timeoutFailsafe;
|
qCDebug(dcKeba()) << " - Tmo FS:" << reportTwo.timeoutFailsafe;
|
||||||
qCDebug(dcKebaKeContact()) << " - Curr timer:" << reportTwo.currTimer;
|
qCDebug(dcKeba()) << " - Curr timer:" << reportTwo.currTimer;
|
||||||
qCDebug(dcKebaKeContact()) << " - Timeout CT:" << reportTwo.timeoutCt;
|
qCDebug(dcKeba()) << " - Timeout CT:" << reportTwo.timeoutCt;
|
||||||
qCDebug(dcKebaKeContact()) << " - Output:" << reportTwo.output;
|
qCDebug(dcKeba()) << " - Output:" << reportTwo.output;
|
||||||
qCDebug(dcKebaKeContact()) << " - Input:" << reportTwo.input;
|
qCDebug(dcKeba()) << " - Input:" << reportTwo.input;
|
||||||
qCDebug(dcKebaKeContact()) << " - Serial number:" << reportTwo.serialNumber;
|
qCDebug(dcKeba()) << " - Serial number:" << reportTwo.serialNumber;
|
||||||
qCDebug(dcKebaKeContact()) << " - Uptime:" << reportTwo.seconds/60 << "[min]";
|
qCDebug(dcKeba()) << " - Uptime:" << reportTwo.seconds/60 << "[min]";
|
||||||
|
|
||||||
if (reportTwo.serialNumber == thing->stateValue(wallboxSerialnumberStateTypeId).toString()) {
|
if (reportTwo.serialNumber == thing->stateValue(wallboxSerialnumberStateTypeId).toString()) {
|
||||||
setDeviceState(thing, reportTwo.state);
|
setDeviceState(thing, reportTwo.state);
|
||||||
@ -421,7 +421,8 @@ void IntegrationPluginKeba::onReportTwoReceived(const KeContact::ReportTwo &repo
|
|||||||
thing->setStateValue(wallboxError2StateTypeId, reportTwo.error2);
|
thing->setStateValue(wallboxError2StateTypeId, reportTwo.error2);
|
||||||
thing->setStateValue(wallboxSystemEnabledStateTypeId, reportTwo.enableSys);
|
thing->setStateValue(wallboxSystemEnabledStateTypeId, reportTwo.enableSys);
|
||||||
|
|
||||||
thing->setStateValue(wallboxMaxChargingCurrentStateTypeId, reportTwo.currentUser);
|
thing->setStateValue(wallboxMaxChargingCurrentStateTypeId, reportTwo.currTimer);
|
||||||
|
thing->setStateValue(wallboxMaxChargingCurrentGeneralStateTypeId, reportTwo.currentUser);
|
||||||
thing->setStateValue(wallboxMaxChargingCurrentPercentStateTypeId, reportTwo.maxCurrentPercentage);
|
thing->setStateValue(wallboxMaxChargingCurrentPercentStateTypeId, reportTwo.maxCurrentPercentage);
|
||||||
thing->setStateValue(wallboxMaxPossibleChargingCurrentStateTypeId, reportTwo.currentHardwareLimitation);
|
thing->setStateValue(wallboxMaxPossibleChargingCurrentStateTypeId, reportTwo.currentHardwareLimitation);
|
||||||
|
|
||||||
@ -430,7 +431,7 @@ void IntegrationPluginKeba::onReportTwoReceived(const KeContact::ReportTwo &repo
|
|||||||
|
|
||||||
thing->setStateValue(wallboxUptimeStateTypeId, reportTwo.seconds / 60);
|
thing->setStateValue(wallboxUptimeStateTypeId, reportTwo.seconds / 60);
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Received report but the serial number didn't match";
|
qCWarning(dcKeba()) << "Received report but the serial number didn't match";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,18 +442,18 @@ void IntegrationPluginKeba::onReportThreeReceived(const KeContact::ReportThree &
|
|||||||
if (!thing)
|
if (!thing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Report 3 received for" << thing->name() << "Serial number:" << thing->stateValue(wallboxSerialnumberStateTypeId).toString();
|
qCDebug(dcKeba()) << "Report 3 received for" << thing->name() << "Serial number:" << thing->stateValue(wallboxSerialnumberStateTypeId).toString();
|
||||||
qCDebug(dcKebaKeContact()) << " - Current phase 1:" << reportThree.currentPhase1 << "[A]";
|
qCDebug(dcKeba()) << " - Current phase 1:" << reportThree.currentPhase1 << "[A]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Current phase 2:" << reportThree.currentPhase2 << "[A]";
|
qCDebug(dcKeba()) << " - Current phase 2:" << reportThree.currentPhase2 << "[A]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Current phase 3:" << reportThree.currentPhase3 << "[A]";
|
qCDebug(dcKeba()) << " - Current phase 3:" << reportThree.currentPhase3 << "[A]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Voltage phase 1:" << reportThree.voltagePhase1 << "[V]";
|
qCDebug(dcKeba()) << " - Voltage phase 1:" << reportThree.voltagePhase1 << "[V]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Voltage phase 2:" << reportThree.voltagePhase2 << "[V]";
|
qCDebug(dcKeba()) << " - Voltage phase 2:" << reportThree.voltagePhase2 << "[V]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Voltage phase 3:" << reportThree.voltagePhase3 << "[V]";
|
qCDebug(dcKeba()) << " - Voltage phase 3:" << reportThree.voltagePhase3 << "[V]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Power consumption:" << reportThree.power << "[kW]";
|
qCDebug(dcKeba()) << " - Power consumption:" << reportThree.power << "[kW]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Energy session" << reportThree.energySession << "[kWh]";
|
qCDebug(dcKeba()) << " - Energy session" << reportThree.energySession << "[kWh]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Energy total" << reportThree.energyTotal << "[kWh]";
|
qCDebug(dcKeba()) << " - Energy total" << reportThree.energyTotal << "[kWh]";
|
||||||
qCDebug(dcKebaKeContact()) << " - Serial number" << reportThree.serialNumber;
|
qCDebug(dcKeba()) << " - Serial number" << reportThree.serialNumber;
|
||||||
qCDebug(dcKebaKeContact()) << " - Uptime" << reportThree.seconds/60 << "[min]";
|
qCDebug(dcKeba()) << " - Uptime" << reportThree.seconds/60 << "[min]";
|
||||||
|
|
||||||
if (reportThree.serialNumber == thing->stateValue(wallboxSerialnumberStateTypeId).toString()) {
|
if (reportThree.serialNumber == thing->stateValue(wallboxSerialnumberStateTypeId).toString()) {
|
||||||
thing->setStateValue(wallboxCurrentPhase1EventTypeId, reportThree.currentPhase1);
|
thing->setStateValue(wallboxCurrentPhase1EventTypeId, reportThree.currentPhase1);
|
||||||
@ -466,7 +467,7 @@ void IntegrationPluginKeba::onReportThreeReceived(const KeContact::ReportThree &
|
|||||||
thing->setStateValue(wallboxPowerFactorStateTypeId, reportThree.powerFactor);
|
thing->setStateValue(wallboxPowerFactorStateTypeId, reportThree.powerFactor);
|
||||||
thing->setStateValue(wallboxTotalEnergyConsumedStateTypeId, reportThree.energyTotal);
|
thing->setStateValue(wallboxTotalEnergyConsumedStateTypeId, reportThree.energyTotal);
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Received report but the serial number didn't match";
|
qCWarning(dcKeba()) << "Received report but the serial number didn't match";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,18 +478,18 @@ void IntegrationPluginKeba::onReport1XXReceived(int reportNumber, const KeContac
|
|||||||
if (!thing)
|
if (!thing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Report" << reportNumber << "received for" << thing->name() << "Serial number:" << thing->stateValue(wallboxSerialnumberStateTypeId).toString();
|
qCDebug(dcKeba()) << "Report" << reportNumber << "received for" << thing->name() << "Serial number:" << thing->stateValue(wallboxSerialnumberStateTypeId).toString();
|
||||||
qCDebug(dcKebaKeContact()) << " - Session Id" << report.sessionId;
|
qCDebug(dcKeba()) << " - Session Id" << report.sessionId;
|
||||||
qCDebug(dcKebaKeContact()) << " - Curr HW" << report.currHW;
|
qCDebug(dcKeba()) << " - Curr HW" << report.currHW;
|
||||||
qCDebug(dcKebaKeContact()) << " - Energy start" << report.startEnergy;
|
qCDebug(dcKeba()) << " - Energy start" << report.startEnergy;
|
||||||
qCDebug(dcKebaKeContact()) << " - Energy present" << report.presentEnergy;
|
qCDebug(dcKeba()) << " - Energy present" << report.presentEnergy;
|
||||||
qCDebug(dcKebaKeContact()) << " - Start time" << report.startTime;
|
qCDebug(dcKeba()) << " - Start time" << report.startTime;
|
||||||
qCDebug(dcKebaKeContact()) << " - End time" << report.endTime;
|
qCDebug(dcKeba()) << " - End time" << report.endTime;
|
||||||
qCDebug(dcKebaKeContact()) << " - Stop reason" << report.stopReason;
|
qCDebug(dcKeba()) << " - Stop reason" << report.stopReason;
|
||||||
qCDebug(dcKebaKeContact()) << " - RFID Tag" << report.rfidTag;
|
qCDebug(dcKeba()) << " - RFID Tag" << report.rfidTag;
|
||||||
qCDebug(dcKebaKeContact()) << " - RFID Class" << report.rfidClass;
|
qCDebug(dcKeba()) << " - RFID Class" << report.rfidClass;
|
||||||
qCDebug(dcKebaKeContact()) << " - Serial number" << report.serialNumber;
|
qCDebug(dcKeba()) << " - Serial number" << report.serialNumber;
|
||||||
qCDebug(dcKebaKeContact()) << " - Uptime" << report.seconds;
|
qCDebug(dcKeba()) << " - Uptime" << report.seconds;
|
||||||
|
|
||||||
if (reportNumber == 100) {
|
if (reportNumber == 100) {
|
||||||
// Report 100 is the current charging session
|
// Report 100 is the current charging session
|
||||||
@ -508,7 +509,7 @@ void IntegrationPluginKeba::onReport1XXReceived(int reportNumber, const KeContac
|
|||||||
m_lastSessionId.insert(thing->id(), report.sessionId);
|
m_lastSessionId.insert(thing->id(), report.sessionId);
|
||||||
} else {
|
} else {
|
||||||
if (m_lastSessionId.value(thing->id()) != report.sessionId) {
|
if (m_lastSessionId.value(thing->id()) != report.sessionId) {
|
||||||
qCDebug(dcKebaKeContact()) << "New session id receivd";
|
qCDebug(dcKeba()) << "New session id receivd";
|
||||||
Event event;
|
Event event;
|
||||||
event.setEventTypeId(wallboxChargingSessionFinishedEventTypeId);
|
event.setEventTypeId(wallboxChargingSessionFinishedEventTypeId);
|
||||||
event.setThingId(thing->id());
|
event.setThingId(thing->id());
|
||||||
@ -521,10 +522,10 @@ void IntegrationPluginKeba::onReport1XXReceived(int reportNumber, const KeContac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Received report but the serial number didn't match";
|
qCWarning(dcKeba()) << "Received report but the serial number didn't match";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Received unhandled report" << reportNumber;
|
qCWarning(dcKeba()) << "Received unhandled report" << reportNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +536,7 @@ void IntegrationPluginKeba::onBroadcastReceived(KeContact::BroadcastType type, c
|
|||||||
if (!thing)
|
if (!thing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Broadcast received" << type << "value" << content;
|
qCDebug(dcKeba()) << "Broadcast received" << type << "value" << content;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case KeContact::BroadcastTypePlug:
|
case KeContact::BroadcastTypePlug:
|
||||||
@ -545,7 +546,7 @@ void IntegrationPluginKeba::onBroadcastReceived(KeContact::BroadcastType type, c
|
|||||||
thing->setStateValue(wallboxInputStateTypeId, (content.toInt() == 1));
|
thing->setStateValue(wallboxInputStateTypeId, (content.toInt() == 1));
|
||||||
break;
|
break;
|
||||||
case KeContact::BroadcastTypeEPres:
|
case KeContact::BroadcastTypeEPres:
|
||||||
thing->setStateValue(wallboxSessionEnergyStateTypeId, content.toInt()/10000.00);
|
thing->setStateValue(wallboxSessionEnergyStateTypeId, content.toInt() / 10000.00);
|
||||||
break;
|
break;
|
||||||
case KeContact::BroadcastTypeState:
|
case KeContact::BroadcastTypeState:
|
||||||
setDeviceState(thing, KeContact::State(content.toInt()));
|
setDeviceState(thing, KeContact::State(content.toInt()));
|
||||||
@ -567,32 +568,31 @@ void IntegrationPluginKeba::executeAction(ThingActionInfo *info)
|
|||||||
if (thing->thingClassId() == wallboxThingClassId) {
|
if (thing->thingClassId() == wallboxThingClassId) {
|
||||||
KeContact *keba = m_kebaDevices.value(thing->id());
|
KeContact *keba = m_kebaDevices.value(thing->id());
|
||||||
if (!keba) {
|
if (!keba) {
|
||||||
qCWarning(dcKebaKeContact()) << "Device not properly initialized, Keba object missing";
|
qCWarning(dcKeba()) << "Device not properly initialized, Keba object missing";
|
||||||
return info->finish(Thing::ThingErrorHardwareNotAvailable);
|
return info->finish(Thing::ThingErrorHardwareNotAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid requestId;
|
QUuid requestId;
|
||||||
if(action.actionTypeId() == wallboxMaxChargingCurrentActionTypeId){
|
if (action.actionTypeId() == wallboxMaxChargingCurrentActionTypeId) {
|
||||||
int milliAmpere = action.param(wallboxMaxChargingCurrentActionMaxChargingCurrentParamTypeId).value().toDouble() * 1000;
|
int milliAmpere = action.param(wallboxMaxChargingCurrentActionMaxChargingCurrentParamTypeId).value().toDouble() * 1000;
|
||||||
requestId = keba->setMaxAmpere(milliAmpere);
|
requestId = keba->setMaxAmpere(milliAmpere);
|
||||||
|
} else if(action.actionTypeId() == wallboxMaxChargingCurrentGeneralActionTypeId) {
|
||||||
} else if(action.actionTypeId() == wallboxPowerActionTypeId){
|
int milliAmpere = action.param(wallboxMaxChargingCurrentGeneralActionMaxChargingCurrentGeneralParamTypeId).value().toDouble() * 1000;
|
||||||
|
requestId = keba->setMaxAmpereGeneral(milliAmpere);
|
||||||
|
} else if(action.actionTypeId() == wallboxPowerActionTypeId) {
|
||||||
requestId = keba->enableOutput(action.param(wallboxPowerActionTypeId).value().toBool());
|
requestId = keba->enableOutput(action.param(wallboxPowerActionTypeId).value().toBool());
|
||||||
|
} else if(action.actionTypeId() == wallboxDisplayActionTypeId) {
|
||||||
} else if(action.actionTypeId() == wallboxDisplayActionTypeId){
|
|
||||||
requestId = keba->displayMessage(action.param(wallboxDisplayActionMessageParamTypeId).value().toByteArray());
|
requestId = keba->displayMessage(action.param(wallboxDisplayActionMessageParamTypeId).value().toByteArray());
|
||||||
|
|
||||||
} else if(action.actionTypeId() == wallboxOutputX2ActionTypeId) {
|
} else if(action.actionTypeId() == wallboxOutputX2ActionTypeId) {
|
||||||
requestId = keba->setOutputX2(action.param(wallboxOutputX2ActionOutputX2ParamTypeId).value().toBool());
|
requestId = keba->setOutputX2(action.param(wallboxOutputX2ActionOutputX2ParamTypeId).value().toBool());
|
||||||
|
} else if(action.actionTypeId() == wallboxFailsafeModeActionTypeId) {
|
||||||
} else if(action.actionTypeId() == wallboxFailsafeModeActionTypeId){
|
|
||||||
int timeout = 0;
|
int timeout = 0;
|
||||||
if (action.param(wallboxFailsafeModeActionFailsafeModeParamTypeId).value().toBool()) {
|
if (action.param(wallboxFailsafeModeActionFailsafeModeParamTypeId).value().toBool()) {
|
||||||
timeout = 60;
|
timeout = 60;
|
||||||
}
|
}
|
||||||
requestId = keba->setFailsafe(timeout, 0, false);
|
requestId = keba->setFailsafe(timeout, 0, false);
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Unhandled ActionTypeId:" << action.actionTypeId();
|
qCWarning(dcKeba()) << "Unhandled ActionTypeId:" << action.actionTypeId();
|
||||||
return info->finish(Thing::ThingErrorActionTypeNotFound);
|
return info->finish(Thing::ThingErrorActionTypeNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,7 +605,7 @@ void IntegrationPluginKeba::executeAction(ThingActionInfo *info)
|
|||||||
m_asyncActions.insert(requestId, info);
|
m_asyncActions.insert(requestId, info);
|
||||||
connect(info, &ThingActionInfo::aborted, this, [requestId, this]{ m_asyncActions.remove(requestId); });
|
connect(info, &ThingActionInfo::aborted, this, [requestId, this]{ m_asyncActions.remove(requestId); });
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Execute action, unhandled device class" << thing->thingClass();
|
qCWarning(dcKeba()) << "Execute action, unhandled device class" << thing->thingClass();
|
||||||
info->finish(Thing::ThingErrorThingClassNotFound);
|
info->finish(Thing::ThingErrorThingClassNotFound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"displayName": "Keba KeContact",
|
"displayName": "Keba KeContact",
|
||||||
"name": "KebaKeContact",
|
"name": "Keba",
|
||||||
"id": "9142b09f-30a9-43d0-9ede-2f8debe075ac",
|
"id": "9142b09f-30a9-43d0-9ede-2f8debe075ac",
|
||||||
"vendors": [
|
"vendors": [
|
||||||
{
|
{
|
||||||
@ -148,6 +148,19 @@
|
|||||||
"maxValue": 32.0,
|
"maxValue": 32.0,
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "da0cfb97-0b27-4d8f-bdf7-45b1ca727038",
|
||||||
|
"name": "maxChargingCurrentGeneral",
|
||||||
|
"displayName": "Maximal general charging current",
|
||||||
|
"displayNameEvent": "Maximal general charging current changed",
|
||||||
|
"displayNameAction": "Set maximal general charging current",
|
||||||
|
"type": "double",
|
||||||
|
"unit": "Ampere",
|
||||||
|
"defaultValue": 6.0,
|
||||||
|
"minValue": 6.0,
|
||||||
|
"maxValue": 32.0,
|
||||||
|
"writable": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "3c7b83a0-0e42-47bf-9788-dde6aab5ceea",
|
"id": "3c7b83a0-0e42-47bf-9788-dde6aab5ceea",
|
||||||
"name": "maxChargingCurrentPercent",
|
"name": "maxChargingCurrentPercent",
|
||||||
|
|||||||
@ -38,7 +38,7 @@ KeContact::KeContact(const QHostAddress &address, KeContactDataLayer *dataLayer,
|
|||||||
m_dataLayer(dataLayer),
|
m_dataLayer(dataLayer),
|
||||||
m_address(address)
|
m_address(address)
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "Creating KeContact connection for address" << m_address;
|
qCDebug(dcKeba()) << "Creating KeContact connection for address" << m_address;
|
||||||
m_requestTimeoutTimer = new QTimer(this);
|
m_requestTimeoutTimer = new QTimer(this);
|
||||||
m_requestTimeoutTimer->setSingleShot(true);
|
m_requestTimeoutTimer->setSingleShot(true);
|
||||||
connect(m_requestTimeoutTimer, &QTimer::timeout, this, [this]() {
|
connect(m_requestTimeoutTimer, &QTimer::timeout, this, [this]() {
|
||||||
@ -47,7 +47,7 @@ KeContact::KeContact(const QHostAddress &address, KeContactDataLayer *dataLayer,
|
|||||||
|
|
||||||
if (m_currentRequest.isValid()) {
|
if (m_currentRequest.isValid()) {
|
||||||
// Schedule pause timer to send next request
|
// Schedule pause timer to send next request
|
||||||
qCWarning(dcKebaKeContact()) << "Command timeouted" << m_currentRequest.command();
|
qCWarning(dcKeba()) << "Command timeouted" << m_currentRequest.command();
|
||||||
emit commandExecuted(m_currentRequest.requestId(), false);
|
emit commandExecuted(m_currentRequest.requestId(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ KeContact::KeContact(const QHostAddress &address, KeContactDataLayer *dataLayer,
|
|||||||
|
|
||||||
KeContact::~KeContact()
|
KeContact::~KeContact()
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "Deleting KeContact connection for address" << m_address.toString();
|
qCDebug(dcKeba()) << "Deleting KeContact connection for address" << m_address.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QHostAddress KeContact::address() const
|
QHostAddress KeContact::address() const
|
||||||
@ -78,14 +78,14 @@ QHostAddress KeContact::address() const
|
|||||||
QUuid KeContact::start(const QByteArray &rfidToken, const QByteArray &rfidClassifier)
|
QUuid KeContact::start(const QByteArray &rfidToken, const QByteArray &rfidClassifier)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray datagram = "start " + rfidToken + " " + rfidClassifier;
|
QByteArray datagram = "start " + rfidToken + " " + rfidClassifier;
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Start: Datagram:" << datagram;
|
qCDebug(dcKeba()) << "Start: Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -94,14 +94,14 @@ QUuid KeContact::start(const QByteArray &rfidToken, const QByteArray &rfidClassi
|
|||||||
QUuid KeContact::stop(const QByteArray &rfidToken)
|
QUuid KeContact::stop(const QByteArray &rfidToken)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray datagram = "stop " + rfidToken;
|
QByteArray datagram = "stop " + rfidToken;
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Stop: Datagram:" << datagram;
|
qCDebug(dcKeba()) << "Stop: Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -112,7 +112,7 @@ void KeContact::setAddress(const QHostAddress &address)
|
|||||||
if (m_address == address)
|
if (m_address == address)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Updating Keba connection address from" << m_address.toString() << "to" << address.toString();
|
qCDebug(dcKeba()) << "Updating Keba connection address from" << m_address.toString() << "to" << address.toString();
|
||||||
m_address = address;
|
m_address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,12 +124,12 @@ bool KeContact::reachable() const
|
|||||||
void KeContact::sendCommand(const QByteArray &command)
|
void KeContact::sendCommand(const QByteArray &command)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "--> Writing datagram to" << m_address.toString() << command;
|
qCDebug(dcKeba()) << "--> Writing datagram to" << m_address.toString() << command;
|
||||||
m_dataLayer->write(m_address, command);
|
m_dataLayer->write(m_address, command);
|
||||||
m_requestTimeoutTimer->start(5000);
|
m_requestTimeoutTimer->start(5000);
|
||||||
}
|
}
|
||||||
@ -154,9 +154,9 @@ void KeContact::setReachable(bool reachable)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (reachable) {
|
if (reachable) {
|
||||||
qCDebug(dcKebaKeContact()) << "The keba wallbox on" << m_address.toString() << "is now reachable again.";
|
qCDebug(dcKeba()) << "The keba wallbox on" << m_address.toString() << "is now reachable again.";
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "The keba wallbox on" << m_address.toString() << "is not reachable any more.";
|
qCWarning(dcKeba()) << "The keba wallbox on" << m_address.toString() << "is not reachable any more.";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_reachable = reachable;
|
m_reachable = reachable;
|
||||||
@ -166,7 +166,7 @@ void KeContact::setReachable(bool reachable)
|
|||||||
QUuid KeContact::enableOutput(bool state)
|
QUuid KeContact::enableOutput(bool state)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ QUuid KeContact::enableOutput(bool state)
|
|||||||
|
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
request.setDelayUntilNextCommand(2000);
|
request.setDelayUntilNextCommand(2000);
|
||||||
qCDebug(dcKebaKeContact()) << "Enable output: Datagram:" << datagram;
|
qCDebug(dcKeba()) << "Enable output: Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -190,22 +190,48 @@ QUuid KeContact::enableOutput(bool state)
|
|||||||
QUuid KeContact::setMaxAmpere(int milliAmpere)
|
QUuid KeContact::setMaxAmpere(int milliAmpere)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (milliAmpere < 6000 || milliAmpere > 63000) {
|
if (milliAmpere < 6000 || milliAmpere > 63000) {
|
||||||
qCWarning(dcKebaKeContact()) << "KeContact: Set max ampere, mA out of range [6000, 63000]" << milliAmpere;
|
qCWarning(dcKeba()) << "KeContact: Set max ampere, currtime mA out of range [6000, 63000]" << milliAmpere;
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print information that we are executing now the update action
|
// Print information that we are executing now the update action
|
||||||
qCDebug(dcKebaKeContact()) << "Update max current to : " << milliAmpere;
|
qCDebug(dcKeba()) << "Update max current to : " << milliAmpere;
|
||||||
QString commandLine = QString("currtime %1 0").arg(milliAmpere);
|
QString commandLine = QString("currtime %1 1").arg(milliAmpere);
|
||||||
QByteArray datagram = commandLine.toUtf8();
|
QByteArray datagram = commandLine.toUtf8();
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Set max charging amps: Datagram:" << datagram;
|
request.setDelayUntilNextCommand(1200);
|
||||||
|
qCDebug(dcKeba()) << "Set max charging amps: Datagram:" << datagram;
|
||||||
|
m_requestQueue.enqueue(request);
|
||||||
|
sendNextCommand();
|
||||||
|
return request.requestId();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUuid KeContact::setMaxAmpereGeneral(int milliAmpere)
|
||||||
|
{
|
||||||
|
if (!m_dataLayer) {
|
||||||
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
|
setReachable(false);
|
||||||
|
return QUuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (milliAmpere < 6000 || milliAmpere > 63000) {
|
||||||
|
qCWarning(dcKeba()) << "KeContact: Set max ampere curr, mA out of range [6000, 63000]" << milliAmpere;
|
||||||
|
return QUuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print information that we are executing now the update action
|
||||||
|
qCDebug(dcKeba()) << "Update general max current to: " << milliAmpere;
|
||||||
|
QString commandLine = QString("curr %1").arg(milliAmpere);
|
||||||
|
QByteArray datagram = commandLine.toUtf8();
|
||||||
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
|
request.setDelayUntilNextCommand(1200);
|
||||||
|
qCDebug(dcKeba()) << "Set max general charging amps: Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -214,7 +240,7 @@ QUuid KeContact::setMaxAmpere(int milliAmpere)
|
|||||||
QUuid KeContact::displayMessage(const QByteArray &message)
|
QUuid KeContact::displayMessage(const QByteArray &message)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
@ -225,7 +251,7 @@ QUuid KeContact::displayMessage(const QByteArray &message)
|
|||||||
, == comma
|
, == comma
|
||||||
*/
|
*/
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Set display message: " << message;
|
qCDebug(dcKeba()) << "Set display message: " << message;
|
||||||
QByteArray datagram;
|
QByteArray datagram;
|
||||||
QByteArray modifiedMessage = message;
|
QByteArray modifiedMessage = message;
|
||||||
modifiedMessage.replace(" ", "$");
|
modifiedMessage.replace(" ", "$");
|
||||||
@ -234,7 +260,7 @@ QUuid KeContact::displayMessage(const QByteArray &message)
|
|||||||
}
|
}
|
||||||
datagram.append("display 0 0 0 0 " + modifiedMessage);
|
datagram.append("display 0 0 0 0 " + modifiedMessage);
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Display message: Datagram:" << datagram;
|
qCDebug(dcKeba()) << "Display message: Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -243,7 +269,7 @@ QUuid KeContact::displayMessage(const QByteArray &message)
|
|||||||
QUuid KeContact::chargeWithEnergyLimit(double energy)
|
QUuid KeContact::chargeWithEnergyLimit(double energy)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
@ -251,7 +277,7 @@ QUuid KeContact::chargeWithEnergyLimit(double energy)
|
|||||||
QByteArray datagram;
|
QByteArray datagram;
|
||||||
datagram.append("setenergy " + QVariant(static_cast<int>(energy*10000)).toByteArray());
|
datagram.append("setenergy " + QVariant(static_cast<int>(energy*10000)).toByteArray());
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Charge with energy limit: Datagram: " << datagram;
|
qCDebug(dcKeba()) << "Charge with energy limit: Datagram: " << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -260,7 +286,7 @@ QUuid KeContact::chargeWithEnergyLimit(double energy)
|
|||||||
QUuid KeContact::setFailsafe(int timeout, int current, bool save)
|
QUuid KeContact::setFailsafe(int timeout, int current, bool save)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
@ -271,7 +297,7 @@ QUuid KeContact::setFailsafe(int timeout, int current, bool save)
|
|||||||
data.append(" "+QVariant(current).toByteArray());
|
data.append(" "+QVariant(current).toByteArray());
|
||||||
data.append((save ? " 1":" 0"));
|
data.append((save ? " 1":" 0"));
|
||||||
KeContactRequest request(QUuid::createUuid(), data);
|
KeContactRequest request(QUuid::createUuid(), data);
|
||||||
qCDebug(dcKebaKeContact()) << "Set failsafe mode: Datagram: " << data;
|
qCDebug(dcKeba()) << "Set failsafe mode: Datagram: " << data;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -282,7 +308,7 @@ void KeContact::getDeviceInformation()
|
|||||||
QByteArray data;
|
QByteArray data;
|
||||||
data.append("i");
|
data.append("i");
|
||||||
KeContactRequest request(QUuid::createUuid(), data);
|
KeContactRequest request(QUuid::createUuid(), data);
|
||||||
qCDebug(dcKebaKeContact()) << "Get device information: Datagram: " << data;
|
qCDebug(dcKeba()) << "Get device information: Datagram: " << data;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
}
|
}
|
||||||
@ -310,7 +336,7 @@ void KeContact::getReport1XX(int reportNumber)
|
|||||||
QUuid KeContact::setOutputX2(bool state)
|
QUuid KeContact::setOutputX2(bool state)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
@ -320,7 +346,7 @@ QUuid KeContact::setOutputX2(bool state)
|
|||||||
datagram.append("output " + QVariant((state ? 1 : 0)).toByteArray());
|
datagram.append("output " + QVariant((state ? 1 : 0)).toByteArray());
|
||||||
|
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Set Output X2, state:" << state << "Datagram:" << datagram;
|
qCDebug(dcKeba()) << "Set Output X2, state:" << state << "Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -329,7 +355,7 @@ QUuid KeContact::setOutputX2(bool state)
|
|||||||
void KeContact::getReport(int reportNumber)
|
void KeContact::getReport(int reportNumber)
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -338,7 +364,7 @@ void KeContact::getReport(int reportNumber)
|
|||||||
datagram.append("report " + QVariant(reportNumber).toByteArray());
|
datagram.append("report " + QVariant(reportNumber).toByteArray());
|
||||||
|
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Get report" << reportNumber << "Datagram:" << datagram;
|
qCDebug(dcKeba()) << "Get report" << reportNumber << "Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
}
|
}
|
||||||
@ -346,7 +372,7 @@ void KeContact::getReport(int reportNumber)
|
|||||||
QUuid KeContact::unlockCharger()
|
QUuid KeContact::unlockCharger()
|
||||||
{
|
{
|
||||||
if (!m_dataLayer) {
|
if (!m_dataLayer) {
|
||||||
qCWarning(dcKebaKeContact()) << "UDP socket not initialized";
|
qCWarning(dcKeba()) << "UDP socket not initialized";
|
||||||
setReachable(false);
|
setReachable(false);
|
||||||
return QUuid();
|
return QUuid();
|
||||||
}
|
}
|
||||||
@ -355,7 +381,7 @@ QUuid KeContact::unlockCharger()
|
|||||||
datagram.append("unlock");
|
datagram.append("unlock");
|
||||||
|
|
||||||
KeContactRequest request(QUuid::createUuid(), datagram);
|
KeContactRequest request(QUuid::createUuid(), datagram);
|
||||||
qCDebug(dcKebaKeContact()) << "Unlock charger: Datagram:" << datagram;
|
qCDebug(dcKeba()) << "Unlock charger: Datagram:" << datagram;
|
||||||
m_requestQueue.enqueue(request);
|
m_requestQueue.enqueue(request);
|
||||||
sendNextCommand();
|
sendNextCommand();
|
||||||
return request.requestId();
|
return request.requestId();
|
||||||
@ -368,6 +394,8 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCDebug(dcKeba()) << "<--" << qUtf8Printable(datagram);
|
||||||
|
|
||||||
if (datagram.contains("TCH-OK")){
|
if (datagram.contains("TCH-OK")){
|
||||||
// We received valid data from the address over the data link, so the wallbox must be reachable
|
// We received valid data from the address over the data link, so the wallbox must be reachable
|
||||||
setReachable(true);
|
setReachable(true);
|
||||||
@ -377,10 +405,10 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
|
|
||||||
if (m_currentRequest.isValid()) {
|
if (m_currentRequest.isValid()) {
|
||||||
if (datagram.contains("done")) {
|
if (datagram.contains("done")) {
|
||||||
qCDebug(dcKebaKeContact()) << "Command" << m_currentRequest.command() << "finished successfully";
|
qCDebug(dcKeba()) << "Command" << m_currentRequest.command() << "finished successfully";
|
||||||
emit commandExecuted(m_currentRequest.requestId(), true);
|
emit commandExecuted(m_currentRequest.requestId(), true);
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcKebaKeContact()) << "Command" << m_currentRequest.command() << "finished with error" << datagram;
|
qCWarning(dcKeba()) << "Command" << m_currentRequest.command() << "finished with error" << datagram;
|
||||||
emit commandExecuted(m_currentRequest.requestId(), false);
|
emit commandExecuted(m_currentRequest.requestId(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +417,7 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
m_currentRequest = KeContactRequest();
|
m_currentRequest = KeContactRequest();
|
||||||
} else {
|
} else {
|
||||||
//Probably the response has taken too long and the requestId has been already removed
|
//Probably the response has taken too long and the requestId has been already removed
|
||||||
qCWarning(dcKebaKeContact()) << "Received command OK response without pending request." << datagram;
|
qCWarning(dcKeba()) << "Received command OK response without pending request." << datagram;
|
||||||
}
|
}
|
||||||
} else if (datagram.left(8).contains("Firmware")){
|
} else if (datagram.left(8).contains("Firmware")){
|
||||||
// We received valid data from the address over the data link, so the wallbox must be reachable
|
// We received valid data from the address over the data link, so the wallbox must be reachable
|
||||||
@ -403,7 +431,7 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
m_currentRequest = KeContactRequest();
|
m_currentRequest = KeContactRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(dcKebaKeContact()) << "Firmware information received";
|
qCDebug(dcKeba()) << "Firmware information received";
|
||||||
QByteArrayList firmware = datagram.split(':');
|
QByteArrayList firmware = datagram.split(':');
|
||||||
if (firmware.length() >= 2) {
|
if (firmware.length() >= 2) {
|
||||||
emit deviceInformationReceived(firmware[1]);
|
emit deviceInformationReceived(firmware[1]);
|
||||||
@ -421,7 +449,7 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument jsonDoc = QJsonDocument::fromJson(datagram, &error);
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(datagram, &error);
|
||||||
if (error.error != QJsonParseError::NoError) {
|
if (error.error != QJsonParseError::NoError) {
|
||||||
qCWarning(dcKebaKeContact()) << "Failed to parse JSON data" << datagram << ":" << error.errorString();
|
qCWarning(dcKeba()) << "Failed to parse JSON data" << datagram << ":" << error.errorString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,7 +462,7 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
setReachable(true);
|
setReachable(true);
|
||||||
|
|
||||||
ReportOne reportOne;
|
ReportOne reportOne;
|
||||||
qCDebug(dcKebaKeContact()) << "Report 1 received";
|
qCDebug(dcKeba()) << "Report 1 received";
|
||||||
reportOne.product = data.value("Product").toString();
|
reportOne.product = data.value("Product").toString();
|
||||||
reportOne.firmware = data.value("Firmware").toString();
|
reportOne.firmware = data.value("Firmware").toString();
|
||||||
reportOne.serialNumber = data.value("Serial").toString();
|
reportOne.serialNumber = data.value("Serial").toString();
|
||||||
@ -459,7 +487,7 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
setReachable(true);
|
setReachable(true);
|
||||||
|
|
||||||
ReportTwo reportTwo;
|
ReportTwo reportTwo;
|
||||||
qCDebug(dcKebaKeContact()) << "Report 2 received";
|
qCDebug(dcKeba()) << "Report 2 received";
|
||||||
int state = data.value("State").toInt();
|
int state = data.value("State").toInt();
|
||||||
reportTwo.state = State(state);
|
reportTwo.state = State(state);
|
||||||
reportTwo.error1 = data.value("Error1").toInt();
|
reportTwo.error1 = data.value("Error1").toInt();
|
||||||
@ -471,6 +499,8 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
reportTwo.maxCurrentPercentage = data.value("Max curr %").toInt() / 10.00;
|
reportTwo.maxCurrentPercentage = data.value("Max curr %").toInt() / 10.00;
|
||||||
reportTwo.currentHardwareLimitation = data.value("Curr HW").toInt() / 1000.00;
|
reportTwo.currentHardwareLimitation = data.value("Curr HW").toInt() / 1000.00;
|
||||||
reportTwo.currentUser = data.value("Curr user").toInt() / 1000.00;
|
reportTwo.currentUser = data.value("Curr user").toInt() / 1000.00;
|
||||||
|
reportTwo.currTimer = data.value("Curr timer").toInt() / 1000.00;
|
||||||
|
reportTwo.timeoutCt = data.value("Tmo CT").toInt();
|
||||||
reportTwo.currentFailsafe = data.value("Curr FS").toInt() / 1000.00;
|
reportTwo.currentFailsafe = data.value("Curr FS").toInt() / 1000.00;
|
||||||
reportTwo.timeoutFailsafe = data.value("Tmo FS").toInt();
|
reportTwo.timeoutFailsafe = data.value("Tmo FS").toInt();
|
||||||
reportTwo.setEnergy = data.value("Setenergy").toInt() / 10000.00;
|
reportTwo.setEnergy = data.value("Setenergy").toInt() / 10000.00;
|
||||||
@ -488,7 +518,7 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
setReachable(true);
|
setReachable(true);
|
||||||
|
|
||||||
ReportThree reportThree;
|
ReportThree reportThree;
|
||||||
qCDebug(dcKebaKeContact()) << "Report 3 received";
|
qCDebug(dcKeba()) << "Report 3 received";
|
||||||
reportThree.currentPhase1 = data.value("I1").toInt()/1000.00;
|
reportThree.currentPhase1 = data.value("I1").toInt()/1000.00;
|
||||||
reportThree.currentPhase2 = data.value("I2").toInt()/1000.00;
|
reportThree.currentPhase2 = data.value("I2").toInt()/1000.00;
|
||||||
reportThree.currentPhase3 = data.value("I3").toInt()/1000.00;
|
reportThree.currentPhase3 = data.value("I3").toInt()/1000.00;
|
||||||
@ -507,7 +537,7 @@ void KeContact::onReceivedDatagram(const QHostAddress &address, const QByteArray
|
|||||||
setReachable(true);
|
setReachable(true);
|
||||||
|
|
||||||
Report1XX report;
|
Report1XX report;
|
||||||
qCDebug(dcKebaKeContact()) << "Report" << id << "received";
|
qCDebug(dcKeba()) << "Report" << id << "received";
|
||||||
report.sessionId = data.value("Session ID").toInt();
|
report.sessionId = data.value("Session ID").toInt();
|
||||||
report.currHW = data.value("Curr HW").toInt();
|
report.currHW = data.value("Curr HW").toInt();
|
||||||
report.startTime = data.value("E Start ").toInt()/10000.00;
|
report.startTime = data.value("E Start ").toInt()/10000.00;
|
||||||
|
|||||||
@ -168,6 +168,7 @@ public:
|
|||||||
|
|
||||||
QUuid enableOutput(bool state); // Command “ena”
|
QUuid enableOutput(bool state); // Command “ena”
|
||||||
QUuid setMaxAmpere(int milliAmpere); // Command "currtime"
|
QUuid setMaxAmpere(int milliAmpere); // Command "currtime"
|
||||||
|
QUuid setMaxAmpereGeneral(int milliAmpere); // Command "curr"
|
||||||
QUuid unlockCharger(); // Command “unlock"
|
QUuid unlockCharger(); // Command “unlock"
|
||||||
QUuid displayMessage(const QByteArray &message); // Command “display”
|
QUuid displayMessage(const QByteArray &message); // Command “display”
|
||||||
QUuid chargeWithEnergyLimit(double energy); // Command “setenergy”
|
QUuid chargeWithEnergyLimit(double energy); // Command “setenergy”
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
KeContactDataLayer::KeContactDataLayer(QObject *parent) : QObject(parent)
|
KeContactDataLayer::KeContactDataLayer(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "KeContactDataLayer: Creating UDP socket";
|
qCDebug(dcKeba()) << "KeContactDataLayer: Creating UDP socket";
|
||||||
m_udpSocket = new QUdpSocket(this);
|
m_udpSocket = new QUdpSocket(this);
|
||||||
connect(m_udpSocket, &QUdpSocket::readyRead, this, &KeContactDataLayer::readPendingDatagrams);
|
connect(m_udpSocket, &QUdpSocket::readyRead, this, &KeContactDataLayer::readPendingDatagrams);
|
||||||
connect(m_udpSocket, &QUdpSocket::stateChanged, this, &KeContactDataLayer::onSocketStateChanged);
|
connect(m_udpSocket, &QUdpSocket::stateChanged, this, &KeContactDataLayer::onSocketStateChanged);
|
||||||
@ -42,7 +42,7 @@ KeContactDataLayer::KeContactDataLayer(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
KeContactDataLayer::~KeContactDataLayer()
|
KeContactDataLayer::~KeContactDataLayer()
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "KeContactDataLayer: Deleting UDP socket";
|
qCDebug(dcKeba()) << "KeContactDataLayer: Deleting UDP socket";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeContactDataLayer::init()
|
bool KeContactDataLayer::init()
|
||||||
@ -51,7 +51,7 @@ bool KeContactDataLayer::init()
|
|||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
|
|
||||||
if (!m_udpSocket->bind(QHostAddress::AnyIPv4, m_port, QAbstractSocket::ShareAddress)) {
|
if (!m_udpSocket->bind(QHostAddress::AnyIPv4, m_port, QAbstractSocket::ShareAddress)) {
|
||||||
qCWarning(dcKebaKeContact()) << "KeContactDataLayer: Cannot bind to port" << m_port;
|
qCWarning(dcKeba()) << "KeContactDataLayer: Cannot bind to port" << m_port;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,17 +80,17 @@ void KeContactDataLayer::readPendingDatagrams()
|
|||||||
while (socket->hasPendingDatagrams()) {
|
while (socket->hasPendingDatagrams()) {
|
||||||
datagram.resize(socket->pendingDatagramSize());
|
datagram.resize(socket->pendingDatagramSize());
|
||||||
socket->readDatagram(datagram.data(), datagram.size(), &senderAddress, &senderPort);
|
socket->readDatagram(datagram.data(), datagram.size(), &senderAddress, &senderPort);
|
||||||
qCDebug(dcKebaKeContact()) << "KeContactDataLayer: Data received from" << senderAddress.toString() << datagram ;
|
qCDebug(dcKeba()) << "KeContactDataLayer: Data received from" << senderAddress.toString() << datagram ;
|
||||||
emit datagramReceived(senderAddress, datagram);
|
emit datagramReceived(senderAddress, datagram);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeContactDataLayer::onSocketError(QAbstractSocket::SocketError error)
|
void KeContactDataLayer::onSocketError(QAbstractSocket::SocketError error)
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "KeContactDataLayer: Socket error" << error;
|
qCDebug(dcKeba()) << "KeContactDataLayer: Socket error" << error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeContactDataLayer::onSocketStateChanged(QAbstractSocket::SocketState socketState)
|
void KeContactDataLayer::onSocketStateChanged(QAbstractSocket::SocketState socketState)
|
||||||
{
|
{
|
||||||
qCDebug(dcKebaKeContact()) << "KeContactDataLayer: Socket state changed" << socketState;
|
qCDebug(dcKeba()) << "KeContactDataLayer: Socket state changed" << socketState;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>KebaKeContact</name>
|
<name>Keba</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="137"/>
|
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="137"/>
|
||||||
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="140"/>
|
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="140"/>
|
||||||
@ -266,7 +266,7 @@ The name of the StateType ({ba600276-8b36-4404-b8ec-415245e5bc15}) of ThingClass
|
|||||||
<source>Keba KeContact</source>
|
<source>Keba KeContact</source>
|
||||||
<extracomment>The name of the ThingClass ({900dacec-cae7-4a37-95ba-501846368ea2})
|
<extracomment>The name of the ThingClass ({900dacec-cae7-4a37-95ba-501846368ea2})
|
||||||
----------
|
----------
|
||||||
The name of the plugin KebaKeContact ({9142b09f-30a9-43d0-9ede-2f8debe075ac})</extracomment>
|
The name of the plugin Keba ({9142b09f-30a9-43d0-9ede-2f8debe075ac})</extracomment>
|
||||||
<translation>Keba KeContact</translation>
|
<translation>Keba KeContact</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>KebaKeContact</name>
|
<name>Keba</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="137"/>
|
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="137"/>
|
||||||
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="140"/>
|
<location filename="../../../build-nymea-plugins-Desktop-Debug/keba/plugininfo.h" line="140"/>
|
||||||
@ -266,7 +266,7 @@ The name of the StateType ({ba600276-8b36-4404-b8ec-415245e5bc15}) of ThingClass
|
|||||||
<source>Keba KeContact</source>
|
<source>Keba KeContact</source>
|
||||||
<extracomment>The name of the ThingClass ({900dacec-cae7-4a37-95ba-501846368ea2})
|
<extracomment>The name of the ThingClass ({900dacec-cae7-4a37-95ba-501846368ea2})
|
||||||
----------
|
----------
|
||||||
The name of the plugin KebaKeContact ({9142b09f-30a9-43d0-9ede-2f8debe075ac})</extracomment>
|
The name of the plugin Keba ({9142b09f-30a9-43d0-9ede-2f8debe075ac})</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user