def __init__(self, rpi_hw=True): """rpi_hw should be True if running on actual HW""" if not rpi_hw: from mock import Mock global w1temp w1temp = Mock() w1temp.getTempF.return_value = 80 print("Mocking w1temp") print("w1temp.getTempF returns {0}".format(w1temp.getTempF())) FORMAT = "%(asctime)s %(funcName)s:%(thread)d [%(levelname)s] %(message)s" logging.basicConfig(format=FORMAT, level=logging.INFO) self.ideal_temp = DEF_IDEAL_TEMP self.full_open_temp_diff = DEF_FULL_OPEN_TEMP_DIFF self.wx_station = "KBFI" # sleep interval is when window holds a position self.close_sleep_hour = 0 self.close_sleep_minute = 0 self.open_sleep_hour = 10 self.open_sleep_minute = 45 self.sleep_time_ratio = DEF_SLEEP_TIME_RATIO # close time is when the window closes regardless of temp self.close_hour = 5 self.close_minute = 15 # open time is when window returns to automatic mode self.open_hour = 9 self.open_minute = 55 self.window_driver = WindowDriver(STEP_RANGE) self.last_inside_temp = self._getInsideTemp()
def getInsideTemp(): w1temp.initialize1w() tempF = w1temp.getTempF() return tempF
def _getInsideTemp(self): w1temp.initialize1w() tempF = w1temp.getTempF() self.last_inside_temp = tempF return tempF