tecronin
Junior Member
Posts: 91
Raspberry Pi: Yes
|
Post by tecronin on Mar 19, 2021 22:56:34 GMT -8
I've added CPU Temp gauge to the status page on my forked repo.
any chance of getting it rolled into the actual code base.
is there a review/code submission process you have?
Attachments:
|
|
|
Post by truefinn on Mar 20, 2021 2:30:36 GMT -8
What a nice coincidence. I've made one too. Did You use os command vcgencmd or psutil library's sensors_temperatures() ?
|
|
|
Post by SDL on Mar 20, 2021 11:06:32 GMT -8
OUTSTANDING! We are adding this to our code here.
BP
|
|
tecronin
Junior Member
Posts: 91
Raspberry Pi: Yes
|
Post by tecronin on Mar 20, 2021 11:25:33 GMT -8
from gpiozero import CPUTemperature
if (id['GaugeType'] == "pi-cpu"): print("cpu temp=",int(CPUTemperature().temperature)) myValue = int(CPUTemperature().temperature) return myValue
|
|
|
Post by truefinn on Mar 20, 2021 11:40:02 GMT -8
Okay, fine!
I used vcgencmd. It's a bit more complicated, because it returns a text value
import os
# update Pi Temperature if (id['GaugeType'] == "pi-temp"): resp = os.popen('vcgencmd measure_temp').readline() myTemp = (resp.replace("temp=", "").replace("'C\n", "")) myValue = float(myTemp) return myValue
|
|