Hi Peter, This is the file I use
On Thursday, April 2, 2020 at 8:03:04 PM UTC+1, Vetti52 wrote: > > Hi, Gary! > > Sorry for the delay, but somehow I was occupied too much by my efforts to > introduce an Unifi Security Gateway into my network. And, well, it is still > under construction. Don't want to loose another hour of data in my Weewx > database. > > I moved back to the listing of Mike. But just replacing the line > > event.record['extraTemp1'] = ( cpu.temperature * 1.8 ) + 32 > > by the solution of Thomas turns the syntax wrong. Although I am an > absolute newbie in python, I know, that wrong indentation could make things > mess up. So I am fine with the listing of Mike. Maybe it is useful to > present a complete listing, easily transferable by copy/paste, for people > like me. > > Thanks! > Peter > > > > > Am Dienstag, 24. März 2020 22:19:34 UTC+1 schrieb gjr80: >> >> Hi, >> >> Most likely cause is that you have entered some code in the wrong place. >> Can you post the entire contents of your /usr/share/weewx/user/cputemp.py ? >> >> Gary >> >> -- 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/b2edd6fb-5f48-4815-a6b7-4c489de464f6%40googlegroups.com.
# Copyright (c) 2009-2020 Mike Revitt <m...@cougar.eu.com> # 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