MCPcopy Create free account
hub / github.com/evcc-io/evcc / smartLimitActive

Method smartLimitActive

core/loadpoint_smartcost.go:22–32  ·  view source on GitHub ↗
(limit *float64, rates api.Rates, checkBelow bool)

Source from the content-addressed store, hash-verified

20}
21
22func (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
35func (lp *Loadpoint) smartLimitNextStart(limit *float64, rates api.Rates, checkBelow bool) time.Time {

Callers 2

checkSmartLimitMethod · 0.95

Calls 1

AtMethod · 0.80

Tested by

no test coverage detected