From 1207ee365dffd0638d89e6143fd80877a1600590 Mon Sep 17 00:00:00 2001 From: jerick Date: Tue, 29 Nov 2022 15:33:14 -0500 Subject: [PATCH] Final Cleanup --- mqtt/tempSensor.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/mqtt/tempSensor.py b/mqtt/tempSensor.py index 46873b0..925f44e 100644 --- a/mqtt/tempSensor.py +++ b/mqtt/tempSensor.py @@ -24,17 +24,6 @@ for proc in psutil.process_iter(): #D20 is the pin number, DHT11 is the sensor type sensor = adafruit_dht.DHT11(board.D20) -#MQTT Connection -# def on_connect(client, rc): -# if rc == 0: -# print("Connected to MQTT Broker!") -# else: -# print("Failed to connect, return code %d\n", rc) -# #MQTT Connect -# client = mqtt_client.Client(client_id) -# client.username_pw_set(username, password) -# client.on_connect = on_connect -# client.connect(broker, port) def connect_mqtt(): def on_connect(client, userdata, flags, rc): if rc == 0: @@ -49,9 +38,6 @@ def connect_mqtt(): return client - - - def getValues(sensor): try: temp = sensor.temperature @@ -76,7 +62,6 @@ def publish(client, temp, humidity): tempMsg = '{{ "temperature": "{}" }}'.format(temp) #tempMsg = temp result = client.publish(tempTopic, tempMsg) - # result: [0, 1] status = result[0] if status == 0: #print(f"Send `{tempMsg}` to topic `{tempTopic}`") @@ -87,7 +72,6 @@ def publish(client, temp, humidity): #Publish Humid Results humidMsg = '{{ "humidity": "{}" }}'.format(humidity) result = client.publish(humidTopic, humidMsg) - # result: [0, 1] status = result[0] if status == 0: #print(f"Send `{humidMsg}` to topic `{humidTopic}`")