Pass sensor through run()

This commit is contained in:
2022-11-28 15:56:02 -05:00
parent 15b023ed40
commit 7ba0833d1f

View File

@@ -88,7 +88,7 @@ def publish(client, temp, humidity):
time.sleep(5.0) time.sleep(5.0)
def run(): def run(sensor):
# We first check if a libgpiod process is running. If yes, we kill it! # We first check if a libgpiod process is running. If yes, we kill it!
for proc in psutil.process_iter(): for proc in psutil.process_iter():
if proc.name() == 'libgpiod_pulsein' or proc.name() == 'libgpiod_pulsei': if proc.name() == 'libgpiod_pulsein' or proc.name() == 'libgpiod_pulsei':
@@ -101,4 +101,4 @@ def run():
publish(client, temp, humidity) publish(client, temp, humidity)
if __name__ == '__main__': if __name__ == '__main__':
run() run(sensor)