Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behavior with DS18B20 #114

Open
3 tasks done
sdiama opened this issue Jun 4, 2022 · 2 comments
Open
3 tasks done

Weird behavior with DS18B20 #114

sdiama opened this issue Jun 4, 2022 · 2 comments
Assignees

Comments

@sdiama
Copy link

sdiama commented Jun 4, 2022

Erroneous Behavior

I run a "while/true loop" (every 5 seconds) to read the temperatures from multiple DS18B20 sensors.
When I disconnect the pin of one sensor from the breadboard, in order to emulate a cable/sensor problem, the "get_temperature()" method returns big negative numbers (ex. -109.9375, -110.1875) for multiple readings (10+ readings) before a "w1thermsensor.errors.SensorNotReadyError" exception is thrown.

Expected Behavior

"w1thermsensor.errors.SensorNotReadyError" exception to be thrown as soon as the sensor disconnected

Steps to reproduce

Unpin a DS18B20 sensor while in a while/true loop

Version

2.0

Python Version

3.9.2

Operating System

Raspberry Pi

Guidelines

  • I have read the contributing guide lines at CONTRIBUTING
  • I have read and respect the code of conduct at Code of Conduct
  • I have searched the existing issues and I'm convinced that mine is new
@timofurrer
Copy link
Owner

Hey @sdiama ! w1thermsensor is based on the w1 therm kernel modules in a sense that it reads from the files it exposes in /sys. Therefore, can you check the sensor file in /sys/bus/w1/devices and post its output here?

I'm curious to what it will contain in your case, before it isn't ready any longer.

@sdiama
Copy link
Author

sdiama commented Jun 12, 2022

3 days now I'm trying to reproduce the error by removing pins, of multiple sensors in my test breadboard and I cannot get the same error! Maybe it was a sensor fault?
I made some changes to my code. If a temperature below of -20 is returned by "get_temperature()" method (they are ambient sensors), then I also read the /sys/bus/w1/devices/xxxxxxx/w1_slave and write it to a log file, in order to give you better feedback in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants