From a489f4773771fcde3a446c9867d18eba4654655d Mon Sep 17 00:00:00 2001 From: jerick Date: Mon, 28 Nov 2022 13:58:10 -0500 Subject: [PATCH] Int/String fix --- mqtt/tempSensor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mqtt/tempSensor.py b/mqtt/tempSensor.py index e0a0cb5..b77ff50 100644 --- a/mqtt/tempSensor.py +++ b/mqtt/tempSensor.py @@ -31,7 +31,6 @@ while True: #convert to Farenheit temp = (temp * 1.8) + 32 - print("Temperature: {}*F Humidity: {}% ".format(temp, humidity)) except RuntimeError as error: print(error.args[0]) @@ -54,7 +53,7 @@ while True: client.connect(broker, port) #Publish Temp Results - tempMsg = f'{ "temperature": {temp} }' + tempMsg = '{ "temperature": {} }'.format(temp) result = client.publish(tempTopic, tempMsg) # result: [0, 1] status = result[0] @@ -64,7 +63,8 @@ while True: print(f"Failed to send message to topic {tempTopic}") #Publish Humid Results - humidMsg = f'{ "humidity": {humidity} }' + + humidMsg = '{ "humidity": {} }'.format(humidity) result = client.publish(humidTopic, humidMsg) # result: [0, 1] status = result[0]