Exemplo n.º 1
0
def get_system_config():
    system_result = subprocess.check_output(SHELL_COMMAND)
    system_config = utils.parse_config_values(system_result)
    config_dict = dict(system_config)
    config_dict['temp_limit'] = utils.celsius_to_fahrenheit(config_dict['temp_limit'])
    config_dict['date'] = datetime.datetime.utcnow()
    return config_dict
def stash_temperature(temperature_value):
    temperature_stash = Stash("indoor_temperature")
    temperature_data = {
        'date': datetime.datetime.utcnow().isoformat(),
        'celsius': temperature_value,
        'fahrenheit': utils.celsius_to_fahrenheit(temperature_value)
    }
    temperature_stash.add(temperature_data)
Exemplo n.º 3
0
def get_system_temp():
    system_result = subprocess.check_output(SHELL_COMMAND)
    celsius_temp = utils.parse_temp_value(system_result)
    fahrenheit_temp = utils.celsius_to_fahrenheit(celsius_temp)
    return {
        'date': datetime.datetime.utcnow(),
        'celsius':celsius_temp, 
        'fahrenheit': fahrenheit_temp
    }
def get_system_temp():
    system_result = subprocess.check_output(SHELL_COMMAND)
    celsius_temp = utils.parse_temp_value(system_result)
    fahrenheit_temp = utils.celsius_to_fahrenheit(celsius_temp)
    current_date = datetime.datetime.utcnow().isoformat()
    return {
        'date': current_date,
        'from': 'Starbug',
        'celsius':celsius_temp, 
        'fahrenheit': fahrenheit_temp
    }
Exemplo n.º 5
0
 def convert(self):
     """ convert the temperature to a different scale """
     print(self.scale)
     print(CELSIUS)
     print(self.scale == CELSIUS)
     if self.scale == CELSIUS:
         return TemperatureReading(celsius_to_fahrenheit(self.temp),
                                   self.date, self.location, FAHRENHEIT)
     else:
         return TemperatureReading(fahrenheit_to_celsius(self.temp),
                                   self.date, self.location, CELSIUS)