Pass sensor through run()
This commit is contained in:
@@ -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)
|
||||||
Reference in New Issue
Block a user