Show guard disable timer (#8100)

This commit is contained in:
Michael Geers 2023-05-20 16:07:24 +02:00 • committed by GitHub
parent ec81ad4d12
commit f08dea2c47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 8 deletions

View file

@ -134,23 +134,38 @@ describe("timer", () => {
test("show guard timer if it exists", () => {
expectStatus(
{
guardAction: "enable",
connected: true,
guardAction: "enable",
guardRemainingInterpolated: 90,
},
"guard",
{ remaining: "1:30m" }
);
});
test("don't show guard timer if charging", () => {
test("don't show guard timer if another timer exists", () => {
expectStatus(
{
guardAction: "enable",
connected: true,
charging: true,
pvAction: "disable",
pvRemainingInterpolated: 30,
guardAction: "enable",
guardRemainingInterpolated: 90,
},
"charging"
"pvDisable",
{ remaining: "30s" }
);
});
test("show guard timer if charging and no other timer exists", () => {
expectStatus(
{
connected: true,
charging: true,
guardAction: "enable",
guardRemainingInterpolated: 90,
},
"guard",
{ remaining: "1:30m" }
);
});
});

View file

@ -116,16 +116,16 @@ export default {
});
}
if (this.charging) {
return t("charging");
}
if (this.guardTimerActive) {
return t("guard", {
remaining: this.fmtShortDuration(this.guardRemainingInterpolated, true),
});
}
if (this.charging) {
return t("charging");
}
return t("connected");
},
},