davidusb-geek / emhass-add-on Goto Github PK
View Code? Open in Web Editor NEWThe Home Assistant Add-on for EMHASS: Energy Management Optimization for Home Assistant
License: MIT License
The Home Assistant Add-on for EMHASS: Energy Management Optimization for Home Assistant
License: MIT License
I am seeing duplicate lines, one with time stamp and one without for the INFO logging entries.
[2022-05-19 07:31:13,737] INFO in optimization: Total value of the Cost function = -10.1
INFO:web_server:Total value of the Cost function = -10.1
Is it possible to only display each entry once?
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
[2022-05-19 07:30:45,287] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000
[2022-05-19 07:30:45,287] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api
[2022-05-19 07:30:45,288] INFO in web_server: The base path is: /usr/src
[2022-05-19 07:30:45,292] INFO in web_server: Using core emhass version: 0.3.8
[2022-05-19 07:31:06,375] INFO in command_line: Setting up needed data
INFO:web_server:Setting up needed data
[2022-05-19 07:31:06,431] INFO in forecast: Retrieving weather forecast data using method = scrapper
INFO:web_server:Retrieving weather forecast data using method = scrapper
[2022-05-19 07:31:09,662] INFO in forecast: Retrieving data from hass for load forecast using method = naive
INFO:web_server:Retrieving data from hass for load forecast using method = naive
[2022-05-19 07:31:09,663] INFO in retrieve_hass: Retrieve hass get data method initiated...
INFO:web_server:Retrieve hass get data method initiated...
[2022-05-19 07:31:13,392] INFO in web_server: >> Performing naive MPC optimization...
INFO:web_server: >> Performing naive MPC optimization...
[2022-05-19 07:31:13,393] INFO in command_line: Performing naive MPC optimization
INFO:web_server:Performing naive MPC optimization
[2022-05-19 07:31:13,416] INFO in optimization: Perform an iteration of a naive MPC controller
INFO:web_server:Perform an iteration of a naive MPC controller
[2022-05-19 07:31:13,563] WARNING in optimization: Failed LP solve with PULP_CBC_CMD solver, falling back to default Pulp
WARNING:web_server:Failed LP solve with PULP_CBC_CMD solver, falling back to default Pulp
[2022-05-19 07:31:13,616] WARNING in optimization: Failed LP solve with default Pulp solver, falling back to GLPK_CMD
WARNING:web_server:Failed LP solve with default Pulp solver, falling back to GLPK_CMD
[2022-05-19 07:31:13,737] INFO in optimization: Status: Optimal
INFO:web_server:Status: Optimal
[2022-05-19 07:31:13,737] INFO in optimization: Total value of the Cost function = -10.1
INFO:web_server:Total value of the Cost function = -10.1
EMHASS add-on v0.4.2
Home Assistant 2023.10.3
When I use the method=solar.forecast with the parameter "solar_forecast_kwp":5 I get an error. When I use method=scrapper everything is working.
rest_command:
trigger_tibber_forecast:
url: http://localhost:5000/action/dayahead-optim
method: POST
content_type: "application/json"
timeout: 300
payload: >-
{
"load_cost_forecast":{{((state_attr('sensor.total_price_toraldasen_32', 'raw_today') | map(attribute='total_with_gridPrice') | list + state_attr('sensor.total_price_toraldasen_32','raw_today') | map(attribute='total_with_gridPrice') | list))[now().hour:][:24] }},
"prod_price_forecast":{{((state_attr('sensor.energy_price_toraldasen_32', 'raw_today') | map(attribute='total') | list + state_attr('sensor.energy_price_toraldasen_32', 'raw_today') | map(attribute='total') | list))[now().hour:][:24]}},
"def_total_hours":{{states('sensor.list_operating_hours_of_each_deferrable_load')}},
"solar_forecast_kwp":5
}
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
2023-10-21 17:28:36,101 - web_server - INFO - Launching the emhass webserver at: http://0.0.0.0:5000
2023-10-21 17:28:36,101 - web_server - INFO - Home Assistant data fetch will be performed using url: http://supervisor/core/api
2023-10-21 17:28:36,101 - web_server - INFO - The data path is: /share
2023-10-21 17:28:36,102 - web_server - INFO - Using core emhass version: 0.5.1
waitress INFO Serving on http://0.0.0.0:5000
2023-10-21 17:28:48,322 - web_server - INFO - Setting up needed data
2023-10-21 17:28:48,355 - web_server - INFO - Retrieving weather forecast data using method = solar.forecast
2023-10-21 17:28:51,886 - web_server - ERROR - Exception on /action/dayahead-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 852, 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 179, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 89, in set_input_data_dict
df_weather = fcst.get_weather_forecast(method=optim_conf['weather_forecast_method'])
File "/usr/local/lib/python3.9/dist-packages/emhass/forecast.py", line 273, in get_weather_forecast
data_dict = {'ts':list(data_raw['result']['watts'].keys()), 'yhat':list(data_raw['result']['watts'].values())}
TypeError: 'NoneType' object is not subscriptable
Home Assistant 2023.3.6
Supervisor 2023.03.2
Operating System 9.5
Frontend 20230309.1 - latest
Emhass 0.3.7
When the automation starts dayahead-optim or publish-data I get errors about NonExistentTimeError. The time zone I use
2023-03-26 00:45:01,848 - web_server - ERROR - Exception on /action/dayahead-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1799, 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 170, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 64, in set_input_data_dict
fcst = forecast(retrieve_hass_conf, optim_conf, plant_conf,
File "/usr/local/lib/python3.9/dist-packages/emhass/forecast.py", line 160, in __init__
self.forecast_dates = pd.date_range(start=self.start_forecast,
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/extension.py", line 95, in method
result = attr(self._data, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/arrays/datetimelike.py", line 1775, in round
return self._round(freq, RoundTo.NEAREST_HALF_EVEN, ambiguous, nonexistent)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/arrays/datetimelike.py", line 1761, in _round
return result.tz_localize(
File "/usr/local/lib/python3.9/dist-packages/pandas/core/arrays/_mixins.py", line 84, in method
return meth(self, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/arrays/datetimes.py", line 1043, in tz_localize
new_dates = tzconversion.tz_localize_to_utc(
File "pandas/_libs/tslibs/tzconversion.pyx", line 328, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc
pytz.exceptions.NonExistentTimeError: 2023-03-26 02:00:00
5b918bf2_emhass_2023-03-25T23-48-57.328Z.log
version | core-2023.3.6 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
user | root |
virtualenv | false |
python_version | 3.10.10 |
os_name | Linux |
os_version | 5.15.90 |
arch | x86_64 |
timezone | Europe/Oslo |
config_dir | /config |
GitHub API | ok |
---|---|
GitHub Content | ok |
GitHub Web | ok |
GitHub API Calls Remaining | 4953 |
Installed Version | 1.31.0 |
Stage | running |
Available Repositories | 1313 |
Downloaded Repositories | 6 |
logged_in | true |
---|---|
subscription_expiration | October 7, 2023 at 02:00 |
relayer_connected | true |
remote_enabled | true |
remote_connected | true |
alexa_enabled | false |
google_enabled | true |
remote_server | eu-central-1-6.ui.nabu.casa |
can_reach_cert_server | ok |
can_reach_cloud_auth | ok |
can_reach_cloud | ok |
host_os | Home Assistant OS 9.5 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2023.03.2 |
agent_version | 1.4.1 |
docker_version | 20.10.22 |
disk_total | 116.7 GB |
disk_used | 14.3 GB |
healthy | true |
supported | true |
board | generic-x86-64 |
supervisor_api | ok |
version_api | ok |
installed_addons | File editor (5.5.0), SSH & Web Terminal (13.0.3), Mosquitto broker (6.1.3), ESPHome (2023.3.1), Z-Wave JS UI (1.8.0), EMHASS (0.3.7), Frigate (0.11.1) |
dashboards | 1 |
---|---|
resources | 2 |
views | 10 |
mode | storage |
oldest_recorder_run | March 3, 2023 at 16:47 |
---|---|
current_recorder_run | March 26, 2023 at 00:43 |
estimated_db_size | 801.98 MiB |
database_engine | sqlite |
database_version | 3.38.5 |
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
2023-10-30 09:40:51,746 - web_server - INFO - Launching the emhass webserver at: http://0.0.0.0:5000
2023-10-30 09:40:51,746 - web_server - INFO - Home Assistant data fetch will be performed using url: http://supervisor/core/api
2023-10-30 09:40:51,746 - web_server - INFO - The data path is: /share
2023-10-30 09:40:51,747 - web_server - INFO - Using core emhass version: 0.5.1
waitress INFO Serving on http://0.0.0.0:5000
2023-10-30 09:40:58,343 - web_server - INFO - EMHASS server online, serving index.html...
2023-10-30 09:41:00,691 - web_server - INFO - Setting up needed data
2023-10-30 09:41:00,711 - web_server - INFO - Retrieve hass get data method initiated...
2023-10-30 09:41:06,651 - web_server - INFO - >> Performing perfect optimization...
2023-10-30 09:41:06,651 - web_server - INFO - Performing perfect forecast optimization
2023-10-30 09:41:06,653 - web_server - INFO - Perform optimization for perfect forecast scenario
2023-10-30 09:41:06,653 - web_server - INFO - Solving for day: 28-10-2023
2023-10-30 09:41:06,654 - web_server - ERROR - Exception on /action/perfect-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pandas/core/arrays/datetimes.py", line 2446, in _infer_tz_from_endpoints
inferred_tz = timezones.infer_tzinfo(start, end)
File "pandas/_libs/tslibs/timezones.pyx", line 328, in pandas._libs.tslibs.timezones.infer_tzinfo
AssertionError: Inputs must both have the same timezone, pytz.FixedOffset(120) != pytz.FixedOffset(60)
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 1455, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 852, 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 188, in action_call
opt_res = perfect_forecast_optim(input_data_dict, app.logger)
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 199, in perfect_forecast_optim
opt_res = input_data_dict['opt'].perform_perfect_forecast_optim(df_input_data, input_data_dict['days_list'])
File "/usr/local/lib/python3.9/dist-packages/emhass/optimization.py", line 488, in perform_perfect_forecast_optim
data_tp = df_input_data.copy().loc[pd.date_range(start=day_start, end=day_end, freq=self.freq)]
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/datetimes.py", line 1070, in date_range
dtarr = DatetimeArray._generate_range(
File "/usr/local/lib/python3.9/dist-packages/pandas/core/arrays/datetimes.py", line 422, in _generate_range
tz = _infer_tz_from_endpoints(start, end, tz)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/arrays/datetimes.py", line 2449, in _infer_tz_from_endpoints
raise TypeError(
TypeError: Start and end cannot both be tz-aware with different timezones
2023-10-30 09:41:09,586 - web_server - INFO - Setting up needed data
2023-10-30 09:41:09,588 - web_server - INFO - Retrieving weather forecast data using method = scrapper
2023-10-30 09:41:10,325 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2023-10-30 09:41:10,325 - web_server - INFO - Retrieve hass get data method initiated...
2023-10-30 09:41:19,416 - web_server - INFO - >> Performing dayahead optimization...
2023-10-30 09:41:19,416 - web_server - INFO - Performing day-ahead forecast optimization
2023-10-30 09:41:19,418 - web_server - INFO - Perform optimization for the day-ahead
2023-10-30 09:41:19,461 - web_server - INFO - Status: Infeasible
2023-10-30 09:41:19,461 - web_server - INFO - Total value of the Cost function = -87.22
Hi David,
it seems there is something wrong with ARMv7 image.
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 12, in <module>
import pandas as pd
File "/usr/local/lib/python3.9/dist-packages/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "/usr/bin/python3"
* The NumPy version is: "1.22.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libcblas.so.3: cannot open shared object file: No such file or directory
I have a problem determining if this is the solution I need.
I pay for the electricity per hour and the prices get set everyday at 13.00 and from 00.00 to 23.59.
Ac coupled PV system
Ac coupled battery system
everything is connected to HA.
I would like to control the charge/discharge/idle using the following parameters from HA to determine which is best between sell/buy/consume
Hourly rate
Forecast
SOC
for example I have 40% SOC, the forecast will give me 10%, should I charge the batteries with those 10% or is it most affordable to sell them and charge while low price? , I need 70% to ménage all night therefore I will need to charge 20%. When will it be the cheapest time to charge 20% and how long time do I need to charge? Is there other consumers or can I charge at maximum power?
When i want to add the repository for emhass, i get an error message.
<Integration davidusb-geek/emhass> Repository structure for v0.3.21 is not compliant
I try to add the URL: https://github.com/davidusb-geek/emhass
EMHASS 0.4
Home Assistant 2023.10.1
Supervisor 2023.10
System Raspberry Pi4
Raspbian 5.10.107-v71+
Frontend 20231005 - latest
After installing Emhass as addon, I tried to start the server with the default configuration from Supervisor panel.
Changing the configuration in the UI can be done, but saving the configuration after that is not possible.
In the Supervisor logs I find this errors:
23-10-13 10:51:09 ERROR (MainThread) [supervisor.addons.addon] Add-on 5b918bf2_emhass has invalid options: not a valid value. Got {'hass_url': 'empty', 'long_lived_token': 'empty', 'costfun': 'profit', 'logging_level': 'INFO', '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', 'set_nocharge_from_grid': False, 'set_nodischarge_to_grid': False, 'set_battery_dynamic': False, 'battery_dynamic_max': 0.9, 'battery_dynamic_min': -0.9, 'load_forecast_method': 'naive', 'sensor_power_photovoltaics': 'sen... 23-10-13 10:51:09 WARNING (MainThread) [supervisor.addons] Can't start Add-on 5b918bf2_emhass
Even when trying to start the addon in a CLI I get an error:
I am realy looking forward to start using this great project in my home installation, but at the moment I'm out of options to get it working.
EMHASS 0.3.3
Home Assistant 2023.3.3
Supervisor 2023.03.1
Operating System 9.5
Frontend 20230309.0 - latest
Error:
EMHASS not starting:
Log:
/usr/bin/python3: Error while finding module specification for 'emhass.web_server' (ModuleNotFoundError: No module named 'emhass')
Went from version 0.2.9 to 0.3.3, hard restarted Home Assistant device, and EMHASS not starting.
Unsure on next troubleshooting steps?
dayahead optim works, naive-mpc-optim fails:
mark@odroid:~$ curl -i -H "Content-Type: application/json" -X POST -d '{"prod_price_forecast":[0.35, 0.37, 0.37, 0.58, 0.58, 0.37, 0.28, 0.29, 0.26, 0.21, 0.25, 0.2, 0.19, 0.19, 0.19, 0.27, 0.27, 0.26, 0.29, 0.33, 0.58
, 0.57, 0.32, 0.3, 0.2, 0.23, 0.21, 0.15, 0.06, 0.06, 0.06, 0.08, 0.06, 0.1, 0.1, 0.19, 0.21, 0.3, 0.57, 0.37, 0.47, 0.47, 1.05, 0.57, 0.47, 0.47, 0.47, 0.47],"load_cost_forecast":[0.48, 0.51, 0.51, 0.73, 0.73, 0.5, 0.
41, 0.42, 0.39, 0.32, 0.37, 0.31, 0.31, 0.3, 0.31, 0.39, 0.4, 0.39, 0.42, 0.46, 0.73, 0.72, 0.45, 0.42, 0.32, 0.34, 0.33, 0.26, 0.16, 0.16, 0.16, 0.18, 0.16, 0.21, 0.21, 0.3, 0.33, 0.42, 0.72, 0.51, 0.61, 0.61, 1.25, 0.72, 0.61, 0.61, 0.61, 0.61]}' http://localhost:5000/action/dayahead-optim
HTTP/1.1 201 CREATED
Content-Length: 45
Content-Type: text/html; charset=utf-8
Date: Mon, 16 May 2022 10:28:16 GMT
Server: waitress
EMHASS >> Action dayahead-optim executed...
mark@odroid:~$ curl -i -H "Content-Type: application/json" -X POST -d '{"prod_price_forecast":[0.35, 0.37, 0.37, 0.58, 0.58, 0.37, 0.28, 0.29, 0.26, 0.21, 0.25, 0.2, 0.19, 0.19, 0.19, 0.27, 0.27, 0.26, 0.29, 0.33, 0.58, 0.57, 0.32, 0.3, 0.2, 0.23, 0.21, 0.15, 0.06, 0.06, 0.06, 0.08, 0.06, 0.1, 0.1, 0.19, 0.21, 0.3, 0.57, 0.37, 0.47, 0.47, 1.05, 0.57, 0.47, 0.47, 0.47, 0.47],"load_cost_forecast":[0.48, 0.51, 0.51, 0.73, 0.73, 0.5, 0.41, 0.42, 0.39, 0.32, 0.37, 0.31, 0.31, 0.3, 0.31, 0.39, 0.4, 0.39, 0.42, 0.46, 0.73, 0.72, 0.45, 0.42, 0.32, 0.34, 0.33, 0.26, 0.16, 0.16, 0.16, 0.18, 0.16, 0.21, 0.21, 0.3, 0.33, 0.42, 0.72, 0.51, 0.61, 0.61, 1.25, 0.72, 0.61, 0.61, 0.61, 0.61],"prediction_horizon":48,"soc_init":0.17,"soc_final":0.17,"def_total_hours":[4,5,3,1]}' http://localhost:5000/action/naive-mpc-optim
HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Length: 265
Content-Type: text/html; charset=utf-8
Date: Mon, 16 May 2022 10:29:16 GMT
Server: waitress
<!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
[2022-05-16 20:29:05,631] INFO in optimization: Perform optimization for the day-ahead
INFO:web_server:Perform optimization for the day-ahead
[2022-05-16 20:29:05,827] WARNING in optimization: Failed LP solve with PULP_CBC_CMD solver, falling back to default Pulp
WARNING:web_server:Failed LP solve with PULP_CBC_CMD solver, falling back to default Pulp
[2022-05-16 20:29:05,882] WARNING in optimization: Failed LP solve with default Pulp solver, falling back to GLPK_CMD
WARNING:web_server:Failed LP solve with default Pulp solver, falling back to GLPK_CMD
[2022-05-16 20:29:07,268] INFO in optimization: Status: Optimal
INFO:web_server:Status: Optimal
[2022-05-16 20:29:07,269] INFO in optimization: Total value of the Cost function = -15.61
INFO:web_server:Total value of the Cost function = -15.61
[2022-05-16 20:29:07,866] INFO in command_line: Setting up needed data
INFO:web_server:Setting up needed data
[2022-05-16 20:29:07,870] INFO in web_server: >> Publishing data...
INFO:web_server: >> Publishing data...
[2022-05-16 20:29:07,871] INFO in command_line: Publishing data to HASS instance
INFO:web_server:Publishing data to HASS instance
[2022-05-16 20:29:07,919] INFO in retrieve_hass: Successfully posted value in existing entity_id
INFO:web_server:Successfully posted value in existing entity_id
[2022-05-16 20:29:07,952] INFO in retrieve_hass: Successfully posted value in existing entity_id
INFO:web_server:Successfully posted value in existing entity_id
[2022-05-16 20:29:07,984] INFO in retrieve_hass: Successfully posted value in existing entity_id
INFO:web_server:Successfully posted value in existing entity_id
[2022-05-16 20:29:08,020] INFO in retrieve_hass: Successfully posted value in existing entity_id
INFO:web_server:Successfully posted value in existing entity_id
[2022-05-16 20:29:08,058] INFO in retrieve_hass: Successfully posted value in existing entity_id
INFO:web_server:Successfully posted value in existing entity_id
[2022-05-16 20:29:08,092] INFO in retrieve_hass: Successfully posted value in existing entity_id
INFO:web_server:Successfully posted value in existing entity_id
[2022-05-16 20:29:08,116] INFO in retrieve_hass: Successfully posted value in existing entity_id
INFO:web_server:Successfully posted value in existing entity_id
[2022-05-16 20:29:16,077] INFO in command_line: Setting up needed data
INFO:web_server:Setting up needed data
[2022-05-16 20:29:16,089] INFO in forecast: Retrieving weather forecast data using method = scrapper
INFO:web_server:Retrieving weather forecast data using method = scrapper
[2022-05-16 20:29:19,304] INFO in forecast: Retrieving data from hass for load forecast using method = naive
INFO:web_server:Retrieving data from hass for load forecast using method = naive
[2022-05-16 20:29:19,305] INFO in retrieve_hass: Retrieve hass get data method initiated...
INFO:web_server:Retrieve hass get data method initiated...
[2022-05-16 20:29:22,205] INFO in web_server: >> Performing naive MPC optimization...
INFO:web_server: >> Performing naive MPC optimization...
[2022-05-16 20:29:22,205] INFO in command_line: Performing naive MPC optimization
INFO:web_server:Performing naive MPC optimization
[2022-05-16 20:29:22,228] ERROR in app: Exception on /action/naive-mpc-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 136, in action_call
opt_res = naive_mpc_optim(input_data_dict, app.logger)
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 185, in naive_mpc_optim
prediction_horizon = input_data_dict['params']['passed_data']['prediction_horizon']
TypeError: string indices must be integers
ERROR:web_server:Exception on /action/naive-mpc-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 136, in action_call
opt_res = naive_mpc_optim(input_data_dict, app.logger)
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 185, in naive_mpc_optim
prediction_horizon = input_data_dict['params']['passed_data']['prediction_horizon']
TypeError: string indices must be integers
When trying to install add-on the following error occurs:
The command '/bin/bash -o pipefail -c apt-get update && apt-get install -y --no-install-recommends libffi-dev python3 python3-pip python3-dev git build-essential coinor-libcbc-dev coinor-cbc libglpk-dev glpk-utils && pip3 install --no-cache-dir -U setuptools wheel && pip3 install --no-cache-dir -r requirements.txt && apt-get purge -y --auto-remove git build-essential python3-dev && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 159
Home Assistant Supervised.
Supervisor log:
22-04-22 22:23:46 INFO (SyncWorker_1) [supervisor.docker.addon] Starting build for 5b918bf2/aarch64-addon-emhass:0.1.27
22-04-22 22:23:48 ERROR (SyncWorker_1) [supervisor.docker.addon] Can't build 5b918bf2/aarch64-addon-emhass:0.1.27: The command '/bin/bash -o pipefail -c apt-get update && apt-get install -y --no-install-recommends libffi-dev python3 python3-pip python3-dev git build-essential coinor-libcbc-dev coinor-cbc libglpk-dev glpk-utils && pip3 install --no-cache-dir -U setuptools wheel && pip3 install --no-cache-dir -r requirements.txt && apt-get purge -y --auto-remove git build-essential python3-dev && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 159
22-04-22 22:23:48 ERROR (SyncWorker_1) [supervisor.docker.addon] Build log:
Step 1/19 : ARG BUILD_FROM
Step 2/19 : FROM ${BUILD_FROM}
---> 0fb9de056226
Step 3/19 : WORKDIR /usr/src
---> Using cache
---> ee36489385da
Step 4/19 : COPY ./requirements.txt /usr/src/requirements.txt
---> Using cache
---> 2d7e008574d3
Step 5/19 : RUN apt-get update && apt-get install -y --no-install-recommends libffi-dev python3 python3-pip python3-dev git build-essential coinor-libcbc-dev coinor-cbc libglpk-dev glpk-utils && pip3 install --no-cache-dir -U setuptools wheel && pip3 install --no-cache-dir -r requirements.txt && apt-get purge -y --auto-remove git build-essential python3-dev && rm -rf /var/lib/apt/lists/*
---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/arm/v7) and no specific platform was requested
---> Running in 41ebe3254dcd
Removing intermediate container 41ebe3254dcd
Hi,
I'm trying to run EMHASS using Home Assistant add-on - it installs correctly, I can also open User Interface (using default 0.0.0.0 as web_ui_url - when I try ot use my Home Assistant dns name or IP it can't bind to socket)
I configured my own sensors for PV and load without vars and try to run Launch Day-ahead Optimalization - using web ui it try to connect to localhost which is wrong - It should be using relative URL.
I tried to manually run Day-ahead Optimalization by running directly in docker container emhass:
curl -X POST http://localhost:5000/action/dayahead-optim
I got 400 Bad request:
docker exec -it addon_564343f0_emhass bash
root@564343f0-emhass:/# curl -X POST http://localhost:5000/action/dayahead-optim
The browser (or proxy) sent a request that this server could not understand.
How to properly run dayahead?
Logs from add-on:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2022-04-09 23:31:30,237] ERROR in app_server: [{'period_hp_1': [{'start': '02:54'}, {'end': '15:24'}]}, {'period_hp_2': [{'start': ' 17:24'}, {'end': ' 20:24'}]}]
I'd like to use emhass with dynamic electricity prices like they are provided with Tibber, E.ON (german) and others. From 2025 at the latest, electricity suppliers in Germany will be obliged to offer "dynamic electricity tariffs" to end consumers in conjunction with them using smart meters. So this will be an important feature of emhass in the future.
Up to now the config provides "peak hours" and "non-peak hours". With tibber you would have to provide 24 hours which can have an individual pricing for each hour. With other providers there may be prices per 15 minutes, when they correlate to the European spot price market in Germany, France et al. which also use 15 minute slots. These day-ahead-prices are published once a day in the afternoon.
How could it be implemented into the software stack rather smooth?
I believe to have performed all needed configurations, but in the log would expect to see something informing that data is/ was being captured, but I cannot see it.
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
[2022-06-16 16:55:33,466] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000
[2022-06-16 16:55:33,467] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api
[2022-06-16 16:55:33,467] INFO in web_server: The base path is: /usr/src
[2022-06-16 16:55:33,473] INFO in web_server: Using core emhass version: 0.3.17
[2022-06-16 16:55:49,634] INFO in web_server: EMHASS server online, serving index.html...
Am I missing anything? I installed the add-on using Home Assistant UI.
Installed version 0.2.28
on Home Assistant supervised.
Curl output
~ % curl -v http://home-assistant.heaven.za.net:5000
* Trying 10.0.3.14:5000...
* Connected to home-assistant.heaven.za.net (10.0.3.14) port 5000 (#0)
> GET / HTTP/1.1
> Host: home-assistant.heaven.za.net:5000
> User-Agent: curl/7.86.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 500 INTERNAL SERVER ERROR
< Content-Length: 265
< Content-Type: text/html; charset=utf-8
< Date: Tue, 31 Jan 2023 05:12:03 GMT
< Server: waitress
<
<!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
* Connection #0 to host home-assistant.heaven.za.net left intact
Docker logs:
root@home-assistant:/usr/share/hassio/homeassistant# docker logs addon_5b918bf2_emhass
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
[2023-01-31 07:09:05,580] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000
[2023-01-31 07:09:05,580] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api
[2023-01-31 07:09:05,580] INFO in web_server: The data path is: /share
[2023-01-31 07:09:05,581] INFO in web_server: Using core emhass version: 0.3.34
[2023-01-31 07:09:25,026] INFO in web_server: EMHASS server online, serving index.html...
[2023-01-31 07:09:25,030] ERROR in app: Exception on / [GET]
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 121, in index
with open(str(data_path / 'injection_dict.pkl'), "rb") as fid:
FileNotFoundError: [Errno 2] No such file or directory: '/share/injection_dict.pkl'
[2023-01-31 07:09:35,987] INFO in web_server: EMHASS server online, serving index.html...
[2023-01-31 07:09:35,990] ERROR in app: Exception on / [GET]
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 121, in index
with open(str(data_path / 'injection_dict.pkl'), "rb") as fid:
FileNotFoundError: [Errno 2] No such file or directory: '/share/injection_dict.pkl'
[2023-01-31 07:10:06,070] INFO in web_server: EMHASS server online, serving index.html...
[2023-01-31 07:10:06,072] ERROR in app: Exception on / [GET]
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 121, in index
with open(str(data_path / 'injection_dict.pkl'), "rb") as fid:
FileNotFoundError: [Errno 2] No such file or directory: '/share/injection_dict.pkl'
[2023-01-31 07:12:01,351] INFO in web_server: EMHASS server online, serving index.html...
[2023-01-31 07:12:01,353] ERROR in app: Exception on / [GET]
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 121, in index
with open(str(data_path / 'injection_dict.pkl'), "rb") as fid:
FileNotFoundError: [Errno 2] No such file or directory: '/share/injection_dict.pkl'
[2023-01-31 07:12:02,679] INFO in web_server: EMHASS server online, serving index.html...
[2023-01-31 07:12:02,681] ERROR in app: Exception on / [GET]
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 121, in index
with open(str(data_path / 'injection_dict.pkl'), "rb") as fid:
FileNotFoundError: [Errno 2] No such file or directory: '/share/injection_dict.pkl'
[2023-01-31 07:12:03,682] INFO in web_server: EMHASS server online, serving index.html...
[2023-01-31 07:12:03,685] ERROR in app: Exception on / [GET]
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 121, in index
with open(str(data_path / 'injection_dict.pkl'), "rb") as fid:
FileNotFoundError: [Errno 2] No such file or directory: '/share/injection_dict.pkl'
Hi David,
I get a repeating error message during the startup of the add-on.
After reading (and re-reading) the documentation I think I did a correct setup of the add-on parameters in the config page.
Unfortunately I get this error message and have no idea what to do now?
Can you help with this?
Thanks in advance,
Ralf
[2022-09-12 14:57:21,488] INFO in web_server: Launching the emhass webserver at: http://my_local_ip:5000
[2022-09-12 14:57:21,489] INFO in web_server: Home Assistant data fetch will be performed using url: https://my_public_ha_name
[2022-09-12 14:57:21,489] INFO in web_server: The base path is: /usr/src
[2022-09-12 14:57:21,491] INFO in web_server: Using core emhass version: 0.3.18
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 268, in
serve(app, host=web_ui_url, port=port, threads=8)
File "/usr/local/lib/python3.9/dist-packages/waitress/init.py", line 13, in serve
server = _server(app, **kw)
File "/usr/local/lib/python3.9/dist-packages/waitress/server.py", line 78, in create_server
last_serv = TcpWSGIServer(
File "/usr/local/lib/python3.9/dist-packages/waitress/server.py", line 244, in init
self.bind_server_socket()
File "/usr/local/lib/python3.9/dist-packages/waitress/server.py", line 361, in bind_server_socket
self.bind(sockaddr)
File "/usr/local/lib/python3.9/dist-packages/waitress/wasyncore.py", line 396, in bind
return self.socket.bind(addr)
OSError: [Errno 99] Cannot assign requested address
Still having issues with a stable environment.
Followon from here: https://community.home-assistant.io/t/emhass-add-on-an-energy-management-optimization-add-on-for-home-assistant-os-and-supervised/405649/3?u=markpurcell
0.1.24 runs for a little while and then the web server starts returning a 500 Internal Server Error and it looks as if the environment hangs.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
* Serving Flask app 'app_server' (lazy loading)
* Environment: development
* Debug mode: off
* Running on all addresses (0.0.0.0)
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://127.0.0.1:5000
* Running on http://172.30.33.4:5000 (Press CTRL+C to quit)
192.168.86.50 - - [21/Apr/2022 09:55:18] "GET / HTTP/1.1" 200 -
192.168.86.50 - - [21/Apr/2022 09:55:18] "GET /static/style.css HTTP/1.1" 304 -
[2022-04-21 09:55:58,382] WARNING in optimization: Failed LP solve with PULP_CBC_CMD solver, falling back to default Pulp
[2022-04-21 09:55:58,406] WARNING in optimization: Failed LP solve with default Pulp solver, falling back to GLPK_CMD
192.168.86.50 - - [21/Apr/2022 09:56:00] "POST /action/dayahead-optim HTTP/1.1" 200 -
192.168.86.50 - - [21/Apr/2022 09:56:32] "GET / HTTP/1.1" 200 -
192.168.86.50 - - [21/Apr/2022 09:56:32] "GET /static/style.css HTTP/1.1" 304 -
/usr/local/lib/python3.9/dist-packages/emhass/command_line.py:167: FutureWarning:
Passing method to DatetimeIndex.get_loc is deprecated and will raise in a future version. Use index.get_indexer([item], method=...) instead.
[2022-04-21 09:56:54,381] WARNING in command_line: Problem finding DataFrame index, using nearest option as a backup
/usr/local/lib/python3.9/dist-packages/emhass/command_line.py:170: FutureWarning:
Passing method to DatetimeIndex.get_loc is deprecated and will raise in a future version. Use index.get_indexer([item], method=...) instead.
192.168.86.50 - - [21/Apr/2022 09:56:54] "POST /action/publish-data HTTP/1.1" 200 -
192.168.86.50 - - [21/Apr/2022 09:58:30] "GET / HTTP/1.1" 200 -
192.168.86.50 - - [21/Apr/2022 09:58:30] "GET /static/style.css HTTP/1.1" 304 -
[2022-04-21 10:20:54,861] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1526, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1545, in finalize_request
response = self.make_response(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1701, in make_response
raise TypeError(
TypeError: The view function for 'index' did not return a valid response. The function either returned None or ended without a return statement.
192.168.86.50 - - [21/Apr/2022 10:20:54] "GET / HTTP/1.1" 500 -
[2022-04-21 13:03:48,154] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1526, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1545, in finalize_request
response = self.make_response(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1701, in make_response
raise TypeError(
TypeError: The view function for 'index' did not return a valid response. The function either returned None or ended without a return statement.
192.168.86.50 - - [21/Apr/2022 13:03:48] "GET / HTTP/1.1" 500 -
192.168.86.50 - - [21/Apr/2022 13:03:48] "GET /favicon.ico HTTP/1.1" 404 -
[2022-04-21 13:46:41,855] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1526, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1545, in finalize_request
response = self.make_response(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1701, in make_response
raise TypeError(
TypeError: The view function for 'index' did not return a valid response. The function either returned None or ended without a return statement.
192.168.86.50 - - [21/Apr/2022 13:46:41] "GET / HTTP/1.1" 500 -
[2022-04-21 15:25:05,040] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1526, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1545, in finalize_request
response = self.make_response(rv)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1701, in make_response
raise TypeError(
TypeError: The view function for 'index' did not return a valid response. The function either returned None or ended without a return statement.
192.168.86.50 - - [21/Apr/2022 15:25:05] "GET / HTTP/1.1" 500 -
Having just downloaded emhass as an addin under HAOS, now is the best time to note the difficulties I found with getting started. These are little details in what looks like an important tool for improving renewable energy efficiency and these comments are meant to be helpful!
Since some days (27June) I don't have data published (and therefore triggering automations) to the EMHASS UI. When checking the logs I can see data published from recent timestamps.
I applied yesterday the latest EMHASS version, but still no updates.
These are the most recent logs:
2023-07-02 13:50:01,286 - web_server - INFO - >> Publishing data...
2023-07-02 13:50:01,287 - web_server - INFO - Publishing data to HASS instance
2023-07-02 13:50:01,875 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = -1.5
2023-07-02 13:50:01,935 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 2427.52
2023-07-02 13:50:01,995 - web_server - INFO - Successfully posted to sensor.p_deferrable0 = 0.0
2023-07-02 13:50:02,042 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 2429.02
2023-07-02 13:50:02,110 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = -34.4
2023-07-02 13:50:02,163 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 1.0
2023-07-02 13:50:02,307 - web_server - INFO - Successfully posted to sensor.unit_prod_price = 0.0
2023-07-02 13:55:00,998 - web_server - INFO - Setting up needed data
2023-07-02 13:55:01,422 - web_server - INFO - >> Publishing data...
2023-07-02 13:55:01,423 - web_server - INFO - Publishing data to HASS instance
2023-07-02 13:55:01,948 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = -1.5
2023-07-02 13:55:02,002 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 2427.52
2023-07-02 13:55:02,056 - web_server - INFO - Successfully posted to sensor.p_deferrable0 = 0.0
2023-07-02 13:55:02,114 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 2429.02
2023-07-02 13:55:02,198 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = -34.4
2023-07-02 13:55:02,246 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 1.0
2023-07-02 13:55:02,317 - web_server - INFO - Successfully posted to sensor.unit_prod_price = 0.0
2023-07-02 14:00:00,893 - web_server - INFO - Setting up needed data
2023-07-02 14:00:01,586 - web_server - INFO - >> Publishing data...
Home Assistant 2023.3.1
Supervisor 2023.01.1
Operating System 9.5
Frontend 20230302.0 - latest
EMHASS
Current version: 0.3.1
Today I have the emhass addon installed on a Home Assistant Yellow pc. As this is not powerful enough to do emhass optimization, I would like to be able to use an Intel nuc for this.
I have set up hassos on my Intel nuc and installed emhass addon in this Home Assistant instance. In the emhass settings I use the ip for my home assistant yellow pc and token. I also changed to the pv_power sensor and load_power_without_deferral_loads which I use:
hass_url: http://x.x.x.x:8123
token: xxxxxxxxxxxx
pv_power_production: sensor.ecu_current_power
load_power_without_deferral_loads: sensor.power_load_no_var_loads
When I do a Day-ahead optimization from the Intel nuc webpage I get errors about "Variable sensor.power_load_no_var_loads was not found." Is it possible to use emhass addon on another pc to access home assistant sensors?
Emhass log:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
waitress INFO Serving on http://0.0.0.0:5000
The data container dictionary is empty... Please launch an optimization task
Variable sensor.power_load_no_var_loads was not found. This is typically because no data could be retrieved from Home Assistant
Exception on /action/dayahead-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1799, 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 150, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.9/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.9/dist-packages/emhass/forecast.py", line 586, in get_load_forecast
rh.prepare_data(self.retrieve_hass_conf['var_load'], load_negative = self.retrieve_hass_conf['load_negative'],
File "/usr/local/lib/python3.9/dist-packages/emhass/retrieve_hass.py", line 187, in prepare_data
self.df_final.drop([var_load], inplace=True, axis=1)
File "/usr/local/lib/python3.9/dist-packages/pandas/util/_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/frame.py", line 4948, in drop
return super().drop(
File "/usr/local/lib/python3.9/dist-packages/pandas/core/generic.py", line 4279, in drop
obj = obj._drop_axis(labels, axis, level=level, errors=errors)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/generic.py", line 4323, in _drop_axis
new_axis = axis.drop(labels, errors=errors)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py", line 6644, in drop
raise KeyError(f"{list(labels[mask])} not found in axis")
KeyError: "['sensor.power_load_no_var_loads'] not found in axis"
I am using emhass version 0.2.22 addon.
In the configuration I have this config:
Under the form the help text says:
This is a list of comma separated values with a number of elements consistent with the number of deferrable loads defined before. For example 3000, 750
and
A list of comma separated values. For example 5, 8
Hi team
Looking forward to use this add-on, but can't manage to find my inverter (Solax X3 4K) in the PVLIB DB.
Any guidance you can provide? Maybe an alternative (though equivalent) Inverter I can use?
Many thanks
emhass-add-on 0.2.5
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
[2022-05-14 12:01:45,718] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000
[2022-05-14 12:01:45,718] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api
[2022-05-14 12:01:45,718] INFO in web_server: The base path is: /usr/src
[2022-05-14 12:01:45,723] INFO in web_server: Using core emhass version: 0.3.2
[2022-05-14 12:01:58,339] INFO in web_server: EMHASS server online, serving index.html...
INFO:web_server:EMHASS server online, serving index.html...
[2022-05-14 12:01:58,344] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 91, in index
file_loader = PackageLoader('web_server')
File "/usr/local/lib/python3.9/dist-packages/jinja2/loaders.py", line 291, in __init__
import_module(package_name)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'web_server'
ERROR:web_server:Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 91, in index
file_loader = PackageLoader('web_server')
File "/usr/local/lib/python3.9/dist-packages/jinja2/loaders.py", line 291, in __init__
import_module(package_name)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'web_server'
Hassos 2023.2.5
Emhass addon 0.2.29
Home Assistant Yellow
I am trying to pass cost and sell electricity prices from Nordpool addon to emhass.
I am using the shell_command from the emhass documentation:
shell_command:
trigger_nordpool_forecast: "curl -i -H \"Content-Type: application/json\" -X POST -d '{\"load_cost_forecast\":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] }},\"prod_price_forecast\":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24]}}}' http://localhost:5000/action/dayahead-optim"
which outputs this in the Template editor:
Emhass gives no error, but the load_cost_forecast and prod_price_forecast are not updated
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
[2023-03-03 16:59:38,141] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000
[2023-03-03 16:59:38,143] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api
[2023-03-03 16:59:38,143] INFO in web_server: The data path is: /share
[2023-03-03 16:59:38,148] INFO in web_server: Using core emhass version: 0.3.36
[2023-03-03 17:00:00,583] INFO in command_line: Setting up needed data
[2023-03-03 17:00:00,700] INFO in web_server: >> Publishing data...
[2023-03-03 17:00:00,700] INFO in command_line: Publishing data to HASS instance
[2023-03-03 17:00:00,770] INFO in retrieve_hass: Successfully posted to sensor.p_pv_forecast = 60.62
[2023-03-03 17:00:00,807] INFO in retrieve_hass: Successfully posted to sensor.p_load_forecast = 1281.76
[2023-03-03 17:00:00,846] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable0 = 0.0
[2023-03-03 17:00:00,886] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable1 = 0.0
[2023-03-03 17:00:00,922] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable2 = 1450.0
[2023-03-03 17:00:00,961] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable3 = 0.0
[2023-03-03 17:00:00,994] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable4 = 0.0
[2023-03-03 17:00:01,028] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable5 = 0.0
[2023-03-03 17:00:01,061] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable6 = 947.0
[2023-03-03 17:00:01,097] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable7 = 0.0
[2023-03-03 17:00:01,129] INFO in retrieve_hass: Successfully posted to sensor.p_grid_forecast = 3618.14
[2023-03-03 17:00:01,162] INFO in retrieve_hass: Successfully posted to sensor.total_cost_fun_value = -18.05
[2023-03-03 17:00:18,726] INFO in command_line: Setting up needed data
[2023-03-03 17:00:18,731] INFO in forecast: Retrieving weather forecast data using method = scrapper
[2023-03-03 17:00:25,001] INFO in forecast: Retrieving data from hass for load forecast using method = naive
[2023-03-03 17:00:25,009] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2023-03-03 17:00:28,665] INFO in web_server: >> Performing dayahead optimization...
[2023-03-03 17:00:28,665] INFO in command_line: Performing day-ahead forecast optimization
[2023-03-03 17:00:28,700] INFO in optimization: Perform optimization for the day-ahead
[2023-03-03 17:01:13,395] INFO in web_server: EMHASS server online, serving index.html...
[2023-03-03 17:05:00,661] INFO in command_line: Setting up needed data
[2023-03-03 17:05:00,678] INFO in web_server: >> Publishing data...
[2023-03-03 17:05:00,679] INFO in command_line: Publishing data to HASS instance
[2023-03-03 17:05:00,791] INFO in retrieve_hass: Successfully posted to sensor.p_pv_forecast = 60.62
[2023-03-03 17:05:00,855] INFO in retrieve_hass: Successfully posted to sensor.p_load_forecast = 1281.76
[2023-03-03 17:05:00,935] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable0 = 0.0
[2023-03-03 17:05:01,002] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable1 = 0.0
[2023-03-03 17:05:01,062] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable2 = 1450.0
[2023-03-03 17:05:01,118] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable3 = 0.0
[2023-03-03 17:05:01,178] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable4 = 0.0
[2023-03-03 17:05:01,230] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable5 = 0.0
[2023-03-03 17:05:01,290] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable6 = 947.0
[2023-03-03 17:05:01,344] INFO in retrieve_hass: Successfully posted to sensor.p_deferrable7 = 0.0
[2023-03-03 17:05:01,399] INFO in retrieve_hass: Successfully posted to sensor.p_grid_forecast = 3618.14
[2023-03-03 17:05:01,450] INFO in retrieve_hass: Successfully posted to sensor.total_cost_fun_value = -18.05
[2023-03-03 17:10:00,622] INFO in command_line: Setting up needed data
[2023-03-03 17:10:00,630] INFO in web_server: >> Publishing data...
Hassos logs Timed out running command :
Logger: homeassistant.components.shell_command
Source: components/shell_command/__init__.py:83
Integration: Shell Command (documentation, issues)
First occurred: 17:01:18 (1 occurrences)
Last logged: 17:01:18
Timed out running command: `curl -i -H "Content-Type: application/json" -X POST -d '{"load_cost_forecast":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] }},"prod_price_forecast":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24]}}}' http://localhost:5000/action/dayahead-optim`, after: 60s
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/streams.py", line 502, in _wait_for_data
await self._waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/subprocess.py", line 195, in communicate
stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr)
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/shell_command/__init__.py", line 83, in async_service_handler
stdout_data, stderr_data = await asyncio.wait_for(
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
Hassos log:
home-assistant_2023-03-03T16-07-07.463Z.log
Can't install davidusb/image-armv7-emhass:0.2.6: 404 Client Error for http+docker://localhost/v1.41/images/create?tag=0.2.6&fromImage=davidusb%2Fimage-armv7-emhass&platform=linux%2Farm%2Fv7: Not Found ("manifest for davidusb/image-armv7-emhass:0.2.6 not found: manifest unknown: manifest unknown")
Home Assistant OS on Raspberry Pi 4 ( core-2022.5.4)
Home Assistant Supervisor ( Home Assistant OS 7.6)
First, this looks like a gamechanger :-) so many people looking for it.
SO, i installed the Addon today, went to Configuration and set some of my settings.
But after click on "save" i got error warnings.
This is good if there is something wrong, but there are in my eyes "all" fields noted.
Any idea how to solve it? Here the yaml, as i sayed, just a few first changes to my data and will not save.
hass_url: empty OR 192.168.178.55 OR [localhost] OR http://homeassistant.local:8123/ tried all
long_lived_token: >-
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
costfun: self-consumption
logging_level: DEBUG
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
set_nocharge_from_grid: false
set_nodischarge_to_grid: false
set_battery_dynamic: false
battery_dynamic_max: 0.9
battery_dynamic_min: -0.9
load_forecast_method: naive
sensor_power_photovoltaics: sensor.total_dc_power
sensor_power_load_no_var_loads: sensor.load_power
number_of_deferrable_loads: 2
list_nominal_power_of_deferrable_loads:
Thx, Oliver
Upgraded to 0.2.6
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
usage: web_server.py [-h] [--url URL] [--key KEY] [--addon ADDON]
web_server.py: error: unrecognized arguments: --add_on True
Hi, I have a strange problem. As you can see in the following graphics, the states of my deferrables are set always half an hour too early to their value.
Time Step is set to 60 min, it is published every 3 minutes.
Strangely enough the values in the EMHASS UI and also in the attributes of for example sensor.p_deferrable0 are correct:
and still the deferrabeles always start exactly half an hour before the correct time
`Deferrables schedule
the first entry in this list (11:00) changes the state of deferrable0 at 10:30
my automations only reacts to p_deferrables...
so either I have a complete knot in my head or something doesn't fit there
I don't seem to be paassing the now variables correctly.
2022-06-11 06:53:04,172] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2022-06-11 06:53:06,065] ERROR in app: Exception on /action/naive-mpc-optim [POST]
Traceback (most recent call last):
File "/root/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3621, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'sensor.power_load_no_var_loads'
I get the following message when trying to install this add-on. Tried to refresh the repository (deleted and added), but same behaviour
Can't install davidusb/image-armv7-emhass:0.2.19: 404 Client Error for http+docker://localhost/v1.40/images/create?tag=0.2.19&fromImage=davidusb%2Fimage-armv7-emhass&platform=linux%2Farm%2Fv7: Not Found ("manifest for davidusb/image-armv7-emhass:0.2.19 not found: manifest unknown: manifest unknown")
Someone can help? What it say to me? Where do i have to check it?
Current version: 0.4.2
HA at NUK direct
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 319, in
config_hass = response.json()
File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
When I add the URL of the repository (https://github.com/davidusb-geek/emhass) and press "Add" I get the message https://github.com/davidusb-geek/emhass is not a valid add-on repository.
Log message:
Failed to to call /store/repositories - https://github.com/davidusb-geek/emhass is not a valid add-on repository
My hassos pc is a Intel nuc using hardware generic-x86-64.
version | core-2022.6.7 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
user | root |
virtualenv | false |
python_version | 3.9.12 |
os_name | Linux |
os_version | 5.15.45 |
arch | x86_64 |
timezone | Europe/Oslo |
GitHub API | ok |
---|---|
GitHub Content | ok |
GitHub Web | ok |
GitHub API Calls Remaining | 5000 |
Installed Version | 1.25.5 |
Stage | running |
Available Repositories | 1134 |
Downloaded Repositories | 10 |
logged_in | true |
---|---|
subscription_expiration | July 7, 2022 at 02:00 |
relayer_connected | true |
remote_enabled | true |
remote_connected | true |
alexa_enabled | false |
google_enabled | true |
remote_server | eu-west-2-3.ui.nabu.casa |
can_reach_cert_server | ok |
can_reach_cloud_auth | ok |
can_reach_cloud | ok |
component_version | 0.9.43 |
---|---|
reach_easee_cloud | ok |
connected2stream | true |
host_os | Home Assistant OS 8.2 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2022.06.2 |
agent_version | 1.2.1 |
docker_version | 20.10.14 |
disk_total | 916.2 GB |
disk_used | 128.6 GB |
healthy | true |
supported | true |
board | generic-x86-64 |
supervisor_api | ok |
version_api | ok |
installed_addons | ESPHome (2022.3.1), SSH & Web Terminal (11.0.1), Z-Wave JS to MQTT (0.44.0), Mosquitto broker (6.1.2), File editor (5.3.3), AdGuard Home (4.6.0), Frigate NVR (3.1) |
dashboards | 1 |
---|---|
resources | 3 |
views | 11 |
mode | storage |
oldest_recorder_run | July 5, 2022 at 18:24 |
---|---|
current_recorder_run | July 5, 2022 at 20:32 |
estimated_db_size | 357.12 MiB |
database_engine | sqlite |
database_version | 3.34.1 |
I have setup the configuration parameters in the add-on such as:
And when accessing the user interface, none of the options returns a value
I get this in the logs, which I'm not able to understand:
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 135, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 70, in set_input_data_dict
rh.get_data(days_list, var_list,
File "/usr/local/lib/python3.9/dist-packages/emhass/retrieve_hass.py", line 144, in get_data
self.df_final = pd.concat([self.df_final, df_day], axis=0)
UnboundLocalError: local variable 'df_day' referenced before assignment
[2023-02-11 14:09:05,328] INFO in command_line: Setting up needed data
[2023-02-11 14:09:05,341] INFO in forecast: Retrieving weather forecast data using method = scrapper
[2023-02-11 14:09:06,368] INFO in command_line: Setting up needed data
[2023-02-11 14:09:06,381] INFO in web_server: >> Publishing data...
[2023-02-11 14:09:06,381] INFO in command_line: Publishing data to HASS instance
[2023-02-11 14:09:06,383] ERROR in command_line: File not found error, run an optimization task first.
[2023-02-11 14:09:06,384] ERROR in app: Exception on /action/publish-data [POST]
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 139, in action_call
_ = publish_data(input_data_dict, app.logger)
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 290, in publish_data
idx_closest = opt_res_latest.index.get_indexer([now_precise], method='nearest')[0]
UnboundLocalError: local variable 'opt_res_latest' referenced before assignment
[2023-02-11 14:09:12,936] INFO in forecast: Retrieving data from hass for load forecast using method = naive
[2023-02-11 14:09:12,940] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2023-02-11 14:09:13,012] ERROR in retrieve_hass: The retrieved JSON is empty, check that correct day or variable names are passed
[2023-02-11 14:09:13,013] ERROR in retrieve_hass: 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-02-11 14:09:13,014] ERROR in app: Exception on /action/dayahead-optim [POST]
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 135, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 83, in set_input_data_dict
P_load_forecast = fcst.get_load_forecast(method=optim_conf['load_forecast_method'])
File "/usr/local/lib/python3.9/dist-packages/emhass/forecast.py", line 538, in get_load_forecast
rh.get_data(days_list, var_list)
File "/usr/local/lib/python3.9/dist-packages/emhass/retrieve_hass.py", line 144, in get_data
self.df_final = pd.concat([self.df_final, df_day], axis=0)
UnboundLocalError: local variable 'df_day' referenced before assignment
[2023-02-11 14:10:00,550] INFO in command_line: Setting up needed data
[2023-02-11 14:10:00,563] INFO in web_server: >> Publishing data...
[2023-02-11 14:10:00,563] INFO in command_line: Publishing data to HASS instance
[2023-02-11 14:10:00,564] ERROR in command_line: File not found error, run an optimization task first.
[2023-02-11 14:10:00,566] ERROR in app: Exception on /action/publish-data [POST]
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 139, in action_call
_ = publish_data(input_data_dict, app.logger)
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 290, in publish_data
idx_closest = opt_res_latest.index.get_indexer([now_precise], method='nearest')[0]
UnboundLocalError: local variable 'opt_res_latest' referenced before assignment
[2023-02-11 14:13:53,649] INFO in web_server: EMHASS server online, serving index.html...
[2023-02-11 14:13:53,672] WARNING in web_server: The data container dictionary is empty... Please launch an optimization task
[2023-02-11 14:13:54,959] INFO in command_line: Setting up needed data
[2023-02-11 14:13:54,973] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2023-02-11 14:13:55,045] ERROR in retrieve_hass: The retrieved JSON is empty, check that correct day or variable names are passed
[2023-02-11 14:13:55,046] ERROR in retrieve_hass: 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-02-11 14:13:55,047] ERROR in app: Exception on /action/perfect-optim [POST]
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 135, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 70, in set_input_data_dict
rh.get_data(days_list, var_list,
File "/usr/local/lib/python3.9/dist-packages/emhass/retrieve_hass.py", line 144, in get_data
self.df_final = pd.concat([self.df_final, df_day], axis=0)
UnboundLocalError: local variable 'df_day' referenced before assignment
Emhass-add-om 0.2.5
Iterates and gets stuck with:
WARNING:waitress.queue:Task queue depth is 4
With ever increasing depths.
INFO:web_server:Perform optimization for the day-ahead
[2022-05-14 12:18:07,721] WARNING in optimization: Failed LP solve with PULP_CBC_CMD solver, falling back to default Pulp
WARNING:web_server:Failed LP solve with PULP_CBC_CMD solver, falling back to default Pulp
[2022-05-14 12:18:07,764] WARNING in optimization: Failed LP solve with default Pulp solver, falling back to GLPK_CMD
WARNING:web_server:Failed LP solve with default Pulp solver, falling back to GLPK_CMD
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 2
WARNING:waitress.queue:Task queue depth is 3
WARNING:waitress.queue:Task queue depth is 4
WARNING:waitress.queue:Task queue depth is 5
WARNING:waitress.queue:Task queue depth is 6
WARNING:waitress.queue:Task queue depth is 7
WARNING:waitress.queue:Task queue depth is 8
WARNING:waitress.queue:Task queue depth is 9
Upgraded to 0.2.0
Add-on fails to start:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 189, in <module>
opt_res = pd.read_csv('/app/data/opt_res_dayahead_latest.csv', index_col='timestamp')
File "/root/.local/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "/root/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 680, in read_csv
return _read(filepath_or_buffer, kwds)
File "/root/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 575, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/root/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 933, in __init__
self._engine = self._make_engine(f, self.engine)
File "/root/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1217, in _make_engine
self.handles = get_handle( # type: ignore[call-overload]
File "/root/.local/lib/python3.9/site-packages/pandas/io/common.py", line 789, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: '/app/data/opt_res_dayahead_latest.csv'
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
Hi David,
I'm encountering this behaviour from EMHASS:
[2022-09-14 14:07:47,182] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000
[2022-09-14 14:07:47,182] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api
[2022-09-14 14:07:47,182] INFO in web_server: The base path is: /usr/src
[2022-09-14 14:07:47,183] INFO in web_server: Using core emhass version: 0.3.18
[2022-09-14 14:08:08,988] INFO in web_server: EMHASS server online, serving index.html...
[2022-09-14 14:08:30,780] INFO in command_line: Setting up needed data
[2022-09-14 14:08:30,811] INFO in forecast: Retrieving weather forecast data using method = scrapper
[2022-09-14 14:08:34,036] INFO in forecast: Retrieving data from hass for load forecast using method = naive
[2022-09-14 14:08:34,036] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2022-09-14 14:08:34,051] ERROR in retrieve_hass: The retrieved JSON is empty, check that correct day or variable names are passed
[2022-09-14 14:08:34,051] ERROR in retrieve_hass: 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)
[2022-09-14 14:08:34,051] ERROR in app: Exception on /action/dayahead-optim [POST]
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 77, in set_input_data_dict
P_load_forecast = fcst.get_load_forecast(method=optim_conf['load_forecast_method'])
File "/usr/local/lib/python3.9/dist-packages/emhass/forecast.py", line 495, in get_load_forecast
rh.get_data(days_list, var_list)
File "/usr/local/lib/python3.9/dist-packages/emhass/retrieve_hass.py", line 130, in get_data
self.df_final = pd.concat([self.df_final, df_day], axis=0)
UnboundLocalError: local variable 'df_day' referenced before assignment
As my sensor for the load of the house without the deferrable load is only a calculated value and the update frequency of my energy sensor and the pv don't match I sometimes have negative values for the currently used power. Could this affect the EMHASS?
I'm also waiting for the implementation of the solcast values in the add-on to have the right values for my specific installation of the solar panels (installed on both sides of the house, 40% east, 60% west).
Just to mention, it looks like EMHASS is not at the right day (the graphs are showing dates as of April this year). Is this a config error?
Thanks for looking into that. If you need more data or config just send a message.
Thanks
Ralf
Hello,
I'm very interested in the EMHASS Add-on for efficiently charging my home-batteries via my PV-System en when the energy prices are low directly from the Grid. Also I want to sell excessive energy back to the grid to make the ROI of my Battery system as short as possible.
I have read the EMHASS documentation and installed the EMHASS add-on. I’m using a dedicated NUC running HASSIO.
I also have installed the Nordpool integration showing the RAW-Data for today and tomorrow. I renamed this as suggested in “nordpool”. I entered the curl commands in my configuration.yaml file as described.
When starting up HA the EMHASS log is showing as follows:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
[2023-02-28 18:30:29,180] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000
[2023-02-28 18:30:29,181] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api
[2023-02-28 18:30:29,181] INFO in web_server: The data path is: /share
[2023-02-28 18:30:29,183] INFO in web_server: Using core emhass version: 0.3.36
[2023-02-28 18:32:12,574] INFO in web_server: EMHASS server online, serving index.html...
[2023-02-28 18:32:27,495] INFO in command_line: Setting up needed data
[2023-02-28 18:32:27,614] INFO in forecast: Retrieving weather forecast data using method = scrapper
[2023-02-28 18:32:30,176] INFO in forecast: Retrieving data from hass for load forecast using method = naive
[2023-02-28 18:32:30,177] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2023-02-28 18:32:30,797] INFO in web_server: EMHASS server online, serving index.html...
[2023-02-28 18:32:32,487] INFO in web_server: >> Performing dayahead optimization...
[2023-02-28 18:32:32,487] INFO in command_line: Performing day-ahead forecast optimization
[2023-02-28 18:32:32,494] INFO in optimization: Perform optimization for the day-ahead
[2023-02-28 18:32:32,738] INFO in optimization: Status: Optimal
[2023-02-28 18:32:32,739] INFO in optimization: Total value of the Cost function = -16.5
[2023-02-28 18:53:28,100] INFO in web_server: EMHASS server online, serving index.html...
[2023-02-28 18:54:09,069] INFO in web_server: EMHASS server online, serving index.html...
[2023-02-28 18:54:18,048] INFO in command_line: Setting up needed data
[2023-02-28 18:54:18,050] INFO in forecast: Retrieving weather forecast data using method = scrapper
[2023-02-28 18:54:19,274] INFO in forecast: Retrieving data from hass for load forecast using method = naive
[2023-02-28 18:54:19,275] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2023-02-28 18:54:20,616] INFO in web_server: >> Performing dayahead optimization...
[2023-02-28 18:54:20,616] INFO in command_line: Performing day-ahead forecast optimization
[2023-02-28 18:54:20,623] INFO in optimization: Perform optimization for the day-ahead
[2023-02-28 18:54:20,748] INFO in optimization: Status: Optimal
[2023-02-28 18:54:20,749] INFO in optimization: Total value of the Cost function = -16.5
[2023-02-28 18:54:39,450] INFO in web_server: EMHASS server online, serving index.html...
When running the EMHASS UI I get an updated optimization proposal graph and table but NOT with the energy prices as listed in the nordpool RAW-Data.
index | P_PV | P_Load | P_deferrable0 | P_deferrable1 | P_deferrable2 | P_deferrable3 | P_grid_pos | P_grid_neg | P_grid | unit_load_cost | unit_prod_price | cost_profit | cost_fun_profit |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2023-02-28 19:00:00+01:00 | -1.500000 | 3.033833 | 0.0 | 0.0 | 0.0 | 7000.0 | 7004.533800 | 0.000000 | 7004.533800 | 0.1419 | 0.065 | -0.496972 | -0.496972 |
2023-02-28 19:30:00+01:00 | -1.500000 | 2.812722 | 0.0 | 1000.0 | 0.0 | 7000.0 | 8004.312700 | 0.000000 | 8004.312700 | 0.1419 | 0.065 | -0.567906 | -0.567906 |
2023-02-28 20:00:00+01:00 | -1.500000 | 1.527500 | 0.0 | 0.0 | 5000.0 | 0.0 | 5003.027500 | 0.000000 | 5003.027500 | 0.1419 | 0.065 | -0.354965 | -0.354965 |
2023-02-28 20:30:00+01:00 | -1.500000 | 1.086444 | 0.0 | 1000.0 | 5000.0 | 0.0 | 6002.586400 | 0.000000 | 6002.586400 | 0.1419 | 0.065 | -0.425884 | -0.425884 |
2023-02-28 21:00:00+01:00 | -1.500000 | 1.440833 | 0.0 | 0.0 | 0.0 | 7000.0 | 7002.940800 | 0.000000 | 7002.940800 | 0.1419 | 0.065 | -0.496859 | -0.496859 |
2023-02-28 21:30:00+01:00 | -1.500000 | 1.079778 | 0.0 | 0.0 | 0.0 | 7000.0 | 7002.579800 | 0.000000 | 7002.579800 | 0.1419 | 0.065 | -0.496833 | -0.496833 |
2023-02-28 22:00:00+01:00 | -1.500000 | 3.068222 | 0.0 | 0.0 | 0.0 | 7000.0 | 7004.568200 | 0.000000 | 7004.568200 | 0.1419 | 0.065 | -0.496974 | -0.496974 |
2023-02-28 22:30:00+01:00 | -1.500000 | 2.724111 | 0.0 | 0.0 | 5000.0 | 0.0 | 5004.224100 | 0.000000 | 5004.224100 | 0.1419 | 0.065 | -0.355050 | -0.355050 |
I probably miss something simples but after looking for many hours I hope that somebody could help me out here.
I just started using Home assistant so Im not so experienced yet in HA so any guidance is more then welcome.
Best regards,
Pieter
Upgrade/ Fresh install to 0.2.1 fails:
2022-05-13 21:53:01 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/5b918bf2_emhass/stats - Container addon_5b918bf2_emhass is not running
2022-05-13 21:53:01 ERROR (MainThread) [homeassistant.components.hassio] Failed to to call /addons/5b918bf2_emhass/stats - Container addon_5b918bf2_emhass is not running
Trying to run the ML Forecast model for my water sensor as per the steps here: https://community.home-assistant.io/t/machine-learning-models-for-time-series-forecast/546289 and getting an error after clicking on “ML forecast model fit”
This is my config:
hass_url: empty
long_lived_token: empty
costfun: cost
logging_level: DEBUG
optimization_time_step: 30
historic_days_to_retrieve: 7
method_ts_round: nearest
set_total_pv_sell: false
lp_solver: COIN_CMD
lp_solver_path: /usr/bin/cbc
set_nocharge_from_grid: false
set_nodischarge_to_grid: false
set_battery_dynamic: false
battery_dynamic_max: 0.9
battery_dynamic_min: -0.9
load_forecast_method: naive
sensor_power_photovoltaics: sensor.solax_pv_energy
sensor_power_load_no_var_loads: sensor.agua_streamlabs
number_of_deferrable_loads: 2
list_nominal_power_of_deferrable_loads:
- nominal_power_of_deferrable_loads: 3000
- nominal_power_of_deferrable_loads: 750
list_operating_hours_of_each_deferrable_load:
- operating_hours_of_each_deferrable_load: 5
- operating_hours_of_each_deferrable_load: 8
list_peak_hours_periods_start_hours:
- peak_hours_periods_start_hours: "05:54"
- peak_hours_periods_start_hours: "07:00"
list_peak_hours_periods_end_hours:
- peak_hours_periods_end_hours: "09:24"
- peak_hours_periods_end_hours: "09:55"
list_treat_deferrable_load_as_semi_cont:
- treat_deferrable_load_as_semi_cont: true
- treat_deferrable_load_as_semi_cont: true
load_peak_hours_cost: 0.1907
load_offpeak_hours_cost: 0.1419
photovoltaic_production_sell_price: 0.065
maximum_power_from_grid: 9000
list_pv_module_model:
- pv_module_model: CSUN_Eurasia_Energy_Systems_Industry_and_Trade_CSUN295_60M
list_pv_inverter_model:
- pv_inverter_model: Fronius_International_GmbH__Fronius_Primo_5_0_1_208_240__240V_
list_surface_tilt:
- surface_tilt: 30
list_surface_azimuth:
- surface_azimuth: 205
list_modules_per_string:
- modules_per_string: 16
list_strings_per_inverter:
- strings_per_inverter: 1
set_use_battery: false
battery_discharge_power_max: 1000
battery_charge_power_max: 1000
battery_discharge_efficiency: 0.95
battery_charge_efficiency: 0.95
battery_nominal_energy_capacity: 5000
battery_minimum_state_of_charge: 0.3
battery_maximum_state_of_charge: 0.9
battery_target_state_of_charge: 0.6
I get the following in EMHASS log:
2023-10-18 15:27:44,328 - 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-10-18 15:27:44,331 - web_server - ERROR - Exception on /action/forecast-model-fit [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1469, 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 179, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 146, in set_input_data_dict
rh.get_data(days_list, var_list)
File "/usr/local/lib/python3.9/dist-packages/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
I have data recorded for the last 7 days:
Any idea what the issue could be?
Disclaimer: This could be a user issue!
EMHASS Add-on installed via Addon Store on HA OS running on a VM
Added this info config YAML
shell_command:
dayahead_optim: "curl -i -H "Content-Type: application/json" -X POST -d '{}' http://localhost:5000/action/dayahead-optim"
publish_data: "curl -i -H "Content-Type: application/json" -X POST -d '{}' http://localhost:5000/action/publish-data "
Automations in place to call these.
Run the automation, I can observe via web http://HA:5000 that the optimisation process has run.
unsure on how to check if publish worked
Entities show sensor.p_...... show historical values. When I run a simple APEX card for 24 hours in future, there is no data.
I use Apex cards for other data, future dated, works OK (non EMHASS related).
I have not created the /home/user/emhass/..... (I cant get to shell of the HA).
questions:
I'm trying to configure emhass on my home assistant installation running on a Raspberry Pi 4 rpi4-64.
I'll get errors when using my selected pv_module and pv_inverter. Maybe I don't apply the right number of _? or is there a bug?
I figured out which pv-module is most similar to my panels (as my panels from Bauer are not listed in the csv file), so I choose:
Vietnam Sunergy Joint Stock Company VSUN380-120BMH
Same for the inverter, but luckily the vendor exist, only diff is that my inverter is a 4.6KTL:
Huawei Technologies Co Ltd : SUN2000-5KTL-USL0 [240V]
When applying config, starting emhass and launching day-ahead optimization I get following log entries:
s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun emhass (no readiness notification) s6-rc: info: service legacy-services successfully started [2022-07-27 23:23:23,463] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000 [2022-07-27 23:23:23,464] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api [2022-07-27 23:23:23,466] INFO in web_server: The base path is: /usr/src [2022-07-27 23:23:23,474] INFO in web_server: Using core emhass version: 0.3.17 [2022-07-27 23:23:32,087] INFO in web_server: EMHASS server online, serving index.html... [2022-07-27 23:24:21,390] INFO in command_line: Setting up needed data [2022-07-27 23:24:21,479] INFO in forecast: Retrieving weather forecast data using method = scrapper [2022-07-27 23:24:24,611] ERROR in app: Exception on /action/dayahead-optim [POST] Traceback (most recent call last): File "/root/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3621, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'Vietnam_Sunergy_Joint_Stock_Company_VSUN380_120BMH' 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 2077, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1525, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1523, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1509, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.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 76, in set_input_data_dict P_PV_forecast = fcst.get_power_from_weather(df_weather) File "/usr/local/lib/python3.9/dist-packages/emhass/forecast.py", line 317, in get_power_from_weather module = cec_modules[self.plant_conf['module_model'][i]] File "/root/.local/lib/python3.9/site-packages/pandas/core/frame.py", line 3505, in __getitem__ indexer = self.columns.get_loc(key) File "/root/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3623, in get_loc raise KeyError(key) from err KeyError: 'Vietnam_Sunergy_Joint_Stock_Company_VSUN380_120BMH'
When replacing the pv-module name in the config with the documentation example:
CSUN_Eurasia_Energy_Systems_Industry_and_Trade_CSUN295_60M
I'll get this:
s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun emhass (no readiness notification) s6-rc: info: service legacy-services successfully started [2022-07-27 23:34:08,710] INFO in web_server: Launching the emhass webserver at: http://0.0.0.0:5000 [2022-07-27 23:34:08,710] INFO in web_server: Home Assistant data fetch will be performed using url: http://supervisor/core/api [2022-07-27 23:34:08,711] INFO in web_server: The base path is: /usr/src [2022-07-27 23:34:08,718] INFO in web_server: Using core emhass version: 0.3.17 [2022-07-27 23:34:21,858] INFO in web_server: EMHASS server online, serving index.html... [2022-07-27 23:34:33,264] INFO in command_line: Setting up needed data [2022-07-27 23:34:33,353] INFO in forecast: Retrieving weather forecast data using method = scrapper [2022-07-27 23:34:35,533] ERROR in app: Exception on /action/dayahead-optim [POST] Traceback (most recent call last): File "/root/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3621, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 163, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'Huawei_Technologies_Co_Ltd___SUN2000_5KTL_USL0__240V_' 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 2077, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1525, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1523, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1509, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.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 76, in set_input_data_dict P_PV_forecast = fcst.get_power_from_weather(df_weather) File "/usr/local/lib/python3.9/dist-packages/emhass/forecast.py", line 318, in get_power_from_weather inverter = cec_inverters[self.plant_conf['inverter_model'][i]] File "/root/.local/lib/python3.9/site-packages/pandas/core/frame.py", line 3505, in __getitem__ indexer = self.columns.get_loc(key) File "/root/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3623, in get_loc raise KeyError(key) from err KeyError: 'Huawei_Technologies_Co_Ltd___SUN2000_5KTL_USL0__240V_'
Hello ,
i tried to add the emhass repository to my HA but it failed with error: No valid repository
https://github.com/davidusb-geek/emhass.git
Please can you help with this issue?
Many thanks
Actually only runs for 8 hours if the optimization_time_step is set to 60 minutes
If optimization_time_step is 30 minutes, setting operating_hours variable to 8 only schedules 8 x 30 min blocks, ie four hours.
I've setup the solcast integration, with which I have the following for sensor.solcast_24hrs_forecast:
[3367, 3430, 3443, 3428, 3342, 3206, 3022, 2782, 2486, 2151, 1776, 1372, 959, 523, 214, 80, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 50, 167, 348, 606, 903, 1206, 1501, 1790, 2060, 2333, 2601, 2775]
I've setup the following shell_command:
mpc_optim: "curl -i -H \"Content-Type: application/json\" -X POST -d '{\"pv_power_forecast\":{{states('sensor.solcast_24hrs_forecast')}}}' http://localhost:5000/action/naive-mpc-optim"
Which returned the following error when it ran:
Logger: homeassistant.components.shell_command
Source: components/shell_command/__init__.py:86
Integration: Shell Command (documentation, issues)
First occurred: 12:53:05 (1 occurrences)
Last logged: 12:53:05
Timed out running command: `curl -i -H "Content-Type: application/json" -X POST -d '{"pv_power_forecast":{{states('sensor.solcast_24hrs_forecast')}}}' http://localhost:5000/action/naive-mpc-optim`, after: 60s
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/shell_command/__init__.py", line 87, in async_service_handler
stdout_data, stderr_data = await process.communicate()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/subprocess.py", line 198, in communicate
stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/subprocess.py", line 178, in _read_stream
output = await stream.read()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/streams.py", line 683, in read
block = await self.read(self._limit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/streams.py", line 690, in read
await self._wait_for_data('read')
File "/usr/local/lib/python3.11/asyncio/streams.py", line 522, in _wait_for_data
await self._waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/shell_command/__init__.py", line 86, in async_service_handler
async with async_timeout.timeout(COMMAND_TIMEOUT):
File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 129, in __aexit__
self._do_exit(exc_type)
File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 212, in _do_exit
raise asyncio.TimeoutError
TimeoutError
Evening,
When posting my own pv_forecast with mpc_opt.
I get a valid optimisation, which is unable to be published??
mark@odroid:~$ curl -i -H "Content-Type: application/json" -X POST -d '{"load_cost_forecast":[0.5, 0.52, 0.55, 0.51, 0.44, 0.43, 0.43, 0.43, 0.43, 0.43, 0.42, 0.39, 0.24, 0.21, 0.17, 0.24, 0.24, 0.42, 0.44, 0.72, 0.77, 0.7, 0.61, 0.42, 0.52, 0.49, 0.49, 0.43, 0.43, 0.31, 0.21, 0.2, 0.17, 0.36, 0.43, 0.43, 0.43, 0.44, 0.53, 0.64, 0.72, 1.66, 1.3, 0.9, 0.72, 0.65, 0.64, 0.63], "prod_price_forecast":[0.37, 0.39, 0.42, 0.38, 0.31, 0.31, 0.31, 0.31, 0.3, 0.31, 0.29, 0.27, 0.13, 0.11, 0.06, 0.13, 0.13, 0.3, 0.31, 0.57, 0.61, 0.55, 0.46, 0.3, 0.38, 0.35, 0.36, 0.31, 0.31, 0.19, 0.1, 0.1, 0.06, 0.24, 0.31, 0.31, 0.31, 0.31, 0.39, 0.5, 0.57, 1.42, 1.1, 0.73, 0.57, 0.5, 0.5, 0.48], "pv_power_forecast":[-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 204, 361, 571, 1008, 1497, 2130, 2532, 2947, 2823, 2603, 2246, 1909, 1835, 1730, 1458, 1184, 824, 473, 309, 74, 0, 0, 0, 0, 0, 0], "prediction_horizon":48,"soc_init":0.28,"soc_final":0.05,"def_total_hours":[4,1,0,0]}' http://localhost:5000/action/naive-mpc-optim
HTTP/1.1 201 CREATED
Content-Length: 46
Content-Type: text/html; charset=utf-8
Date: Sun, 05 Jun 2022 11:01:10 GMT
Server: waitress
EMHASS >> Action naive-mpc-optim executed...
mark@odroid:~$
index | P_PV | P_Load | P_deferrable0 | P_deferrable1 | P_deferrable2 | P_deferrable3 | P_grid_pos | P_grid_neg | P_grid | P_batt | SOC_opt | unit_load_cost | unit_prod_price | cost_profit | cost_fun_profit
-- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --
2022-06-05 21:00:00+10:00 | -9 | 1946.845714 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 1955.845700 | 0.203749 | 0.50 | 0.37 | -0.000000 | -0.000000
2022-06-05 21:30:00+10:00 | 0 | 708.769697 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 708.769700 | 0.176116 | 0.52 | 0.39 | -0.000000 | -0.000000
2022-06-05 22:00:00+10:00 | 0 | 333.208633 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 333.208630 | 0.163126 | 0.55 | 0.42 | -0.000000 | -0.000000
2022-06-05 22:30:00+10:00 | 0 | 314.302158 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 314.302160 | 0.150872 | 0.51 | 0.38 | -0.000000 | -0.000000
2022-06-05 23:00:00+10:00 | 0 | 317.472441 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 317.472440 | 0.138495 | 0.44 | 0.31 | -0.000000 | -0.000000
2022-06-05 23:30:00+10:00 | 0 | 249.879433 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 249.879430 | 0.128753 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 00:00:00+10:00 | 0 | 350.214286 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 350.214290 | 0.115100 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 00:30:00+10:00 | 0 | 273.406015 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 273.406020 | 0.104441 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 01:00:00+10:00 | 0 | 304.934307 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 304.934310 | 0.092552 | 0.43 | 0.30 | -0.000000 | -0.000000
2022-06-06 01:30:00+10:00 | 0 | 251.008264 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 251.008260 | 0.082766 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 02:00:00+10:00 | 0 | 310.043478 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 310.043480 | 0.070679 | 0.42 | 0.29 | -0.000000 | -0.000000
2022-06-06 02:30:00+10:00 | 0 | 302.710280 | 0.0 | 0.0 | 0.0 | 0.0 | 302.71028 | 0.00000 | 302.71028 | 0.000000 | 0.070679 | 0.39 | 0.27 | -0.059029 | -0.059029
2022-06-06 03:00:00+10:00 | 0 | 256.774194 | 1500.0 | 0.0 | 0.0 | 0.0 | 6756.77420 | 0.00000 | 6756.77420 | -5000.000000 | 0.246605 | 0.24 | 0.13 | -0.810813 | -0.810813
2022-06-06 03:30:00+10:00 | 0 | 315.753731 | 1500.0 | 0.0 | 0.0 | 0.0 | 6815.75370 | 0.00000 | 6815.75370 | -5000.000000 | 0.422531 | 0.21 | 0.11 | -0.715654 | -0.715654
2022-06-06 04:00:00+10:00 | 0 | 316.470588 | 1500.0 | 5500.0 | 0.0 | 0.0 | 12316.47100 | 0.00000 | 12316.47100 | -5000.000000 | 0.598457 | 0.17 | 0.06 | -1.046900 | -1.046900
2022-06-06 04:30:00+10:00 | 0 | 263.228814 | 1500.0 | 0.0 | 0.0 | 0.0 | 6763.22880 | 0.00000 | 6763.22880 | -5000.000000 | 0.774383 | 0.24 | 0.13 | -0.811587 | -0.811587
2022-06-06 05:00:00+10:00 | 0 | 1068.586207 | 1500.0 | 0.0 | 0.0 | 0.0 | 7568.58620 | 0.00000 | 7568.58620 | -5000.000000 | 0.950309 | 0.24 | 0.13 | -0.908230 | -0.908230
2022-06-06 05:30:00+10:00 | 0 | 3223.010471 | 0.0 | 0.0 | 0.0 | 0.0 | 1863.24090 | 0.00000 | 1863.24090 | 1359.769500 | 0.897296 | 0.42 | 0.30 | -0.391281 | -0.391281
2022-06-06 06:00:00+10:00 | 0 | 1674.293103 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 1674.293100 | 0.832022 | 0.44 | 0.31 | -0.000000 | -0.000000
2022-06-06 06:30:00+10:00 | 0 | 1493.184713 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -3507.61530 | -3507.61530 | 5000.800000 | 0.637059 | 0.72 | 0.57 | 0.999670 | 0.999670
2022-06-06 07:00:00+10:00 | 0 | 1622.557895 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -3378.24210 | -3378.24210 | 5000.800000 | 0.442096 | 0.77 | 0.61 | 1.030364 | 1.030364
2022-06-06 07:30:00+10:00 | 36 | 958.800000 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -4078.00000 | -4078.00000 | 5000.800000 | 0.247133 | 0.70 | 0.55 | 1.121450 | 1.121450
2022-06-06 08:00:00+10:00 | 204 | 1324.479798 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -3880.32020 | -3880.32020 | 5000.800000 | 0.052170 | 0.61 | 0.46 | 0.892474 | 0.892474
2022-06-06 08:30:00+10:00 | 361 | 1340.185430 | 0.0 | 0.0 | 0.0 | 0.0 | 979.18543 | 0.00000 | 979.18543 | 0.000000 | 0.052170 | 0.42 | 0.30 | -0.205629 | -0.205629
2022-06-06 09:00:00+10:00 | 571 | 626.652941 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 55.652941 | 0.050000 | 0.52 | 0.38 | -0.000000 | -0.000000
2022-06-06 09:30:00+10:00 | 1008 | 340.121622 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -667.87838 | -667.87838 | 0.000000 | 0.050000 | 0.49 | 0.35 | 0.116879 | 0.116879
2022-06-06 10:00:00+10:00 | 1497 | 550.753425 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -946.24658 | -946.24658 | 0.000000 | 0.050000 | 0.49 | 0.36 | 0.170324 | 0.170324
2022-06-06 10:30:00+10:00 | 2130 | 593.021277 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | -1536.978700 | 0.104079 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 11:00:00+10:00 | 2532 | 452.708861 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | -2079.291100 | 0.177239 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 11:30:00+10:00 | 2947 | 458.083333 | 0.0 | 0.0 | 0.0 | 0.0 | 1064.88880 | 0.00000 | 1064.88880 | -3553.805500 | 0.302280 | 0.31 | 0.19 | -0.165058 | -0.165058
2022-06-06 12:00:00+10:00 | 2823 | 1121.208333 | 1500.0 | 0.0 | 0.0 | 0.0 | 4798.20830 | 0.00000 | 4798.20830 | -5000.000000 | 0.478206 | 0.21 | 0.10 | -0.503812 | -0.503812
2022-06-06 12:30:00+10:00 | 2603 | 5027.729730 | 1500.0 | 0.0 | 0.0 | 0.0 | 8924.72970 | 0.00000 | 8924.72970 | -5000.000000 | 0.654132 | 0.20 | 0.10 | -0.892473 | -0.892473
2022-06-06 13:00:00+10:00 | 2246 | 529.109091 | 1500.0 | 5500.0 | 0.0 | 0.0 | 10283.10900 | 0.00000 | 10283.10900 | -5000.000000 | 0.830058 | 0.17 | 0.06 | -0.874064 | -0.874064
2022-06-06 13:30:00+10:00 | 1909 | 288.527197 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | -1620.472800 | 0.887075 | 0.36 | 0.24 | -0.000000 | -0.000000
2022-06-06 14:00:00+10:00 | 1835 | 411.375000 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | -1423.625000 | 0.937165 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 14:30:00+10:00 | 1730 | 1390.769841 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | -339.230160 | 0.949101 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 15:00:00+10:00 | 1458 | 498.605405 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | -959.394590 | 0.982858 | 0.43 | 0.31 | -0.000000 | -0.000000
2022-06-06 15:30:00+10:00 | 1184 | 696.797927 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | -487.202070 | 1.000000 | 0.44 | 0.31 | -0.000000 | -0.000000
2022-06-06 16:00:00+10:00 | 824 | 718.871921 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -105.12808 | -105.12808 | 0.000000 | 1.000000 | 0.53 | 0.39 | 0.020500 | 0.020500
2022-06-06 16:30:00+10:00 | 473 | 582.425806 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 109.425810 | 0.995734 | 0.64 | 0.50 | -0.000000 | -0.000000
2022-06-06 17:00:00+10:00 | 309 | 1116.168919 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -4193.63110 | -4193.63110 | 5000.800000 | 0.800771 | 0.72 | 0.57 | 1.195185 | 1.195185
2022-06-06 17:30:00+10:00 | 74 | 2014.896175 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -3059.90380 | -3059.90380 | 5000.800000 | 0.605808 | 1.66 | 1.42 | 2.172532 | 2.172532
2022-06-06 18:00:00+10:00 | 0 | 2205.951515 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -2794.84850 | -2794.84850 | 5000.800000 | 0.410845 | 1.30 | 1.10 | 1.537167 | 1.537167
2022-06-06 18:30:00+10:00 | 0 | 996.287500 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -4004.51250 | -4004.51250 | 5000.800000 | 0.215882 | 0.90 | 0.73 | 1.461647 | 1.461647
2022-06-06 19:00:00+10:00 | 0 | 399.984848 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | -2635.26780 | -2635.26780 | 3035.252700 | 0.097549 | 0.72 | 0.57 | 0.751051 | 0.751051
2022-06-06 19:30:00+10:00 | 0 | 414.305344 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 414.305340 | 0.081396 | 0.65 | 0.50 | -0.000000 | -0.000000
2022-06-06 20:00:00+10:00 | 0 | 320.816176 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 320.816180 | 0.068889 | 0.64 | 0.50 | -0.000000 | -0.000000
2022-06-06 20:30:00+10:00 | 0 | 484.500000 | 0.0 | 0.0 | 0.0 | 0.0 | 0.00000 | 0.00000 | 0.00000 | 484.500000 | 0.050000 | 0.63 | 0.48 | -0.000000 | -0.000000
[2022-06-05 21:01:10,669] INFO in command_line: Setting up needed data
[2022-06-05 21:01:10,674] INFO in forecast: Retrieving weather forecast data using method = list
[2022-06-05 21:01:10,679] INFO in forecast: Retrieving data from hass for load forecast using method = naive
[2022-06-05 21:01:10,680] INFO in retrieve_hass: Retrieve hass get data method initiated...
[2022-06-05 21:01:12,687] INFO in web_server: >> Performing naive MPC optimization...
[2022-06-05 21:01:12,688] INFO in command_line: Performing naive MPC optimization
[2022-06-05 21:01:12,710] INFO in optimization: Perform an iteration of a naive MPC controller
[2022-06-05 21:01:13,013] INFO in optimization: Status: Optimal
[2022-06-05 21:01:13,014] INFO in optimization: Total value of the Cost function = 4.09
[2022-06-05 21:01:57,193] INFO in command_line: Setting up needed data
[2022-06-05 21:01:57,197] INFO in web_server: >> Publishing data...
[2022-06-05 21:01:57,198] INFO in command_line: Publishing data to HASS instance
[2022-06-05 21:01:57,210] ERROR in app: Exception on /action/publish-data [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2077, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1523, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/local/lib/python3.9/dist-packages/emhass/web_server.py", line 134, in action_call
_ = publish_data(input_data_dict, app.logger)
File "/usr/local/lib/python3.9/dist-packages/emhass/command_line.py", line 255, in publish_data
input_data_dict['rh'].post_data(opt_res_latest['P_PV'], idx_closest,
File "/usr/local/lib/python3.9/dist-packages/emhass/retrieve_hass.py", line 274, in post_data
response = post(url, headers=headers, data=json.dumps(data))
File "/usr/lib/python3.9/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type int64 is not JSON serializable
I have defined "treat_deferrable_load_as_semi_cont: true", On version: 0.4.2 this setting doesn't seem to work.
CONFIG:
hass_url: empty
long_lived_token: empty
costfun: profit
logging_level: DEBUG
optimization_time_step: 60
historic_days_to_retrieve: 2
method_ts_round: nearest
set_total_pv_sell: false
lp_solver: COIN_CMD
lp_solver_path: /usr/bin/cbc
set_nocharge_from_grid: false
set_nodischarge_to_grid: false
set_battery_dynamic: false
battery_dynamic_max: 0.9
battery_dynamic_min: -0.9
load_forecast_method: naive
sensor_power_photovoltaics: sensor.solis_ac_output_total_power
sensor_power_load_no_var_loads: sensor.emhass_power
number_of_deferrable_loads: 8
list_nominal_power_of_deferrable_loads:
LOG:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun emhass (no readiness notification)
s6-rc: info: service legacy-services successfully started
2023-11-02 18:54:01,759 - web_server - INFO - Launching the emhass webserver at: http://0.0.0.0:5000
2023-11-02 18:54:01,759 - web_server - INFO - Home Assistant data fetch will be performed using url: http://supervisor/core/api
2023-11-02 18:54:01,759 - web_server - INFO - The data path is: /share
2023-11-02 18:54:01,760 - web_server - INFO - Using core emhass version: 0.5.1
waitress INFO Serving on http://0.0.0.0:5000
2023-11-02 18:58:03,405 - web_server - INFO - Setting up needed data
2023-11-02 18:58:03,423 - web_server - INFO - Retrieving weather forecast data using method = scrapper
2023-11-02 18:58:04,194 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2023-11-02 18:58:04,195 - web_server - INFO - Retrieve hass get data method initiated...
2023-11-02 18:58:13,244 - web_server - INFO - >> Performing dayahead optimization...
2023-11-02 18:58:13,244 - web_server - INFO - Performing day-ahead forecast optimization
2023-11-02 18:58:13,252 - web_server - INFO - Perform optimization for the day-ahead
2023-11-02 18:58:13,294 - web_server - INFO - Status: Infeasible
2023-11-02 18:58:13,294 - web_server - INFO - Total value of the Cost function = -95.9
shell_command:
publish_data: "curl -i -H 'Content-Type:application/json' -X POST -d '{}' http://localhost:5000/action/publish-data"
post_nordpool_forecast: "curl -i -H 'Content-Type: application/json' -X POST -d '{"load_cost_forecast":{{(
(state_attr('sensor.nordpool_kwh_oslo_nok_3_095_025', 'raw_tomorrow')|map(attribute='value')|list)[:24])
}},"prod_price_forecast":{{(
(state_attr('sensor.nordpool_kwh_oslo_sol_netleie', 'raw_tomorrow')|map(attribute='value')|list)[:24])
}},"def_total_hours":{{([
states('input_number.emhass_vvb_operasjonstid')|int(0),
states('input_number.emhass_gang_varme_operasjonstid')|int(0),
states('input_number.emhass_bad_varme_operasjonstid')|int(0),
states('input_number.emhass_garasje_bod_operasjonstid')|int(0),
states('input_number.emhass_bad_nede_varme_operasjonstid')|int(0),
states('input_number.emhass_bil_lader_operasjonstid')|int(0),
states('input_number.emhass_luftvp_operasjonstid')|int(0),
states('input_number.emhass_vannvp_operasjonstid')|int(0)
] |list)[:8]}}}' http://localhost:5000/action/dayahead-optim"
shell_command:
publish_data: "curl -i -H 'Content-Type:application/json' -X POST -d '{}' http://localhost:5000/action/publish-data"
post_nordpool_forecast: "curl -i -H 'Content-Type: application/json' -X POST -d '{"load_cost_forecast":[1.305, 0.97, 0.795, 0.73, 0.791, 1.176, 1.515, 1.604, 1.611, 1.609, 1.608, 1.604, 1.598, 1.593, 1.597, 1.595, 1.601, 1.6, 1.602, 1.598, 1.576, 1.508, 1.318, 1.189],"prod_price_forecast":[0.574, 0.322, 0.191, 0.142, 0.188, 0.477, 0.673, 0.759, 0.778, 0.773, 0.771, 0.759, 0.742, 0.731, 0.741, 0.735, 0.752, 0.748, 0.754, 0.743, 0.719, 0.668, 0.583, 0.486],"def_total_hours":[3, 0, 0, 0, 0, 4, 0, 0]}' http://localhost:5000/action/dayahead-optim"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.