OS: Linux homeassistant 6.6.31-haos-raspi SMP PREEMPT Wed Aug 21 16:29:59 UTC 2024 aarch64 Linux
Architecture: 64bit
Psutil version: 6.0.0
Python version: 3.12.4
Type: conflicting hardware
Description
When using parasitic-powered 1-wire temperature sensors with the DS2482S-100 line driver, the 1-wire temperature sensors now-and-then reported temperature 85degC. This indicates that the time that the device could consume the parasitic power from the dataline was too short to make a valid temperature readout.
Further investigation with oscilloscope showed me that another client was sending readout messages to the one-wire sensor during the time that the dataline was feeding power. This causes the line master to stop feeding power. And for that reason, the sensor returned 85degC.
Looking for the cause of this disruption I found that the Systemmonitor of Homeassistant uses psutil for monitoring all kind of system resources, including CPU temperature. Psutil is reading all sensors in /sys/class/hwmon/. As linux also propagates the one-wire sensors in this directory, these sensors are read as well. I think it is not the intention of psutil to read those sensors; a single readout can take up to 1 second time, so if a system contains a lot of these sensors, reading all of them can take a lot of time. Beside that, temperature sensors on the onewire bus are not interesting for system monitoring. So I propose to skip the onewire sensors when reading the content of /sys/class/hwmon. I will prepaire a tested pull request.
Summary
Description
When using parasitic-powered 1-wire temperature sensors with the DS2482S-100 line driver, the 1-wire temperature sensors now-and-then reported temperature 85degC. This indicates that the time that the device could consume the parasitic power from the dataline was too short to make a valid temperature readout. Further investigation with oscilloscope showed me that another client was sending readout messages to the one-wire sensor during the time that the dataline was feeding power. This causes the line master to stop feeding power. And for that reason, the sensor returned 85degC. Looking for the cause of this disruption I found that the Systemmonitor of Homeassistant uses psutil for monitoring all kind of system resources, including CPU temperature. Psutil is reading all sensors in /sys/class/hwmon/. As linux also propagates the one-wire sensors in this directory, these sensors are read as well. I think it is not the intention of psutil to read those sensors; a single readout can take up to 1 second time, so if a system contains a lot of these sensors, reading all of them can take a lot of time. Beside that, temperature sensors on the onewire bus are not interesting for system monitoring. So I propose to skip the onewire sensors when reading the content of /sys/class/hwmon. I will prepaire a tested pull request.