From 192b0881bbf1740aef05d7f976a5066a3f2014d7 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 15 Feb 2021 23:28:42 +0100 Subject: [PATCH] fix --- mqtt_publish_temp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mqtt_publish_temp.py b/mqtt_publish_temp.py index 5acea41..3047298 100644 --- a/mqtt_publish_temp.py +++ b/mqtt_publish_temp.py @@ -50,7 +50,7 @@ while True: print("temperature before cut: " + str(temperature)) # cut temperature to xx.xx if more then tow digits after "." - t_split = temperature.split(".") + t_split = str(temperature).split(".") if len(t_split[1]) > 2: t_cut = len(t_split[1]) - 2 t_split[1] = t_split[1][:-t_cut] @@ -62,7 +62,7 @@ while True: print("humidity before cut: " + str(humidity)) # cut humidity to xx.xx if more then tow digits after "." - h_split = humidity.split(".") + h_split = str(humidity).split(".") if len(h_split[1]) > 2: h_cut = len(h_split[1]) - 2 h_split[1] = h_split[1][:-h_cut]