Thanks a lot for your idea!
Works perfect!
BTW, after modification with the if .. then ... else part, I get an error: 

Mar 24 21:04:59 raspbee weewx[618]:     ****    File 
"/usr/share/weewx/user/cputemp.py", line 19, in AddCpuTemp
Mar 24 21:04:59 raspbee weewx[618]:     ****      if 
event.record['usUnits'] == weewx.US:
Mar 24 21:04:59 raspbee weewx[618]:     ****  NameError: name 'event' is 
not defined
Mar 24 21:04:59 raspbee weewx[618]:     ****  Exiting.

Maybe, my copy/paste went messy with the identation?

Sorry for my poor python skills, please.

Am Mittwoch, 18. März 2020 19:48:21 UTC+1 schrieb Mike Revitt:
>
> Thanks Thomas, easy when you know how👍
>
> On Wednesday, March 18, 2020 at 6:27:59 PM UTC, Thomas Keffer wrote:
>>
>> import weewx
>>
>> if event.record['usUnits'] == weewx.US:
>>     event.record['extraTemp1'] = ( cpu.temperature * 1.8 ) + 32
>> else:
>>     event.record['extraTemp1'] = cpu.temperature
>>
>> -tk
>>
>>
>> On Wed, Mar 18, 2020 at 8:38 AM Mike Revitt <[email protected]> wrote:
>>
>>> Thanks Thomas,
>>>
>>> Was looking at that but didn't know how, my Raspberry Pi reports the 
>>> temperature in Celsius and the database is in Fahrenheit and obviously a 
>>> check would be best. 
>>>
>>> But how to do that easily?
>>>
>>>
>>> On Wednesday, March 18, 2020 at 2:14:32 PM UTC, Thomas Keffer wrote:
>>>>
>>>> Well done!
>>>>
>>>> However, your extension makes the assumption that the archive record is 
>>>> always in US Customary. Best to put a check in there before doing the 
>>>> conversion.
>>>>
>>>> -tk
>>>>
>>> -- 
>>> 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/0cd4a4b2-bf30-4f34-a567-4bff9120903f%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/0cd4a4b2-bf30-4f34-a567-4bff9120903f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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/a61bff93-2d68-45c6-9473-e716cf332e9d%40googlegroups.com.

Reply via email to