diff --git a/charger/easee.go b/charger/easee.go index 842e7f1ee..38da681de 100644 --- a/charger/easee.go +++ b/charger/easee.go @@ -23,6 +23,7 @@ import ( "errors" "fmt" "net/http" + "os" "strconv" "sync" "time" @@ -160,7 +161,7 @@ func NewEasee(user, password, charger string) (*Easee, error) { select { case <-done: case <-time.After(request.Timeout): - err = api.ErrTimeout + err = os.ErrDeadlineExceeded } return c, err diff --git a/cmd/dumper.go b/cmd/dumper.go index cbe692556..a13350af3 100644 --- a/cmd/dumper.go +++ b/cmd/dumper.go @@ -74,7 +74,7 @@ func (d *dumper) Dump(name string, v interface{}) { for err = api.ErrMustRetry; err != nil && errors.Is(err, api.ErrMustRetry); { if soc, err = v.SoC(); err != nil { if time.Since(start) > time.Minute { - err = api.ErrTimeout + err = os.ErrDeadlineExceeded } else { fmt.Fprint(w, ".") time.Sleep(3 * time.Second) diff --git a/cmd/soc/main.go b/cmd/soc/main.go index 2233b8bdf..ec8525e7e 100644 --- a/cmd/soc/main.go +++ b/cmd/soc/main.go @@ -88,7 +88,7 @@ func main() { for err = api.ErrMustRetry; err != nil && matchesError(err, api.ErrMustRetry); { if soc, err = v.SoC(); err != nil { if time.Since(start) > time.Minute { - err = api.ErrTimeout + err = os.ErrDeadlineExceeded } else { time.Sleep(5 * time.Second) } diff --git a/meter/dsmr.go b/meter/dsmr.go index 6914109d6..61da7b6b7 100644 --- a/meter/dsmr.go +++ b/meter/dsmr.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "net" + "os" "strconv" "strings" "sync" @@ -104,7 +105,7 @@ func NewDsmr(uri, energy string, timeout time.Duration) (api.Meter, error) { select { case <-done: case <-time.NewTimer(timeout).C: - return nil, api.ErrTimeout + return nil, os.ErrDeadlineExceeded } // decorate energy reading @@ -219,7 +220,7 @@ func (m *Dsmr) get(id string) (float64, error) { defer m.mu.Unlock() if time.Since(m.updated) > m.timeout { - return 0, api.ErrTimeout + return 0, os.ErrDeadlineExceeded } res, ok := m.frame.Objects[id] diff --git a/provider/mqtt/client.go b/provider/mqtt/client.go index 15d919f4a..eb15f5701 100644 --- a/provider/mqtt/client.go +++ b/provider/mqtt/client.go @@ -4,12 +4,12 @@ import ( "crypto/tls" "fmt" "math/rand" + "os" "strings" "sync" "time" paho "github.com/eclipse/paho.mqtt.golang" - "github.com/evcc-io/evcc/api" "github.com/evcc-io/evcc/util" ) @@ -129,7 +129,7 @@ func (m *Client) Publish(topic string, retained bool, payload interface{}) error if token.WaitTimeout(publishTimeout) { return token.Error() } - return api.ErrTimeout + return os.ErrDeadlineExceeded } // Listen validates uniqueness and registers and attaches listener