def do_them_updates():
    tempfile = util.get_temp_file()
    tm = TempClient(tempfile)
    table = util.get_temp_hist_table()
    dc = DynamoClient(table)
    while (True):
        s_time = time.time()
        tm.refresh()
        temp = tm.get_temp()
        if (tm.has_temp()):
            dc.record_temperature(temp)
        sleep_time = 1 - (time.time() - s_time)
        sleep_time = max(sleep_time, 0.1)
        time.sleep(sleep_time)
Exemple #2
0
from client.temp import TempClient
import util

if __name__ == '__main__':
    tm = TempClient(util.get_temp_file())
    print('has temp? ' + str(tm.has_temp()))
    print(tm.get_temp())