Revert "Modbus: handle NaN values" (#31968)

This commit is contained in:
andig 2026-07-20 10:11:25 +02:00 • committed by GitHub
parent a1e8854df1
commit 7a95266a6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 26 deletions

View file

@ -9,7 +9,6 @@ import (
"strings"
"time"
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/util"
"github.com/evcc-io/evcc/util/modbus"
gridx "github.com/grid-x/modbus"
@ -157,12 +156,7 @@ func (m *Modbus) FloatGetter() (func() (f float64, err error), error) {
return 0, fmt.Errorf("read failed: %w", err)
}
// a "*nan" sentinel decodes to NaN - the device reports no valid value
if res := m.scale * decode(bytes); !math.IsNaN(res) {
return res, nil
}
return 0, api.ErrNotAvailable
return m.scale * decode(bytes), nil
}, nil
}