I am using BCRobotics driver. I rounded to avoid bunch of decimals. Had to
encode to avoid python3 errors. This works fine for me. I have 4 rpi4's
running and get the temp from all of them.
import math
import subprocess
def round_half_up(n, decimals=0):
multiplier = 10 ** decimals
return math.floor(n*multiplier + 0.5) / multiplier
def get_cpu_temp():
cpu_temp =
subprocess.check_output(["cat","/sys/class/thermal/thermal_zone0/temp"],universal_newlines=True)
encoding = 'utf-8'
cpu_temp = int(cpu_temp)
cpu_temp = cpu_temp/1000
cpu_temp = round_half_up(cpu_temp,0)
return cpu_temp
under def get_readings():
cpu_temp = get_cpu_temp()
data = dict()
data["extraTemp1"] = cpu_temp
return data
On Thursday, February 20, 2020 at 10:55:00 AM UTC-6, 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/4d9494eb-7c62-4a33-9446-a67f7e0bf1c8%40googlegroups.com.