Final Cleanup
This commit is contained in:
@@ -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}`")
|
||||
|
||||
Reference in New Issue
Block a user