diff --git a/mqtt_publish_temp.py b/mqtt_publish_temp.py index 9e59b02..9c6b715 100644 --- a/mqtt_publish_temp.py +++ b/mqtt_publish_temp.py @@ -48,10 +48,10 @@ while True: # Get Temperature from DHT _, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN) - temperature = round(temperature, 2) + temperature = round(float(temperature), 2) # Get Humidity from DHT humidity, _ = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN) - humidity = round(humidity, 2) + humidity = round(float(humidity), 2) # Publish our data client.publish(temperature_topic, temperature) @@ -60,6 +60,6 @@ while True: time.sleep(30) - # Output data to screen - # print temperature - # print humidity \ No newline at end of file + Output data to screen + print temperature + print humidity \ No newline at end of file