Changing Connection location
This commit is contained in:
@@ -94,11 +94,12 @@ def publish(client, temp, humidity):
|
|||||||
time.sleep(5.0)
|
time.sleep(5.0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
client = connect_mqtt()
|
|
||||||
client.loop_start()
|
|
||||||
print (sensor)
|
print (sensor)
|
||||||
while True:
|
while True:
|
||||||
|
client = connect_mqtt()
|
||||||
|
client.loop_start()
|
||||||
temp, humidity = getValues(sensor)
|
temp, humidity = getValues(sensor)
|
||||||
publish(client, temp, humidity)
|
publish(client, temp, humidity)
|
||||||
time.sleep (5.0)
|
time.sleep (5.0)
|
||||||
|
client.loop_stop() #Stop loop
|
||||||
|
client.disconnect() # disconnect
|
||||||
|
|||||||
Reference in New Issue
Block a user