Recently I downloaded the latest version of weewx-cmon (v 0.20) which was
converted to use with python3.
This version, and also elder versions of cmon.py, did not read the cpu-temp
of my Raspberri PI systems (models 1B, 2B, 3B and 3B+).
On my raspberry PI the following statement is true: *os.path.exists(tdir)*,
still
a cpu-temp could not be found in this section
The *elif os.path.exists(tfile):* statement caused the bottem section to be
skipped and that is the section that reads the RPI cpu-temp.
See the modifications in yellow which fixed this problem.
Luc
--- snipped of cmon.py ---
# read cpu temperature
tdir = '/sys/class/hwmon/hwmon0/device'
# rpi keeps cpu temperature in a different location
tfile = '/sys/class/thermal/thermal_zone0/temp'
*temp_found = False*
if os.path.exists(tdir):
try:
for f in os.listdir(tdir):
if f.endswith('_input'):
s = self._readproc_line(os.path.join(tdir, f))
if s and len(s):
*temp_found = True*
n = f.replace('_input', '')
t_C = int(s) / 1000 # degree C
record['cpu_' + n] = t_C
except Exception as e:
logdbg("read failed for %s: %s" % (tdir, e))
### elif os.path.exists(tfile): ### original statement
if* not temp_found and *os.path.exists(tfile):
try:
s = self._readproc_line(tfile)
t_C = int(s) / 1000 # degree C
record['cpu_temp'] = t_C
except Exception as e:
logdbg("read failed for %s: %s" % (tfile, e))
-----------
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/db0db811-94ac-4762-ad31-9eb39b561bb9%40googlegroups.com.