diff options
author | erg <uinarf@autistici.org> | 2023-03-01 09:27:00 +0100 |
---|---|---|
committer | erg <uinarf@autistici.org> | 2023-03-01 09:27:00 +0100 |
commit | 359e051ec88b4daa1fe5cdb7921e747c4584fc46 (patch) | |
tree | efe2e06b5fa3bdd50cb249686e7a3ff33888d891 | |
parent | ad96edf8be0e758277f77c521ebb0e8383cda647 (diff) | |
download | Pi_Relay-359e051ec88b4daa1fe5cdb7921e747c4584fc46.tar.gz Pi_Relay-359e051ec88b4daa1fe5cdb7921e747c4584fc46.tar.bz2 Pi_Relay-359e051ec88b4daa1fe5cdb7921e747c4584fc46.zip |
File rename
-rw-r--r-- | py_relay.py (renamed from main.py) | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -88,7 +88,7 @@ def heater_on(temp, on=False) -> bool: timestamp = time.strftime(TIMEFORMAT) # turning it off if not on: - if status == 1: + if status: retval = 0 else: try: @@ -96,11 +96,12 @@ def heater_on(temp, on=False) -> bool: message = f"Turning off, temp: {temp}, {timestamp}" logger.info(message) retval = 0 - except: + except Exception as exc: + logger.warning(exc) retval = 1 # turning it on else: - if status == 0: + if not status: retval = 0 else: try: @@ -108,7 +109,8 @@ def heater_on(temp, on=False) -> bool: message = f"Turning on, temp: {temp}, {timestamp}" logger.info(message) retval = 0 - except: + except Exception as exc: + logger.warning(exc) retval = 1 return retval |