I’m getting the following error in the log after upgrading to 0.6.5:
The error didn’t start until this morning. Was working without error last night.
Although its posting data ok and the MPC template output looks ok:
I haven’t modifies my configuration from 0.4.2.
2024-02-12 07:28:09,486 - web_server - INFO - Launching the emhass webserver at: http://0.0.0.0:5000
2024-02-12 07:28:09,486 - web_server - INFO - Home Assistant data fetch will be performed using url: http://supervisor/core/api
2024-02-12 07:28:09,486 - web_server - INFO - The data path is: /share
2024-02-12 07:28:09,488 - web_server - INFO - Using core emhass version: 0.7.6
waitress INFO Serving on http://0.0.0.0:5000
2024-02-12 07:28:28,845 - web_server - INFO - Setting up needed data
2024-02-12 07:28:28,915 - web_server - INFO - Retrieve hass get data method initiated...
2024-02-12 07:28:32,618 - web_server - INFO - Retrieving weather forecast data using method = list
2024-02-12 07:28:32,620 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2024-02-12 07:28:32,620 - web_server - INFO - Retrieve hass get data method initiated...
2024-02-12 07:28:32,628 - web_server - ERROR - The retrieved JSON is empty, check that correct day or variable names are passed
2024-02-12 07:28:32,628 - web_server - ERROR - Either the names of the passed variables are not correct or days_to_retrieve is larger than the recorded history of your sensor (check your recorder settings)
2024-02-12 07:28:32,628 - web_server - ERROR - Exception on /action/naive-mpc-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/web_server.py", line 50, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/command_line.py", line 120, in set_input_data_dict
P_load_forecast = fcst.get_load_forecast(method=optim_conf['load_forecast_method'], set_mix_forecast=True, df_now=df_input_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/forecast.py", line 589, in get_load_forecast
rh.get_data(days_list, var_list)
File "/usr/local/lib/python3.11/dist-packages/emhass/retrieve_hass.py", line 150, in get_data
self.df_final = pd.concat([self.df_final, df_day], axis=0)
^^^^^^
UnboundLocalError: cannot access local variable 'df_day' where it is not associated with a value
2024-02-12 07:28:32,672 - web_server - INFO - Setting up needed data
2024-02-12 07:28:32,674 - web_server - INFO - >> Publishing data...
2024-02-12 07:28:32,674 - web_server - INFO - Publishing data to HASS instance
2024-02-12 07:28:32,690 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = 143
2024-02-12 07:28:32,698 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 467.89
2024-02-12 07:28:32,706 - web_server - INFO - Successfully posted to sensor.p_deferrable0 = 0.0
2024-02-12 07:28:32,714 - web_server - INFO - Successfully posted to sensor.p_deferrable1 = 0.0
2024-02-12 07:28:32,724 - web_server - INFO - Successfully posted to sensor.p_batt_forecast = 324.89
2024-02-12 07:28:32,733 - web_server - INFO - Successfully posted to sensor.soc_batt_forecast = 22.0
2024-02-12 07:28:32,742 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 0.0
2024-02-12 07:28:32,751 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = 6.53
2024-02-12 07:28:32,759 - web_server - INFO - Successfully posted to sensor.optim_status = Optimal
2024-02-12 07:28:32,768 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 0.26
2024-02-12 07:28:32,779 - web_server - INFO - Successfully posted to sensor.unit_prod_price = 0.16
{
"prod_price_forecast": [0.09, 0.07, 0.05, 0.05, 0.04, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.32, 0.33, 0.34, 0.36, 0.36, 0.36, 0.37, 0.43, 0.59, 0.65, 0.75, 1.09, 0.77, 0.4, 0.32, 0.3, 0.15, 0.15, 0.18, 0.18, 0.15, 0.15, 0.15, 0.12, 0.12, 0.1, 0.09, 0.09],
"load_cost_forecast": [0.19, 0.17, 0.15, 0.15, 0.13, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.14, 0.41, 0.42, 0.43, 0.45, 0.45, 0.46, 0.46, 0.53, 0.7, 0.77, 0.88, 1.26, 0.94, 0.54, 0.44, 0.43, 0.26, 0.25, 0.29, 0.28, 0.26, 0.25, 0.26, 0.22, 0.22, 0.2, 0.2, 0.19],
"pv_power_forecast": [800, 993, 1501, 2032, 2498, 2900, 3252, 3536, 3594, 3658, 3736, 3737, 3669, 3595, 3569, 3524, 3341, 3046, 2638, 2176, 1579, 1065, 574, 153, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, 110, 503, 987, 1519, 2039, 2501, 2911, 3252, 3532, 3737, 3819, 3940, 3939, 3872, 3732, 3601, 3382, 2971, 2585, 2232, 1807, 1351, 903, 468, 116, 14, 0, 0, 0, 0, 0, 0, 0, 0],
"prediction_horizon": 41,
"num_def_loads": 2,
"def_total_hours": [2,0],
"P_deferrable_nom": [1300, 1610],
"treat_def_as_semi_cont": [1, 0],
"set_def_constant": [0, 0],
"soc_init": 0.22,
"soc_final": 0.27,
"alpha": 0,
"beta": 1
}
Dayahead also produces an error:
2024-02-12 07:43:40,354 - web_server - INFO - Setting up needed data
2024-02-12 07:43:40,355 - web_server - ERROR - ERROR: The passed data is either not a list or the length is not correct, length should be 48
2024-02-12 07:43:40,355 - web_server - ERROR - Passed type is <class 'list'> and length is 43
2024-02-12 07:43:40,355 - web_server - ERROR - ERROR: The passed data is either not a list or the length is not correct, length should be 48
2024-02-12 07:43:40,355 - web_server - ERROR - Passed type is <class 'list'> and length is 43
2024-02-12 07:43:40,357 - web_server - INFO - Retrieving weather forecast data using method = list
2024-02-12 07:43:40,358 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2024-02-12 07:43:40,358 - web_server - INFO - Retrieve hass get data method initiated...
2024-02-12 07:43:40,365 - web_server - ERROR - The retrieved JSON is empty, check that correct day or variable names are passed
2024-02-12 07:43:40,365 - web_server - ERROR - Either the names of the passed variables are not correct or days_to_retrieve is larger than the recorded history of your sensor (check your recorder settings)
2024-02-12 07:43:40,365 - web_server - ERROR - Exception on /action/dayahead-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/web_server.py", line 50, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/command_line.py", line 91, in set_input_data_dict
P_load_forecast = fcst.get_load_forecast(method=optim_conf['load_forecast_method'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/forecast.py", line 589, in get_load_forecast
rh.get_data(days_list, var_list)
File "/usr/local/lib/python3.11/dist-packages/emhass/retrieve_hass.py", line 150, in get_data
self.df_final = pd.concat([self.df_final, df_day], axis=0)
^^^^^^
UnboundLocalError: cannot access local variable 'df_day' where it is not associated with a value
and the length is only 43 but this template has not changed from functioning 0.4.2?