Skip to content

Commit 08e40f7

Browse files
committed
new behaviour for non pv mode
1 parent 9d3d065 commit 08e40f7

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ Additionally there are some states to influence behaviour of photovoltaics autom
104104
* kecontact.n.automatic.limitCurrent - limits your charging to specified amperage in mA (0 = no limitation)
105105
* kecontact.n.automatic.batteryStorageStrategy - strategy whether and how your battery storage should be using for charging your vehicle
106106
* kecontact.n.automatic.batterySoCForCharging - limit usage of battery torage for vehicle by specifying a SoC below which charging is prohibited
107-
* kecontact.n.automatic.stateVehicleSoC - state name to obtain current SoC of vehicle
107+
* kecontact.n.automatic.stateVehicleSoC - state name to obtain current SoC of vehicle (needed for targetsoc and maxSoc)
108108
* kecontact.n.automatic.targetSoC - disable PV automatic (charge with max power) unless vehicle reaches this SoC
109109
* kecontact.n.automatic.resetTargetSoC - set to true, if taget SoC should be cleared after reached
110+
* kecontact.n.automatic.maxSoC - a maximum SoC, vehicle won't be charged if this SoC is reached
110111

111112
Sample:
112113
To charge your vehicle with a constant amperage of 6A regardless of surplus, set photovoltaics to false and limitCurrent to 6000.
@@ -120,6 +121,7 @@ To charge your vehicle with a constant amperage of 6A regardless of surplus, set
120121
### **WORK IN PROGRESS**
121122
* (Sneak-L8) new options to charge vehicle up to a specified SoC
122123
* (Sneak-L8) new option to stop charging at a certain SoC
124+
* (Sneak-L8) new behaviour in non pv mode: you can stop charging and adapter won't start by itself (like in passive mode but with active max power limitation)
123125
* (Sneak-L8) raise adapter-dev version from 1.4 to 1.5
124126
* (Sneak-L8) drop dependencies to chai, sinon and mocha
125127

main.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Kecontact extends utils.Adapter {
5252
wallboxWarningSent = false; // Warning for inacurate regulation with Deutshcland Edition
5353
wallboxUnknownSent = false; // Warning wallbox not recognized
5454
isPassive = true; // no automatic power regulation?
55+
isSwitchedToNonPv = false;
5556
// eslint-disable-next-line jsdoc/check-tag-names
5657
/** @type {Date | null} */
5758
lastDeviceData = null; // time of last check for device information
@@ -466,6 +467,9 @@ class Kecontact extends utils.Adapter {
466467
if (oldValue != newValue) {
467468
this.log.info(`change of photovoltaics automatic from ${oldValue} to ${newValue}`);
468469
newValue = this.getBoolean(newValue);
470+
if (newValue === false) {
471+
this.isSwitchedToNonPv = true;
472+
}
469473
this.displayChargeMode();
470474
this.forceUpdateOfCalculation();
471475
}
@@ -2358,13 +2362,16 @@ class Kecontact extends utils.Adapter {
23582362
}
23592363
}
23602364
} else {
2361-
curr = tempMax; // no automatic active or vehicle not plugged to wallbox? Charging with maximum power possible
2362-
this.log.debug(`new current due to vehicle not plugged or pv automatics not active is ${curr}`);
2363-
this.isMaxPowerCalculation = true;
2364-
if (this.isVehiclePlugged()) {
2365-
newValueFor1p3pSwitching = this.valueFor3pCharging;
2366-
} else {
2367-
newValueFor1p3pSwitching = this.valueFor1p3pOff;
2365+
// in non pv mode charge with maximum power only if charging is actibated
2366+
if (this.isSwitchedToNonPv === true || this.getStateDefaultFalse(this.stateWallboxEnabled)) {
2367+
curr = tempMax; // no automatic active or vehicle not plugged to wallbox? Charging with maximum power possible
2368+
this.log.debug(`new current due to vehicle not plugged or pv automatics not active is ${curr}`);
2369+
this.isMaxPowerCalculation = true;
2370+
if (this.isVehiclePlugged()) {
2371+
newValueFor1p3pSwitching = this.valueFor3pCharging;
2372+
} else {
2373+
newValueFor1p3pSwitching = this.valueFor1p3pOff;
2374+
}
23682375
}
23692376
}
23702377
}
@@ -2431,6 +2438,7 @@ class Kecontact extends utils.Adapter {
24312438
}
24322439
this.log.debug(`wallbox set to charging maximum of ${curr} mA`);
24332440
this.regulateWallbox(curr);
2441+
this.isSwitchedToNonPv = false;
24342442
this.chargingToBeStarted = true;
24352443
}
24362444
}

0 commit comments

Comments
 (0)