diff --git a/pkg/temperature/ds18b20.go b/pkg/temperature/ds18b20.go index a86740c..6c77a27 100644 --- a/pkg/temperature/ds18b20.go +++ b/pkg/temperature/ds18b20.go @@ -248,6 +248,10 @@ func read(sensor string) (int64, error) { raw := string(data) + if raw == "" { + return NaN, fmt.Errorf("%v: %w: empty file", sensor, ErrReadSensor) + } + if !strings.Contains(raw, " YES") { return NaN, fmt.Errorf("%v: %w: checksum failed [%v]", sensor, ErrReadSensor, raw) }