From f9377ba1f918032fa9fa777c3d0be764dd1256ee Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Wed, 28 Oct 2020 21:04:11 +0000 Subject: [PATCH 1/1] fix(exec/temp):Remove buffer from poll py script to enable piping --- exec/temperature/DS18B20..temp_poll.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exec/temperature/DS18B20..temp_poll.py b/exec/temperature/DS18B20..temp_poll.py index 831e4aa..524bc96 100755 --- a/exec/temperature/DS18B20..temp_poll.py +++ b/exec/temperature/DS18B20..temp_poll.py @@ -1,4 +1,8 @@ #!/usr/bin/env python3 +# Desc: Prints time and temperature reading +# Output: [date (ISO-8601)],[date (Unix Epoch)],[temp (°C)] +# Depends: python 3.3 +# Ref/Attrib: Raspberry Pi Temprature Sensor using the DS18B20; https://pimylifeup.com/raspberry-pi-temperature-sensor/ import os import glob @@ -40,5 +44,5 @@ while True: nowTimeIso8601 = strftime("%Y%m%dT%H%M%S%z") nowTimeUE = strftime("%s") nowTemp = read_temp() - print(str(nowTimeIso8601) + ',' + str(nowTimeUE) + ',' + str(myHostname) + ',' + str(nowTemp)) + print(str(nowTimeIso8601) + ',' + str(nowTimeUE) + ',' + str(myHostname) + ',' + str(nowTemp), flush=True) # flush to stdout continuously (e.g. without buffer) https://stackoverflow.com/a/14729823 time.sleep(1) -- 2.30.2