def update_data():
    profile.inside_temp = str(sensor.get_inside_temp())    
    if profile.lon is not None and profile.lat is not None and profile.connect_button['active']:
        temp, error = outside_data.get_outside_temp(profile.lat, profile.lon)
        profile.weather_api_error = error
        profile.outside_temp = str(temp)
        if profile.set_temperature_preferences_button['active'] and not profile.turn_automatic_mode_on_button['active']:
            profile.turn_automatic_mode_on_button['disabled'] = False
def run_automatic_mode():
    '''
    '''
    while True:
        lock.acquire()
        if not profile.turn_automatic_mode_on_button['active']:
            lock.release()
            break

        outside_temp, error = outside_data.get_outside_temp(profile.lat, profile.lon)
        profile.weather_api_error = error
        inside_temp = sensor.get_inside_temp()
        inside_temp = float(inside_temp)
        outside_temp = float(outside_temp)
        if config.record_temp:
            record_temp(inside_temp, outside_temp)
        cooler_outside = outside_temp < inside_temp - float(profile.temp_margin)
        if cooler_outside and inside_temp > float(profile.min_temp):
            hardware.turn_fan_on()
        else:
            hardware.turn_fan_off()
        lock.release()
        time.sleep(float(profile.min_cycle_time))