Farm alarm #28

Merged
senaduka merged 12 commits from farm_alarm into master 2016-10-30 09:05:00 +01:00
Showing only changes of commit 16bf8c8f3e - Show all commits

View File

@@ -5,8 +5,15 @@ def read_one_thermo(filename):
textfile = open(filename, 'r')
filetext = textfile.read()
textfile.close()
matches = re.findall("t=(\d+)", filetext)
return int(matches[0][0:-NO_OF_DECIMALS]) + (int(matches[0][-NO_OF_DECIMALS:]) / 1000.0)
matches = re.findall("t=(\-?)(\d+)", filetext)
sign = -1 if matches[0][0] == '-' else 1
whole_reading = matches[0][1]
first_part = matches[0][1][0:-NO_OF_DECIMALS]
second_part = matches[0][1][-NO_OF_DECIMALS:]
first_part = '0' if first_part == '' else first_part
return (int(first_part) + (int(second_part) / (10.0 ** NO_OF_DECIMALS) )) * sign
def read_many_thermo(filenames):
result = []