WakeUp timer: guard against vehicle-initiated charging stop (#7067)
This commit is contained in:
parent
b93a702973
commit
7e7fff48b6
1 changed files with 18 additions and 5 deletions
|
|
@ -395,7 +395,7 @@ func (lp *Loadpoint) evChargeStartHandler() {
|
|||
lp.log.INFO.Println("start charging ->")
|
||||
lp.pushEvent(evChargeStart)
|
||||
|
||||
lp.wakeUpTimer.Stop()
|
||||
lp.stopWakeUpTimer()
|
||||
|
||||
// soc update reset
|
||||
lp.socUpdated = time.Time{}
|
||||
|
|
@ -412,6 +412,9 @@ func (lp *Loadpoint) evChargeStartHandler() {
|
|||
func (lp *Loadpoint) evChargeStopHandler() {
|
||||
lp.log.INFO.Println("stop charging <-")
|
||||
lp.pushEvent(evChargeStop)
|
||||
if lp.enabled {
|
||||
lp.startWakeUpTimer()
|
||||
}
|
||||
|
||||
// soc update reset
|
||||
lp.socUpdated = time.Time{}
|
||||
|
|
@ -691,11 +694,9 @@ func (lp *Loadpoint) setLimit(chargeCurrent float64, force bool) error {
|
|||
|
||||
// start/stop vehicle wake-up timer
|
||||
if enabled {
|
||||
lp.log.DEBUG.Printf("wake-up timer: start")
|
||||
lp.wakeUpTimer.Start()
|
||||
lp.startWakeUpTimer()
|
||||
} else {
|
||||
lp.log.DEBUG.Printf("wake-up timer: stop")
|
||||
lp.wakeUpTimer.Stop()
|
||||
lp.stopWakeUpTimer()
|
||||
}
|
||||
|
||||
// remote start
|
||||
|
|
@ -1450,6 +1451,18 @@ func (lp *Loadpoint) processTasks() {
|
|||
}
|
||||
}
|
||||
|
||||
// startWakeUpTimer starts wakeUpTimer
|
||||
func (lp *Loadpoint) startWakeUpTimer() {
|
||||
lp.log.DEBUG.Printf("wake-up timer: start")
|
||||
lp.wakeUpTimer.Start()
|
||||
}
|
||||
|
||||
// stopWakeUpTimer stops wakeUpTimer
|
||||
func (lp *Loadpoint) stopWakeUpTimer() {
|
||||
lp.log.DEBUG.Printf("wake-up timer: stop")
|
||||
lp.wakeUpTimer.Stop()
|
||||
}
|
||||
|
||||
// Update is the main control function. It reevaluates meters and charger state
|
||||
func (lp *Loadpoint) Update(sitePower float64, autoCharge, batteryBuffered bool) {
|
||||
lp.processTasks()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue