Hi @davidusb,
Firstly, many thanks for making this addon!
Iām eager to get involved but Iām having a little difficulty and could do with some assistance.
Iām running the latest version of Home Assistant and EMHASS on a raspberry pi 4.
Home Assistant 2023.1.4
Supervisor 2022.12.1
Operating System 9.4
Frontend 20230110.0 - latest
EMHASS: 0.2.23
EMHASS is configured like so
hass_url: http://10.0.0.15:8123
long_lived_token: [redacted]
costfun: profit
optimization_time_step: 30
historic_days_to_retrieve: 2
method_ts_round: nearest
set_total_pv_sell: false
lp_solver: COIN_CMD
lp_solver_path: /usr/bin/cbc
sensor_power_photovoltaics: sensor.pv_power_w
sensor_power_load_no_var_loads: sensor.power_load_no_var_loads
In Home Assistant, I have created the pv_power_w
and power_load_no_var_loads
sensors and verified they have valid data. I can also retrieve this data via a call to the API like this
http://10.0.0.15:8123/api/history/period/2023-01-14?filter_entity_id=sensor.power_load_no_var_loads&minimal_response&significant_changes_only
The EMHASS web server is up and running and I can see the default data that comes with EMHASS. However, when running either optimisations I receive the following error.
[2023-01-14 15:46:52,268] INFO in web_server: EMHASS server online, serving index.html...
[2023-01-14 15:47:08,683] INFO in command_line: Setting up needed data
[2023-01-14 15:47:08,762] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2023-01-14 15:47:08,766] ERROR in app: Exception on /action/perfect-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py", line 3803, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'sensor.power_load_no_var_loads'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 134, in action_call
input_data_dict = set_input_data_dict(config_path, str(config_path.parent), costfun,
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 68, in set_input_data_dict
rh.prepare_data(retrieve_hass_conf['var_load'], load_negative = retrieve_hass_conf['load_negative'],
File "/usr/local/lib/python3.9/dist-packages/emhass/retrieve_hass.py", line 177, in prepare_data
self.df_final[var_load+'_positive'] = self.df_final[var_load]
File "/usr/local/lib/python3.9/dist-packages/pandas/core/frame.py", line 3804, in __getitem__
indexer = self.columns.get_loc(key)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py", line 3805, in get_loc
raise KeyError(key) from err
KeyError: 'sensor.power_load_no_var_loads'
Any thoughts on where I could be going wrong?
Cheers