GenericCar: Add max charging current for generic car

This commit is contained in:
Simon Stürz 2025-12-22 10:54:23 +01:00
parent 265cfb5339
commit b8b81ac2bb
3 changed files with 28 additions and 23 deletions

View File

@ -25,13 +25,7 @@
#include "integrationplugingenericcar.h" #include "integrationplugingenericcar.h"
#include "plugininfo.h" #include "plugininfo.h"
#include <QDebug> IntegrationPluginGenericCar::IntegrationPluginGenericCar() {}
#include <QtMath>
IntegrationPluginGenericCar::IntegrationPluginGenericCar()
{
}
void IntegrationPluginGenericCar::setupThing(ThingSetupInfo *info) void IntegrationPluginGenericCar::setupThing(ThingSetupInfo *info)
{ {
@ -44,6 +38,9 @@ void IntegrationPluginGenericCar::setupThing(ThingSetupInfo *info)
} else if (paramTypeId == carSettingsMinChargingCurrentParamTypeId) { } else if (paramTypeId == carSettingsMinChargingCurrentParamTypeId) {
qCDebug(dcGenericCar()) << "Car minimum charging current settings changed" << value.toUInt() << "A"; qCDebug(dcGenericCar()) << "Car minimum charging current settings changed" << value.toUInt() << "A";
thing->setStateValue(carMinChargingCurrentStateTypeId, value); thing->setStateValue(carMinChargingCurrentStateTypeId, value);
} else if (paramTypeId == carSettingsMaxChargingCurrentParamTypeId) {
qCDebug(dcGenericCar()) << "Car maximum charging current settings changed" << value.toUInt() << "A";
thing->setStateValue(carMaxChargingCurrentStateTypeId, value);
} else if (paramTypeId == carSettingsPhaseCountParamTypeId) { } else if (paramTypeId == carSettingsPhaseCountParamTypeId) {
thing->setStateValue(carPhaseCountStateTypeId, value); thing->setStateValue(carPhaseCountStateTypeId, value);
} }

View File

@ -25,11 +25,9 @@
#ifndef INTEGRATIONPLUGINGENERICCAR_H #ifndef INTEGRATIONPLUGINGENERICCAR_H
#define INTEGRATIONPLUGINGENERICCAR_H #define INTEGRATIONPLUGINGENERICCAR_H
#include "integrations/integrationplugin.h" #include <integrations/integrationplugin.h>
#include "plugintimer.h"
#include "extern-plugininfo.h"
#include <QTimer> #include "extern-plugininfo.h"
class IntegrationPluginGenericCar : public IntegrationPlugin class IntegrationPluginGenericCar : public IntegrationPlugin
{ {
@ -42,11 +40,6 @@ public:
explicit IntegrationPluginGenericCar(); explicit IntegrationPluginGenericCar();
void setupThing(ThingSetupInfo *info) override; void setupThing(ThingSetupInfo *info) override;
void executeAction(ThingActionInfo *info) override; void executeAction(ThingActionInfo *info) override;
private:
QHash<Thing *, int> m_pulsesPerTimeframe;
QHash<Thing *, QTimer *> m_smartMeterTimer;
}; };
#endif // INTEGRATIONPLUGINGENERICCAR_H #endif // INTEGRATIONPLUGINGENERICCAR_H

View File

@ -25,6 +25,16 @@
"maxValue": 16, "maxValue": 16,
"defaultValue": 6 "defaultValue": 6
}, },
{
"id": "69ae5ffa-b31b-4295-a2a8-61bd7b2fc5da",
"name": "maxChargingCurrent",
"displayName": "Maximal charging current",
"type": "uint",
"unit": "Ampere",
"minValue": 16,
"maxValue": 80,
"defaultValue": 80
},
{ {
"id": "57f36386-dd71-4ab0-8d2f-8c74a391f90d", "id": "57f36386-dd71-4ab0-8d2f-8c74a391f90d",
"name": "capacity", "name": "capacity",
@ -60,7 +70,6 @@
"id": "363a2a39-61b6-4109-9cd9-aca7367d12c7", "id": "363a2a39-61b6-4109-9cd9-aca7367d12c7",
"name": "capacity", "name": "capacity",
"displayName": "Capacity", "displayName": "Capacity",
"displayNameEvent": "Capacity changed",
"type": "double", "type": "double",
"unit": "KiloWattHour", "unit": "KiloWattHour",
"defaultValue": 50 "defaultValue": 50
@ -69,7 +78,6 @@
"id": "d33982d6-6467-4281-b448-68c1b1db088d", "id": "d33982d6-6467-4281-b448-68c1b1db088d",
"name": "batteryCritical", "name": "batteryCritical",
"displayName": "Battery level critical", "displayName": "Battery level critical",
"displayNameEvent": "Battery entered or left critical state",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
}, },
@ -77,7 +85,6 @@
"id": "3f1cca10-8988-4ec6-b937-0775653cde12", "id": "3f1cca10-8988-4ec6-b937-0775653cde12",
"name": "batteryLevel", "name": "batteryLevel",
"displayName": "Battery level", "displayName": "Battery level",
"displayNameEvent": "Battery level changed",
"displayNameAction": "Set battery level", "displayNameAction": "Set battery level",
"type": "int", "type": "int",
"unit": "Percentage", "unit": "Percentage",
@ -90,18 +97,26 @@
"id": "20faf2b8-2b40-4bee-b228-97dbaf0cdffc", "id": "20faf2b8-2b40-4bee-b228-97dbaf0cdffc",
"name": "minChargingCurrent", "name": "minChargingCurrent",
"displayName": "Minimum charging current", "displayName": "Minimum charging current",
"displayNameEvent": "Minimum charging current changed",
"type": "uint", "type": "uint",
"unit": "Ampere", "unit": "Ampere",
"minValue": 6, "minValue": 6,
"maxValue": 16, "maxValue": 16,
"defaultValue": 6 "defaultValue": 6
}, },
{
"id": "ad17e812-ba07-47a8-99a4-eefb8b54fc85",
"name": "maxChargingCurrent",
"displayName": "Maximum charging current",
"type": "uint",
"unit": "Ampere",
"minValue": 16,
"maxValue": 80,
"defaultValue": 80
},
{ {
"id": "c886c062-bf1a-46c5-8e54-aed804a22d57", "id": "c886c062-bf1a-46c5-8e54-aed804a22d57",
"name": "phaseCount", "name": "phaseCount",
"displayName": "Phase count", "displayName": "Phase count",
"displayNameEvent": "Phase count changed",
"type": "uint", "type": "uint",
"minValue": 1, "minValue": 1,
"maxValue": 3, "maxValue": 3,