I had this issue after messing around after a restore after sd-card replacement, both day-ahead and mpc was not working anymore. So I tried upgrading (from 0.10.6 to 0.11.1) without difference. (Addon)
Finally tried passing some dummy load_power_forecast data and all seems working fine.
I looked deeper into my sensor_power_load_no_var_loads template sensor, downloaded its history as .csv (it has just more than 2 days), and found that it has a few entries with “unknown” and “unavailable”. Can this be the cause of the log below? If so, I thought these non-numbers were to be caught and zeroed/interpolated?
INFO - web_server - EMHASS server online, serving index.html...
INFO - web_server - serving configuration.html...
INFO - web_server - Obtaining parameters from config.json:
INFO - web_server - Saved parameters from webserver
INFO - web_server - Passed runtime parameters: {'load_cost_forecast': [0.813, 0.803, 0.786, 0.778, 0.782, 0.779, 0.778, 0.782, 0.798, 0.806, 0.894, 1.139, 0.986, 0.892, 0.89, 0.916, 0.93, 0.927, 0.887, 1.204, 1.312, 1.028, 1.049, 1.041], 'prod_price_forecast': [0.6584, 0.6504, 0.6368, 0.6304, 0.6336, 0.6312, 0.6304, 0.6336, 0.6464, 0.6528, 0.7232, 0.9192, 0.7968, 0.7216, 0.72, 0.7408, 0.752, 0.7496, 0.7176, 0.9712, 1.0576, 0.8304, 0.8472, 0.8408]}
INFO - web_server - >> Setting input data dict
INFO - web_server - Setting up needed data
INFO - web_server - Retrieving weather forecast data using method = scrapper
INFO - web_server - Retrieving data from hass for load forecast using method = naive
INFO - web_server - Retrieve hass get data method initiated...
ERROR - web_server - Exception on /action/dayahead-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 865, 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 325, in action_call
input_data_dict = set_input_data_dict(emhass_conf, costfun,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/command_line.py", line 114, in set_input_data_dict
P_load_forecast = fcst.get_load_forecast(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/forecast.py", line 706, in get_load_forecast
if not rh.get_data(days_list, var_list):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/retrieve_hass.py", line 195, in get_data
.astype(float)
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/generic.py", line 6324, in astype
new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/internals/managers.py", line 451, in astype
return self.apply(
^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/internals/managers.py", line 352, in apply
applied = getattr(b, f)(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/internals/blocks.py", line 511, in astype
new_values = astype_array_safe(values, dtype, copy=copy, errors=errors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/dtypes/astype.py", line 242, in astype_array_safe
new_values = astype_array(values, dtype, copy=copy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/dtypes/astype.py", line 187, in astype_array
values = _astype_nansafe(values, dtype, copy=copy)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/dtypes/astype.py", line 138, in _astype_nansafe
return arr.astype(dtype, copy=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'Unknown'