Allow grace period before out of sync error is displayed (#2937)
This commit is contained in:
parent
1217da8504
commit
515cd5f810
1 changed files with 5 additions and 1 deletions
|
|
@ -46,6 +46,8 @@ const (
|
|||
minActiveCurrent = 1.0 // minimum current at which a phase is treated as active
|
||||
vehicleDetectInterval = 3 * time.Minute
|
||||
vehicleDetectDuration = 10 * time.Minute
|
||||
|
||||
guardGracePeriod = 10 * time.Second // allow out of sync during this timespan
|
||||
)
|
||||
|
||||
// elapsed is the time an expired timer will be set to
|
||||
|
|
@ -563,7 +565,9 @@ func (lp *LoadPoint) syncCharger() {
|
|||
enabled, err := lp.charger.Enabled()
|
||||
if err == nil {
|
||||
if enabled != lp.enabled {
|
||||
lp.log.WARN.Printf("charger out of sync: expected %vd, got %vd", status[lp.enabled], status[enabled])
|
||||
if time.Since(lp.guardUpdated) > guardGracePeriod {
|
||||
lp.log.WARN.Printf("charger out of sync: expected %vd, got %vd", status[lp.enabled], status[enabled])
|
||||
}
|
||||
err = lp.charger.Enable(lp.enabled)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue