def save_wind_reading(wind_speed): add_reading_to_dequeue(Wind_Q, wind_speed) now = Now.get() now.Out_Wind_Now = wind_speed now.Out_Wind_Avg = sum(Wind_Q['Q']) / float(len(Wind_Q['Q'])) now.Out_Wind_Max = max(Wind_Q['Q'])
def trigger_sensor_rain(): #Add this to the rain table now = database.Table_Rain(quantity=settings.rainTipAmount, time=datetime.datetime.now()) #Now update the now table now = Now.get() now.Out_Rain_Since_Reset = now.Out_Rain_Since_Reset + settings.rainTipAmount logging.getLogger("thread-rain").info(" rain bucket tipped.")
def save_attic_reading(temp, humid): add_reading_to_dequeue(ATT_Temp_Q, temp) add_reading_to_dequeue(ATT_Humid_Q, humid) now = Now.get() now.Attic_Temp = sum(ATT_Temp_Q['Q']) / float(len(ATT_Temp_Q['Q'])) now.Attic_Humid = sum(ATT_Humid_Q['Q']) / float(len(ATT_Humid_Q['Q'])) logging.getLogger("sensor").debug(" Updated attic sensor data.")
def save_inside_reading(temp, humid): add_reading_to_dequeue(IN_Temp_Q, temp) add_reading_to_dequeue(IN_Humid_Q, humid) now = Now.get() now.In_Temp = sum(IN_Temp_Q['Q']) / float(len(IN_Temp_Q['Q'])) now.In_Humid = sum(IN_Humid_Q['Q']) / float(len(IN_Humid_Q['Q'])) logging.getLogger("sensor").debug(" Updated inside sensor data.")
def save_outside_reading(temp, humid): add_reading_to_dequeue(OUT_Temp_Q, temp) add_reading_to_dequeue(OUT_Humid_Q, humid) now = Now.get() now.Out_Temp = sum(OUT_Temp_Q['Q']) / float(len(OUT_Temp_Q['Q'])) now.Out_Humid = sum(OUT_Humid_Q['Q']) / float(len(OUT_Humid_Q['Q'])) logging.getLogger("sensor").debug(" Updated outside sensor data.")
def save_system_reading(cpu, ram): now = Now.get() now.System_CPU = cpu now.System_RAM = ram logging.getLogger("sensor").debug(" Updated SYSTEM data.")