Fix max settings if no cable connected and improve discovery result texts

master
Simon Stürz 2021-12-03 12:50:48 +01:00
parent ee30d86f94
commit 7c4a21c006
2 changed files with 11 additions and 7 deletions

View File

@ -60,7 +60,7 @@ void IntegrationPluginGoECharger::discoverThings(ThingDiscoveryInfo *info)
qCDebug(dcGoECharger()) << "Checking discovered" << networkDeviceInfo;
// Filter by hostname
if (!networkDeviceInfo.hostName().contains("go-eCharger"))
if (!networkDeviceInfo.hostName().toLower().contains("go-echarger"))
continue;
// We need also the mac address
@ -71,14 +71,14 @@ void IntegrationPluginGoECharger::discoverThings(ThingDiscoveryInfo *info)
if (networkDeviceInfo.hostName().isEmpty()) {
title = networkDeviceInfo.address().toString();
} else {
title = "go-eCharger (" + networkDeviceInfo.address().toString() + ")";
title = "go-eCharger";
}
QString description;
if (networkDeviceInfo.macAddressManufacturer().isEmpty()) {
description = networkDeviceInfo.macAddress();
description = networkDeviceInfo.address().toString();
} else {
description = networkDeviceInfo.macAddress() + " (" + networkDeviceInfo.macAddressManufacturer() + ")";
description = networkDeviceInfo.address().toString() + " (" + networkDeviceInfo.macAddressManufacturer() + ")";
}
ThingDescriptor descriptor(goeHomeThingClassId, title, description);
@ -368,7 +368,11 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
thing->setStateValue(goeHomeCableType2AmpereStateTypeId, cableLimit);
// Set the limit for the max charging amps
thing->setStateMaxValue(goeHomeMaxChargingCurrentStateTypeId, qMin(amaLimit, cableLimit));
if (cableLimit != 0) {
thing->setStateMaxValue(goeHomeMaxChargingCurrentStateTypeId, qMin(amaLimit, cableLimit));
} else {
thing->setStateMaxValue(goeHomeMaxChargingCurrentStateTypeId, amaLimit);
}
// Parse nrg array
uint voltagePhaseA = 0; uint voltagePhaseB = 0; uint voltagePhaseC = 0;

View File

@ -122,8 +122,8 @@
"type": "uint",
"unit": "Ampere",
"minValue": 6,
"maxValue": 20,
"defaultValue": 0.00,
"maxValue": 32,
"defaultValue": 0,
"writable": true
},
{