Same:
2023-11-29 11:00:08,310 - web_server - INFO - Setting up needed data
2023-11-29 11:00:08,312 - web_server - ERROR - ERROR: The passed data is either not a list or the length is not correct, length should be 24
2023-11-29 11:00:08,312 - web_server - ERROR - Passed type is <class 'list'> and length is 11
2023-11-29 11:00:08,312 - web_server - ERROR - ERROR: The passed data is either not a list or the length is not correct, length should be 24
2023-11-29 11:00:08,312 - web_server - ERROR - Passed type is <class 'list'> and length is 11
2023-11-29 11:00:08,315 - web_server - INFO - Retrieving weather forecast data using method = list
2023-11-29 11:00:08,316 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2023-11-29 11:00:08,317 - web_server - INFO - Retrieve hass get data method initiated...
2023-11-29 11:00:08,679 - web_server - ERROR - The retrieved JSON is empty, check that correct day or variable names are passed
2023-11-29 11:00:08,680 - 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)
2023-11-29 11:00:08,680 - web_server - ERROR - Exception on /action/dayahead-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "src/emhass/web_server.py", line 179, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.8/site-packages/emhass-0.5.1-py3.8.egg/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.8/site-packages/emhass-0.5.1-py3.8.egg/emhass/forecast.py", line 585, in get_load_forecast
rh.get_data(days_list, var_list)
File "/usr/local/lib/python3.8/site-packages/emhass-0.5.1-py3.8.egg/emhass/retrieve_hass.py", line 147, in get_data
self.df_final = pd.concat([self.df_final, df_day], axis=0)
UnboundLocalError: local variable 'df_day' referenced before assignment
tested the templates in home assitant.
{{min(24, ((state_attr('sensor.nordpool_kwh_ee_eur_3_10_0', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool_kwh_ee_eur_3_10_0', 'raw_tomorrow') | map(attribute='value') | list)[now().hour:][:24]|list|length))}}
Result: 11
{{((state_attr('sensor.nordpool_kwh_ee_eur_3_05_02', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool_kwh_ee_eur_3_05_02', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] }}
Result:
[
0.157,
0.196,
0.182,
0.3,
0.24,
0.3,
0.3,
0.24,
0.193,
0.167,
0.154
]
{{((state_attr('sensor.nordpool_kwh_ee_eur_3_10_0', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool_kwh_ee_eur_3_10_0', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] }}
Result:
[
0.131,
0.164,
0.152,
0.25,
0.2,
0.25,
0.25,
0.2,
0.161,
0.139,
0.129
]
{{([states('sensor.solcast_pv_forecast_power_now')|int(0)] + state_attr('sensor.solcast_pv_forecast_forecast_today', 'detailedHourly')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',1000)|map('int')|list + state_attr('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedHourly')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',1000)|map('int')|list)| tojson}}
Result:
[
256,
123,
12,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
41,
116,
167,
173,
130,
62,
5,
0,
0,
0,
0,
0,
0,
0,
0
]
Maybe something to do with my config?
# Configuration file for EMHASS
retrieve_hass_conf:
- freq: 60 # The time step to resample retrieved data from hass in minutes
- days_to_retrieve: 2 # We will retrieve data from now and up to days_to_retrieve days
- var_PV: 'sensor.inverter_active_power' # Photovoltaic produced power sensor in Watts
- var_load: 'sensor.power_load_no_var_loads' # Household power consumption sensor in Watts (deferrable loads should be substracted)
- load_negative: False # Set to True if the retrived load variable is negative by convention
- set_zero_min: True # A special treatment for a minimum value saturation to zero. Values below zero are replaced by nans
- var_replace_zero: # A list of retrived variables that we would want to replace nans with zeros
- 'sensor.inverter_active_power'
- var_interp: # A list of retrived variables that we would want to interpolate nan values using linear interpolation
- 'sensor.inverter_active_power'
- 'sensor.power_load_no_var_load'
- method_ts_round: 'nearest' # Set the method for timestamp rounding, options are: first, last and nearest
optim_conf:
- set_use_battery: False # consider a battery storage
- delta_forecast: 1 # days
- num_def_loads: 2
- P_deferrable_nom: # Watts
- 2700.0
- 4000.0
- def_total_hours: # hours
- 4
- 10
- treat_def_as_semi_cont: # treat this variable as semi continuous
- True
- True
- set_def_constant: # set as a constant fixed value variable with just one startup for each 24h
- False
- False
- weather_forecast_method: 'scrapper' # options are 'scrapper' and 'csv'
- load_forecast_method: 'naive' # options are 'csv' to load a custom load forecast from a CSV file or 'naive' for a persistance model
- load_cost_forecast_method: 'hp_hc_periods' # options are 'hp_hc_periods' for peak and non-peak hours contracts and 'csv' to load custom cost from CSV file
- list_hp_periods: # list of different tariff periods (only needed if load_cost_forecast_method='hp_hc_periods')
- period_hp_1:
- start: '02:54'
- end: '15:24'
- period_hp_2:
- start: '17:24'
- end: '20:24'
- load_cost_hp: 0.1907 # peak hours load cost in €/kWh (only needed if load_cost_forecast_method='hp_hc_periods')
- load_cost_hc: 0.1419 # non-peak hours load cost in €/kWh (only needed if load_cost_forecast_method='hp_hc_periods')
- prod_price_forecast_method: 'constant' # options are 'constant' for constant fixed value or 'csv' to load custom price forecast from a CSV file
- prod_sell_price: 0.065 # power production selling price in €/kWh (only needed if prod_price_forecast_method='constant')
- set_total_pv_sell: False # consider that all PV power is injected to the grid (self-consumption with total sell)
- lp_solver: 'PULP_CBC_CMD' # set the name of the linear programming solver that will be used
- lp_solver_path: 'empty' # set the path to the LP solver
- set_nocharge_from_grid: False # avoid battery charging from the grid
- set_nodischarge_to_grid: True # avoid battery discharging to the grid
- set_battery_dynamic: False # add a constraint to limit the dynamic of the battery power in power per time unit
- battery_dynamic_max: 0.9 # maximum dynamic positive power variation in percentage of battery maximum power
- battery_dynamic_min: -0.9 # minimum dynamic negative power variation in percentage of battery maximum power
plant_conf:
- P_grid_max: 10000 # The maximum power that can be supplied by the utility grid in Watts
- module_model: # The PV module model
- 'CSUN_Eurasia_Energy_Systems_Industry_and_Trade_CSUN295_60M'
- inverter_model: # The PV inverter model
- 'Fronius_International_GmbH__Fronius_Primo_5_0_1_208_240__240V_'
- surface_tilt: # The tilt angle of your solar panels
- 30
- surface_azimuth: # The azimuth angle of your PV installation
- 205
- modules_per_string: # The number of modules per string
- 16
- strings_per_inverter: # The number of used strings per inverter
- 1
- Pd_max: 1000 # If your system has a battery (set_use_battery=True), the maximum discharge power in Watts
- Pc_max: 1000 # If your system has a battery (set_use_battery=True), the maximum charge power in Watts
- eta_disch: 0.95 # If your system has a battery (set_use_battery=True), the discharge efficiency
- eta_ch: 0.95 # If your system has a battery (set_use_battery=True), the charge efficiency
- Enom: 5000 # If your system has a battery (set_use_battery=True), the total capacity of the battery stack in Wh
- SOCmin: 0.3 # If your system has a battery (set_use_battery=True), the minimun allowable battery state of charge
- SOCmax: 0.9 # If your system has a battery (set_use_battery=True), the minimun allowable battery state of charge
- SOCtarget: 0.6 # If your system has a battery (set_use_battery=True), the desired battery state of charge at the end of each optimization cycle