From cf4018f26fd3cfefd4e5126750cf5c5388960390 Mon Sep 17 00:00:00 2001 From: Szymon Kowalewski <37596854+Szymok@users.noreply.github.com> Date: Wed, 12 Jul 2023 20:13:23 +0200 Subject: [PATCH] ubuntu fix correct value for GPIOZERO_PIN_FACTORY should be RPiGPIO on ubuntu --- fancontrol.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fancontrol.py b/fancontrol.py index 92f0b00..cefecc3 100755 --- a/fancontrol.py +++ b/fancontrol.py @@ -1,21 +1,20 @@ #!/usr/bin/env python3 import time +import os -from gpiozero import OutputDevice +os.environ["GPIOZERO_PIN_FACTORY"] = "RPiGPIO" +from gpiozero import OutputDevice -ON_THRESHOLD = 65 # (degrees Celsius) Fan kicks on at this temperature. -OFF_THRESHOLD = 55 # (degress Celsius) Fan shuts off at this temperature. +ON_THRESHOLD = 60 # (degrees Celsius) Fan kicks on at this temperature. +OFF_THRESHOLD = 55 # (degrees Celsius) Fan shuts off at this temperature. SLEEP_INTERVAL = 5 # (seconds) How often we check the core temperature. -GPIO_PIN = 17 # Which GPIO pin you're using to control the fan. - +GPIO_PIN = 4 # Which GPIO pin you're using to control the fan. def get_temp(): """Get the core temperature. - Read file from /sys to get CPU temp in temp in C *1000 - Returns: int: The core temperature in thousanths of degrees Celsius. """