Goal is to switch an exhaust fan at an outside data-logging station at a solar power station. The data-collection program is written in Python under Raspbian.
For reading CPU temp at a command line, there is the
Example in bash:
echo "The CPU is at $(vcgencmd measure_temp) degrees." The CPU is at temp=39.2'C degrees.
as the command returns the string "temp=39.2'C"
I've never personally seen this fail, although I know there is a question about that point.
vcgencmd measure_temp doesn't always work
Meanwhile, I would like to obtain the CPU temp in Python.
Back to the Goal: the fans are controlled by
PiGPIO calls, and during data-logging I keep my external system calls to the minimum (ie., there aren't any other than Python file I/O). Also, it would be much preferable to get the answer as a simple floating-point value than to extract it from a return strung.
The question is: How to directly get CPU temp in Python?