Show plan active status only in active timeslots (#10332)

This commit is contained in:
Michael Geers 2023-10-15 16:14:35 +02:00 • committed by GitHub
parent 133afabb95
commit 40a391da69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 7 deletions

View file

@ -41,14 +41,23 @@ describe("min charge", () => {
});
});
describe("target charge", () => {
describe("plan", () => {
const targetTime = "2020-03-16T06:00:00Z";
const planProjectedStart = "2020-03-16T02:00:00Z";
test("active if target time is set and status is charging", () => {
expectStatus({ targetTime, charging: true, connected: true }, "targetChargeActive");
test("charging if target time is set, status is charging but planned slot is not active", () => {
expectStatus({ targetTime, charging: true, connected: true }, "charging");
});
test("active if target time is set, status is charging and planned slot is active", () => {
expectStatus(
{ targetTime, planActive: true, charging: true, connected: true },
"targetChargeActive"
);
});
test("waiting for vehicle if a target time is set, the charger is enabled but not charging", () => {
expectStatus({ targetTime, enabled: true, connected: true }, "targetChargeWaitForVehicle");
expectStatus(
{ targetTime, planActive: true, enabled: true, connected: true },
"targetChargeWaitForVehicle"
);
});
test("show projected start if not enabled yet", () => {
expectStatus({ targetTime, planProjectedStart, connected: true }, "targetChargePlanned", {

View file

@ -18,6 +18,7 @@ export default {
charging: Boolean,
targetTime: String,
planProjectedStart: String,
planActive: Boolean,
phaseAction: String,
phaseRemainingInterpolated: Number,
pvAction: String,
@ -61,12 +62,12 @@ export default {
return t("minCharge", { soc: this.minSoc });
}
// target charge
// plan
if (this.targetTime && !this.targetChargeDisabled) {
if (this.charging) {
if (this.planActive && this.charging) {
return t("targetChargeActive");
}
if (this.enabled) {
if (this.planActive && this.enabled) {
return t("targetChargeWaitForVehicle");
}
if (this.planProjectedStart) {