(limit *float64, rates api.Rates, checkBelow bool)
| 20 | } |
| 21 | |
| 22 | func (lp *Loadpoint) smartLimitActive(limit *float64, rates api.Rates, checkBelow bool) bool { |
| 23 | rate, err := rates.At(time.Now()) |
| 24 | if err != nil || limit == nil { |
| 25 | return false |
| 26 | } |
| 27 | |
| 28 | if checkBelow { |
| 29 | return rate.Value <= *limit |
| 30 | } |
| 31 | return rate.Value >= *limit |
| 32 | } |
| 33 | |
| 34 | // smartLimitNextStart returns the next start time when the smart limit condition will be met |
| 35 | func (lp *Loadpoint) smartLimitNextStart(limit *float64, rates api.Rates, checkBelow bool) time.Time { |
no test coverage detected