from gpiozero import CPUTemperature
# get the temperature of the CPU of the Raspberry
def getRaspiCpuTemperature():
tempFile = open("/sys/class/thermal/thermal_zone0/temp")
cpu_temp = tempFile.read()
tempFile.close()
return (float(cpu_temp) / 1000)
# get the temperature of the CPU of the Raspberry
# with gpiozero
def getRaspiCpuTemperature02():
gpiozero_cpu = CPUTemperature()
return (gpiozero_cpu.temperature)