diff --git a/examples/automatic.py b/examples/automatic.py index c0262bd..b9add36 100755 --- a/examples/automatic.py +++ b/examples/automatic.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from gpiozero import CPUTemperature from fanshim import FanShim from threading import Lock import colorsys @@ -47,12 +48,8 @@ def update_led_temperature(temp): def get_cpu_temp(): - t = psutil.sensors_temperatures() - for x in ['cpu-thermal', 'cpu_thermal']: - if x in t: - return t[x][0].current - print("Warning: Unable to get CPU temperature!") - return 0 + cpu = CPUTemperature() + return cpu.temperature def get_cpu_freq(): diff --git a/library/setup.cfg b/library/setup.cfg index f8e9375..ea7af94 100644 --- a/library/setup.cfg +++ b/library/setup.cfg @@ -40,11 +40,13 @@ ignore = [pimoroni] py3deps = python3-rpi.gpio + python3-gpiozero python3-setuptools python3-dev python3-psutil py2deps = python-rpi.gpio + python-gpiozero python-setuptools python-dev python-psutil