From 12b6bcb3d04144c9edddb3f76177fc9555918ed1 Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Tue, 27 Oct 2020 19:00:05 +0000 Subject: [PATCH] fix(exec/temp):Reduce socket calls for hostname --- exec/temperature/DS18B20..temp_poll.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exec/temperature/DS18B20..temp_poll.py b/exec/temperature/DS18B20..temp_poll.py index f15926c..831e4aa 100755 --- a/exec/temperature/DS18B20..temp_poll.py +++ b/exec/temperature/DS18B20..temp_poll.py @@ -33,10 +33,12 @@ def read_temp(): #return temp_c, temp_f return temp_c_2dec + +myHostname = socket.gethostname() + while True: nowTimeIso8601 = strftime("%Y%m%dT%H%M%S%z") nowTimeUE = strftime("%s") nowTemp = read_temp() - myHostname = socket.gethostname() print(str(nowTimeIso8601) + ',' + str(nowTimeUE) + ',' + str(myHostname) + ',' + str(nowTemp)) time.sleep(1) -- 2.30.2