Re: [weewx-user] Re: cmon - Extension / cpu_temp missing on raspberry

2022-11-28 Thread Matthias Manhart
Thanks to the hints in this case. I run weewx on a Raspberry Pi 4 too and 
could not see a CPU temperature. 

I modified the file *cmon.py* like this:

# read cpu temperature
tdir = '/sys/class/hwmon/hwmon0/device'
# rpi keeps cpu temperature in a different location
tfile = '/sys/class/thermal/thermal_zone0/temp'
if os.path.exists(tfile):# 
moved above 'elif os.path.exists(tdir):'
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))
elif os.path.exists(tdir):   # 
moved behind 'if os.path.exists(tfile):'
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):
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))

The ' if os.path.exists(tfile): ' must be checked first. The complete block 
beginning with ' if os.path.exists(tfile): ' must be moved and if and elif 
must be changed. Now i can see the CPU temperature.

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/61c63f12-7e09-4180-a4f3-44e3d88cd217n%40googlegroups.com.


Re: [weewx-user] Re: cmon - Extension / cpu_temp missing on raspberry

2021-03-14 Thread 'Pline Pa' via weewx-user
Thank you for the hints! I was able to find the cmon.py file under 
/usr/share/weewx/user/ I've changed the if-condition so that tfile is 
now used. Now the display of the cpu_temp works perfectly. Many Thanks



In the file cmon.py, there is a check on a directory (tdir) and a 
check on a specific file (tfile).  Apparently on some unices, the 
directory tdir contains a file with the cpu temp.  On raspberries, the 
directory exists, but doesn’t contain the temperature file.  The cpu 
temp is actually in the file tfile.  So basically, you have to swap 
the order of the check:  check first for tfile then tdir.  I’d post 
the necessary mod, but I don’t have access to my rpi right now.


Hope this helps and sorry for not being able to give more details!



--
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/69db508d-6d91-0842-fd1e-258c1db83156%40googlemail.com.


[weewx-user] Re: cmon - Extension / cpu_temp missing on raspberry

2021-03-12 Thread Dr__Bob
In the file cmon.py, there is a check on a directory (tdir) and a check on 
a specific file (tfile).  Apparently on some unices, the directory tdir 
contains a file with the cpu temp.  On raspberries, the directory exists, 
but doesn’t contain the temperature file.  The cpu temp is actually in the 
file tfile.  So basically, you have to swap the order of the check:  check 
first for tfile then tdir.  I’d post the necessary mod, but I don’t have 
access to my rpi right now.

Hope this helps and sorry for not being able to give more details!

On Wednesday, March 10, 2021 at 9:12:00 AM UTC-8 plin...@googlemail.com 
wrote:

> Hello,
>
> i have installed the cmon extension as described in 
> https://github.com/weewx/weewx/wiki/cmon
>
> In the plots the cpu_temp - Graph has no values.
>
> I use an raspberry pi 4
>
> does someone have a tip about it?
>
> Many thanks and greetings
>
> plinepa
>
>
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/df7404aa-e50c-4451-af49-a9b9b1de5b53n%40googlegroups.com.