So below is the code I used from Mike Revitt.  I have no idea if it comes
from a package. I followed Mike’s instructions as well as I could.  He was
not clear what to name it or where to put it.  I created the python script
in the ‘user/share/weewx/user folder.  At first, I named it AddCpuTemp.py
but that generated errors starting weewx.  Then I named it cputemp.py and
the startup errors went away.  I hope that makes sense.



On Thu, Nov 12, 2020 at 6:23 PM vince <[email protected]> wrote:

> We'd have to see the code you're running to look at it in detail.
> Where did you get 'cputemp.py' and how can we get a look at the exact
> version you're running ?
>
> FWIW - you check the temperature on a pi by running "vcgencmd
> measure_temp" which reads the right thing under /proc and formats it for
> output
>
> On Thursday, November 12, 2020 at 3:19:45 PM UTC-8 [email protected]
> wrote:
>
>> Ok,  I am not familiar with Python at all.  I managed to work through the
>> instructions above and make the changes to my weewx.conf file and then
>> create cputemp.py in my /usr/share/weewx/user directory.  This eliminated
>> the errors in the my syslog.  I am not seeing the cpu temp on the charts.
>> How would I look up the variables in python to see if they are registering
>> at all.
>>
>>
>>> On Friday, May 8, 2020 at 3:41:39 AM UTC-5, Mike Revitt wrote:
>>>>
>>>> I have this working on my Rasberry pi at
>>>> https://weather.cougar.eu.com/telemetry.html and this is how I did it
>>>>
>>>> in weewx.conf
>>>>
>>>> In
>>>> [Engine]
>>>>  [[Services]]
>>>>
>>>> set
>>>>
>>>> data_services = user.cputemp.AddCpuTemp
>>>>
>>>> Then add this Python program to the bin user directory where your
>>>> Rasberry Pi code is.
>>>>
>>>> #    Copyright (c) 2009-2020 Mike Revitt
>>>>
>>>> #    See the file LICENSE.txt for your rights.
>>>>
>>>> """Gets the CPU temperature on a Rasberry Pi"""
>>>>
>>>>
>>>>
>>>> *import*  weewx
>>>>
>>>> *from*    weewx.engine    *import*  StdService
>>>>
>>>> *from*    gpiozero        *import*  CPUTemperature
>>>>
>>>>
>>>>
>>>> *class* AddCpuTemp(StdService):
>>>>
>>>>
>>>>
>>>>     *def* __init__(self, engine, config_dict):
>>>>
>>>>
>>>>
>>>>       # Initialize my superclass first:
>>>>
>>>>       super(AddCpuTemp, self).__init__(engine, config_dict)
>>>>
>>>>
>>>>
>>>>       # Bind to any new archive record events:
>>>>
>>>>       self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
>>>>
>>>>
>>>>
>>>>     *def* new_archive_record(self, event):
>>>>
>>>>
>>>>
>>>>         cpu = CPUTemperature()
>>>>
>>>>
>>>>
>>>>         *if* event.record['usUnits'] == weewx.US:
>>>>
>>>>             event.record['extraTemp1'] = ( cpu.temperature * 1.8 ) + 32
>>>>
>>>>         *else*:
>>>>
>>>>             event.record['extraTemp1'] = cpu.temperature
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> You can then access the Rasberry Pi CPU temperature as the variable
>>>> extraTemp1 from within your HTML files
>>>>
>>> --
-------------------------------------------------------------------------------------------------
Kevin Chapman
(713) 245-9368

Life is a food chain.  Be at the top or be on the menu!
-------------------------------------------------------------------------------------------------

-- 
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/CACwjpb0H5YB6Asi%3DXDOQpFo51pnwnm%3D7wvknCHof5a0Gjy3RLA%40mail.gmail.com.

Reply via email to