Not sure if you are still looking for solutions, but I liked you idea so 
had a look at implementing it in Python.

Turns out it was easier than I thought.

1) create a python file and put it into the bin/user directory, this file 
gets the CPU temperature, coverts it to Fahrenheit and puts it into the 
extraTemp1 column in the database

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()

        event.record['extraTemp1'] = ( cpu.temperature * 1.8 ) + 32


2) modify weewx.conf to call the new file
[Engine]
    
    [[Services]]
        # This section specifies the services that should be run. They are
        # grouped by type, and the order of services within each group
        # determines the order in which the services will be run.
        prep_services = weewx.engine.StdTimeSynch
        data_services = user.cputemp.AddCpuTemp


Now the value can be obtained anywhere you want by 
referencing $current.extraTemp1
I modified about.inc in the seasons skin with the following

    <tr>
      <td class="label">Server uptime</td>
      <td class="data">$station.os_uptime</td>
    </tr>
    <tr>
      <td class="label">Server CPU Temp</td>
      <td class="data">$current.extraTemp1</td>
    </tr>
    <tr>
      <td class="label">WeeWX uptime</td>
      <td class="data">$station.uptime</td>
    </tr>


Also you can now access the dayTemp graph to see the plots over time

On Thursday, February 20, 2020 at 4:55:00 PM UTC, Vetti52 wrote:
>
> Sorry for being too dumb for python...
>
> I want to show the actual cpu temperature in the "About this weather 
> station" section. On my Raspberry Pi I get the result: 
>
> $ vcgencmd measure_temp
> temp=53.0'C
>
> However, I do not know, how to enter this into a skin file. 
> I gave a first try to
>
> <?PHP
> echo exec('vcgencmd measure_temp|sed "s/'/ °/"');
> ?>
>
> resulting in
> VCHI initialization failed
>
> I have added www-data to the video group, but this did not help. But, may 
> be, it is much easier to realize. Please help!
>
>
>

-- 
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/51911b10-1bd3-4c73-89cd-22532f89eb63%40googlegroups.com.

Reply via email to