I am new to gpiozero. I successfully managed to make some LEDs blink, but I am struggling reading out the CPU temperature as described in the example at gpiozero.readthedocs.io.

My code is pretty short:

from gpiozero import CPUTemperature
from gpiozero.pins.pigpio import PiGPIOFactory
from time import sleep

factory = PiGPIOFactory(host='')
myRes = CPUTemperature(min_temp=30, max_temp=90,pin_factory=factory)

print('Initial Raspberry Pi temperature: ' + str(myRes.temperature))
print('READY and waiting 10s')

The error I receive is

[Errno 2] No such file or directory: '/sys/class/thermal/thermal_zone0/temp'

However, on the RasPi itself, I can see the mentioned device (and temperature):

pi@raspberrypi:~ $  cat /sys/class/thermal/thermal_zone0/temp

What do I do wrong? How can I fix that issue? Does GPIO maybe require some additional parameter?


  • 1
    The two paths you show are not the same, are you aware of this?
    – PMF
    Commented Mar 4, 2020 at 15:13
  • 1
    @PMF: That was a copy'n'paste error, I edited my question. Thanks for the hint.
    – B--rian
    Commented Mar 4, 2020 at 15:18

1 Answer 1


Unfortunately the CPUTemperature class does not support reading from a remote Pi, even if you provide a remote pin factory.

There's an issue to add it but it's probably not a priority: https://github.com/gpiozero/gpiozero/issues/581

For now you can try doing it with pigpio itself: http://abyz.me.uk/rpi/pigpio/python.html#file_open

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.