From 1d955fc15e75ef7111c7a77b22eb0d437e59033e Mon Sep 17 00:00:00 2001 From: jerick Date: Mon, 28 Nov 2022 16:05:58 -0500 Subject: [PATCH] test --- mqtt/tempSensor.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/mqtt/tempSensor.py b/mqtt/tempSensor.py index 04019e0..456e80f 100644 --- a/mqtt/tempSensor.py +++ b/mqtt/tempSensor.py @@ -89,17 +89,13 @@ def publish(client, temp, humidity): time.sleep(5.0) -def run(sensor): - # We first check if a libgpiod process is running. If yes, we kill it! - for proc in psutil.process_iter(): - if proc.name() == 'libgpiod_pulsein' or proc.name() == 'libgpiod_pulsei': - proc.kill() - client = connect_mqtt() - client.loop_start() - print (sensor) - while True: - temp, humidity = getValues(sensor) - publish(client, temp, humidity) - -#if __name__ == '__main__': -run(sensor) \ No newline at end of file +# We first check if a libgpiod process is running. If yes, we kill it! +for proc in psutil.process_iter(): + if proc.name() == 'libgpiod_pulsein' or proc.name() == 'libgpiod_pulsei': + proc.kill() +client = connect_mqtt() +client.loop_start() +print (sensor) +while True: + temp, humidity = getValues(sensor) + publish(client, temp, humidity)