File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed
Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ require (
3333 github.com/spf13/jwalterweatherman v1.1.0
3434 github.com/spf13/viper v1.7.0
3535 github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e
36- github.com/volkszaehler/mbmd v0.0.0-20200717102329-c4d965bd1eac
36+ github.com/volkszaehler/mbmd v0.0.0-20200802164800-51eb643c23c6
3737 github.com/yuin/goldmark v1.1.32
3838 golang.org/x/net v0.0.0-20200707034311-ab3426394381
3939 golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6
Original file line number Diff line number Diff line change @@ -348,6 +348,8 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
348348github.com/valyala/fasttemplate v1.1.0 /go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8 =
349349github.com/volkszaehler/mbmd v0.0.0-20200717102329-c4d965bd1eac h1:LnvR04M0HuzjTbRzMpE5jRHcNu46CvG1FOtMcZAX8C4 =
350350github.com/volkszaehler/mbmd v0.0.0-20200717102329-c4d965bd1eac /go.mod h1:sldLyJCKVO9GQkit55U5WPNr9U4KmUn1SCdqFN9Gjb4 =
351+ github.com/volkszaehler/mbmd v0.0.0-20200802164800-51eb643c23c6 h1:cs1lwT44CyqStjTmYe0vGDhQHEaBpYZh0dgXPQLeEpY =
352+ github.com/volkszaehler/mbmd v0.0.0-20200802164800-51eb643c23c6 /go.mod h1:sldLyJCKVO9GQkit55U5WPNr9U4KmUn1SCdqFN9Gjb4 =
351353github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 /go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU =
352354github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 /go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q =
353355github.com/yuin/goldmark v1.1.27 /go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74 =
Original file line number Diff line number Diff line change 11package meter
22
33import (
4+ "errors"
5+
46 "github.com/andig/evcc/api"
57 "github.com/andig/evcc/util"
68 "github.com/andig/evcc/util/modbus"
@@ -113,6 +115,12 @@ func (m *Modbus) floatGetter(op modbus.Operation) (float64, error) {
113115 }
114116 }
115117
118+ // silence NaN reading errors by assuming zero
119+ if err != nil && errors .Is (err , meters .ErrNaN ) {
120+ res .Value = 0
121+ err = nil
122+ }
123+
116124 if err != nil {
117125 m .conn .Close () // close connection in case of modbus error
118126 } else {
Original file line number Diff line number Diff line change @@ -156,6 +156,12 @@ func (m *Modbus) FloatGetter() (float64, error) {
156156 }
157157 }
158158
159+ // silence NaN reading errors by assuming zero
160+ if err != nil && errors .Is (err , meters .ErrNaN ) {
161+ res .Value = 0
162+ err = nil
163+ }
164+
159165 if err != nil {
160166 m .conn .Close () // close connection in case of modbus error
161167 } else {
You can’t perform that action at this time.
0 commit comments