Plan: fix late for energy plans (#21080)

This commit is contained in:
Michael Geers 2025-05-06 10:20:54 +02:00 • committed by GitHub
parent bfd6fcf790
commit 7294c8b959
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 3 deletions

View file

@ -314,7 +314,7 @@ export default defineComponent({
},
updateStaticPlan(plan: StaticPlan): void {
const timeISO = plan.time.toISOString();
const params = this.socBasedPlanning ? { precondition: plan.precondition } : undefined;
const params = plan.precondition ? { precondition: plan.precondition } : undefined;
if (this.socBasedPlanning) {
const p = plan as StaticSocPlan;
api.post(`${this.apiVehicle}plan/soc/${p.soc}/${timeISO}`, null, { params });

View file

@ -216,7 +216,7 @@ export default defineComponent({
selectedSoc: this.soc,
selectedEnergy: this.energy,
active: false,
selectedPrecondition: 0,
selectedPrecondition: this.precondition,
};
},
computed: {

View file

@ -255,8 +255,10 @@ export default defineComponent({
},
async fetchStaticPreviewEnergy(plan: StaticEnergyPlan): Promise<PlanResponse | undefined> {
const timeISO = plan.time.toISOString();
const params = plan.precondition ? { precondition: plan.precondition } : undefined;
return await this.apiFetchPlan(
`loadpoints/${this.id}/plan/static/preview/energy/${plan.energy}/${timeISO}`
`loadpoints/${this.id}/plan/static/preview/energy/${plan.energy}/${timeISO}`,
params
);
},
async apiFetchPlan(

View file

@ -348,6 +348,7 @@ func (lp *Loadpoint) setPlanEnergy(finishAt time.Time, precondition time.Duratio
}
lp.planTime = finishAt
lp.planPrecondition = precondition
lp.publish(keys.PlanTime, finishAt)
lp.publish(keys.PlanPrecondition, precondition)
lp.settings.SetTime(keys.PlanTime, finishAt)