def inside_temperature_yesterday():
    """
    Reads the inside temperature from yesterday (last hour).
    It's executed on the day of optimization.
    Variable date must be in the string form '2018-02-25'.
    """
    date = kl.date_now()
    previous_date = kl.previous_date()
    if date == '2018-01-01':
        return 0
    else:
        temperature = dt.energy.select_data_last_hour('inside_temperature',
                                                      previous_date)
        return temperature
def storage_battery_yesterday():
    """
    Reads the battery storage from yesterday (last hour).
    It's executed on the day of optimization.
    Variable date must be in the string form '2018-02-25'.
    """
    date = kl.date_now()
    previous_date = kl.previous_date()
    if date == '2018-01-01':
        return 0
    else:
        storage = dt.energy.select_data_last_hour('storage_battery',
                                                  previous_date)
        if storage is None:
            return 0
        else:
            return storage