I jump in just to add to the previous and perfect answer you also have the possibility to install the terminal add-on (if you use add-ons) and test the command from HA itself.
But the shell command can be placed in the configuration.yaml?
Can someone give me a complete shell command for a thermal load?
A couple of āadvancedā methods, running EMHASS with the Advanced Prices is certainty gives much better performance.
You can setup your own REST sensor using the AmberAPI.
Alternatively, you can create a folder under custom_componts/amberelectric
and copy the files from the PR into that folder.
Add a version field to the manifest.json file:
Then restart HA and watch the logs to see if there are any errors.
When the PR is accepted into core then just delete the custom_components/amberelectric
folder.
Come over to Use Case: Thermal Model Ā· davidusb-geek/emhass Ā· Discussion #340 Ā· GitHub where we are sharing the configs that work with the thermal model,
Anyone else see these errors in supervisor after updating emhass to 0.11.2?
I tried to get rid of it but not succesfull up until now. The list keeps getting longer with the same errors.
I did the config conversion.
ļæ½[33m2024-11-10` 15:55:44.535 WARNING (MainThread) [supervisor.addons.options] Option 'battery_dynamic_min' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.535 WARNING (MainThread) [supervisor.addons.options] Option 'weight_battery_discharge' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.536 WARNING (MainThread) [supervisor.addons.options] Option 'weight_battery_charge' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.536 WARNING (MainThread) [supervisor.addons.options] Option 'load_forecast_method' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'battery_discharge_power_max' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'battery_charge_power_max' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'battery_discharge_efficiency' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'battery_charge_efficiency' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'battery_minimum_state_of_charge' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'battery_maximum_state_of_charge' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'battery_target_state_of_charge' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.537 WARNING (MainThread) [supervisor.addons.options] Option 'delta_forecast_daily' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.538 WARNING (MainThread) [supervisor.addons.options] Option 'weather_forecast_method' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.538 WARNING (MainThread) [supervisor.addons.options] Option 'load_cost_forecast_method' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.538 WARNING (MainThread) [supervisor.addons.options] Option 'set_zero_min' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.538 WARNING (MainThread) [supervisor.addons.options] Option 'production_price_forecast_method' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.538 WARNING (MainThread) [supervisor.addons.options] Option 'optional_solcast_api_key' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.538 WARNING (MainThread) [supervisor.addons.options] Option 'optional_solar_forecast_kwp' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m ļæ½[33m2024-11-10 15:55:44.538 WARNING (MainThread) [supervisor.addons.options] Option 'optional_solcast_rooftop_id' does not exist in the schema for EMHASS (5b918bf2_emhass)ļæ½[0m
Probably because in the addon-settings you still have these options in the yaml.
You can het rid of them there. They have been replaced by the config in json.
@RudolfRendier Thanks. That seems to have done the trick. All the lines of the previous config where still there. I removed almost all of them and itās ok now.
When running Day Ahead I get this warning;
2024-11-10 18:48:47,293 - web_server - INFO - Passed runtime parameters: {'pv_power_forecast': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 199, 367, 549, 714, 928, 1256, 1541, 1640, 1684, 1686, 1584, 1395, 1217, 1055, 855, 469, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'load_cost_forecast': [0.2809, 0.2775, 0.2775, 0.2698, 0.2698, 0.2591, 0.2591, 0.2547, 0.2547, 0.2515, 0.2515, 0.253, 0.253, 0.2463, 0.2463, 0.2428, 0.2428, 0.2372, 0.2372, 0.2356, 0.2356, 0.2347, 0.2347, 0.2443, 0.2443, 0.2555, 0.2555, 0.2628, 0.2628, 0.2679, 0.2679, 0.2604, 0.2604, 0.2459, 0.2459, 0.2525, 0.2525, 0.2575, 0.2575, 0.2591, 0.2591, 0.2646, 0.2646, 0.2509, 0.2509, 0.268, 0.268, 0.2804], 'prod_price_forecast': [0.1267, 0.1235, 0.1235, 0.1163, 0.1163, 0.1062, 0.1062, 0.1021, 0.1021, 0.099, 0.099, 0.1004, 0.1004, 0.0941, 0.0941, 0.0908, 0.0908, 0.0855, 0.0855, 0.084, 0.084, 0.0832, 0.0832, 0.0923, 0.0923, 0.1028, 0.1028, 0.1096, 0.1096, 0.1145, 0.1145, 0.1075, 0.1075, 0.0937, 0.0937, 0.0999, 0.0999, 0.1047, 0.1047, 0.1061, 0.1061, 0.1114, 0.1114, 0.0985, 0.0985, 0.1146, 0.1146, 0.1263], 'load_power_forecast': [804, 1000, 900, 900, 800, 800, 900, 800, 300, 300, 500, 400, 400, 400, 500, 500, 400, 400, 200, 300, 300, 200, 200, 400, 200, 300, 200, 1300, 2000, 900, 1400, 1500, 1600, 1500, 1600, 1200, 1400, 1300, 1300, 1200, 900, 900, 900, 1000, 1000, 900, 400, 800]}
2024-11-10 18:48:47,293 - web_server - INFO - >> Setting input data dict
2024-11-10 18:48:47,293 - web_server - INFO - Setting up needed data
2024-11-10 18:48:47,294 - web_server - INFO - Retrieving weather forecast data using method = list
2024-11-10 18:48:47,295 - web_server - INFO - >> Performing dayahead optimization...
2024-11-10 18:48:47,295 - web_server - INFO - Performing day-ahead forecast optimization
2024-11-10 18:48:47,301 - web_server - INFO - Perform optimization for the day-ahead
2024-11-10 18:48:47,418 - web_server - INFO - Status: Optimal
2024-11-10 18:48:47,418 - web_server - INFO - Total value of the Cost function = -2695.95
2024-11-10 18:48:47,550 - web_server - INFO - Passed runtime parameters: {'publish_prefix': 'dh_'}
2024-11-10 18:48:47,550 - web_server - INFO - >> Setting input data dict
2024-11-10 18:48:47,550 - web_server - INFO - Setting up needed data
2024-11-10 18:48:47,551 - web_server - INFO - >> Publishing data...
2024-11-10 18:48:47,551 - web_server - INFO - Publishing data to HASS instance
2024-11-10 18:48:47,551 - web_server - WARNING - no saved entity json files in path:/share/entities
2024-11-10 18:48:47,551 - web_server - WARNING - falling back to opt_res_latest
2024-11-10 18:48:47,582 - web_server - INFO - Successfully posted to sensor.dh_p_pv_forecast = 0
2024-11-10 18:48:47,586 - web_server - INFO - Successfully posted to sensor.dh_p_load_forecast = 804
2024-11-10 18:48:47,589 - web_server - INFO - Successfully posted to sensor.dh_p_hybrid_inverter = 804.0
2024-11-10 18:48:47,592 - web_server - INFO - Successfully posted to sensor.dh_p_deferrable0 = 0.0
2024-11-10 18:48:47,595 - web_server - INFO - Successfully posted to sensor.dh_p_deferrable1 = 0.0
2024-11-10 18:48:47,598 - web_server - INFO - Successfully posted to sensor.dh_p_batt_forecast = 804.0
2024-11-10 18:48:47,602 - web_server - INFO - Successfully posted to sensor.dh_soc_batt_forecast = 87.32
2024-11-10 18:48:47,605 - web_server - INFO - Successfully posted to sensor.dh_p_grid_forecast = 0.0
2024-11-10 18:48:47,607 - web_server - INFO - Successfully posted to sensor.dh_total_cost_fun_value = -2.7
2024-11-10 18:48:47,609 - web_server - INFO - Successfully posted to sensor.dh_optim_status = Optimal
2024-11-10 18:48:47,612 - web_server - INFO - Successfully posted to sensor.dh_unit_load_cost = 0.2809
2024-11-10 18:48:47,614 - web_server - INFO - Successfully posted to sensor.dh_unit_prod_price = 0.1267
I donāt know how to solve. Setting āContinually publish optimization resultsā to true gives en error
2024-11-10 18:55:39,190 - web_server - INFO - Passed runtime parameters: {'pv_power_forecast': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 199, 367, 549, 714, 928, 1256, 1541, 1640, 1684, 1686, 1584, 1395, 1217, 1055, 855, 469, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'load_cost_forecast': [0.2809, 0.2775, 0.2775, 0.2698, 0.2698, 0.2591, 0.2591, 0.2547, 0.2547, 0.2515, 0.2515, 0.253, 0.253, 0.2463, 0.2463, 0.2428, 0.2428, 0.2372, 0.2372, 0.2356, 0.2356, 0.2347, 0.2347, 0.2443, 0.2443, 0.2555, 0.2555, 0.2628, 0.2628, 0.2679, 0.2679, 0.2604, 0.2604, 0.2459, 0.2459, 0.2525, 0.2525, 0.2575, 0.2575, 0.2591, 0.2591, 0.2646, 0.2646, 0.2509, 0.2509, 0.268, 0.268, 0.2804], 'prod_price_forecast': [0.1267, 0.1235, 0.1235, 0.1163, 0.1163, 0.1062, 0.1062, 0.1021, 0.1021, 0.099, 0.099, 0.1004, 0.1004, 0.0941, 0.0941, 0.0908, 0.0908, 0.0855, 0.0855, 0.084, 0.084, 0.0832, 0.0832, 0.0923, 0.0923, 0.1028, 0.1028, 0.1096, 0.1096, 0.1145, 0.1145, 0.1075, 0.1075, 0.0937, 0.0937, 0.0999, 0.0999, 0.1047, 0.1047, 0.1061, 0.1061, 0.1114, 0.1114, 0.0985, 0.0985, 0.1146, 0.1146, 0.1263], 'load_power_forecast': [939, 1000, 900, 900, 800, 800, 900, 800, 300, 300, 500, 400, 400, 400, 500, 500, 400, 400, 200, 300, 300, 200, 200, 400, 200, 300, 200, 1300, 2000, 900, 1400, 1500, 1600, 1500, 1600, 1200, 1400, 1300, 1300, 1200, 900, 900, 900, 1000, 1000, 900, 400, 800]}
2024-11-10 18:55:39,190 - web_server - INFO - >> Setting input data dict
2024-11-10 18:55:39,190 - web_server - INFO - Setting up needed data
2024-11-10 18:55:39,192 - web_server - INFO - Retrieving weather forecast data using method = list
2024-11-10 18:55:39,193 - web_server - INFO - >> Performing dayahead optimization...
2024-11-10 18:55:39,193 - web_server - INFO - Performing day-ahead forecast optimization
2024-11-10 18:55:39,197 - web_server - INFO - Perform optimization for the day-ahead
2024-11-10 18:55:39,304 - web_server - INFO - Status: Optimal
2024-11-10 18:55:39,304 - web_server - INFO - Total value of the Cost function = -2713.36
2024-11-10 18:55:39,308 - web_server - INFO - Publishing data to HASS instance
2024-11-10 18:55:39,311 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = 0
2024-11-10 18:55:39,312 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 939
2024-11-10 18:55:39,313 - web_server - INFO - Successfully posted to sensor.p_hybrid_inverter = 939.0
2024-11-10 18:55:39,314 - web_server - INFO - Successfully posted to sensor.p_deferrable0 = 0.0
2024-11-10 18:55:39,315 - web_server - INFO - Successfully posted to sensor.p_deferrable1 = 0.0
2024-11-10 18:55:39,316 - web_server - INFO - Successfully posted to sensor.p_batt_forecast = 939.0
2024-11-10 18:55:39,318 - web_server - INFO - Successfully posted to sensor.soc_batt_forecast = 86.87
2024-11-10 18:55:39,394 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 0.0
2024-11-10 18:55:39,396 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = -2.71
2024-11-10 18:55:39,397 - web_server - INFO - Successfully posted to sensor.optim_status = Optimal
2024-11-10 18:55:39,398 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 0.2809
2024-11-10 18:55:39,399 - web_server - INFO - Successfully posted to sensor.unit_prod_price = 0.1267
2024-11-10 18:55:39,499 - web_server - INFO - Passed runtime parameters: {'publish_prefix': 'dh_'}
2024-11-10 18:55:39,499 - web_server - INFO - >> Setting input data dict
2024-11-10 18:55:39,499 - web_server - INFO - Setting up needed data
2024-11-10 18:55:39,500 - web_server - INFO - >> Publishing data...
2024-11-10 18:55:39,500 - web_server - INFO - Publishing data to HASS instance
2024-11-10 18:55:39,500 - web_server - ERROR - Exception on /action/publish-data [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/web_server.py", line 343, in action_call
_ = publish_data(input_data_dict, app.logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/command_line.py", line 813, in publish_data
opt_res = pd.concat(opt_res_list, axis=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/reshape/concat.py", line 372, in concat
op = _Concatenator(
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/reshape/concat.py", line 429, in __init__
raise ValueError("No objects to concatenate")
ValueError: No objects to concatenate
And there are files in the folder share/entities:
The problem is the generated files donāt have the prefix you request to publish.
(The files should have been saved as āsensor.dh_*ā)
Itās a bit similar to the issue here: Unable to publish data from MPC when dayahead has been saved to file Ā· Issue #372 Ā· davidusb-geek/emhass Ā· GitHub
But you can work around this by providing the same prefix for the optimization and the publish data. I think you also want to set āentity_saveā: true for your optimization-calls.
OK, Thanks, I need to dive into this how to make this work practically.
A change is planned for HA Core 2024.11.2, this should resolve EMHASS not being able to fetch data from the history after HA restarts.
I think a work around is to restart HA more regularly, at least once in X days, where X is the number of days you keep in the recorder when purging. (10, by default)
How to save the generated files with the ādh_ā prefix? Not with only save_entities it seems. save_entities is mentioned in the documentation
post_data(data_df: DataFrame, idx: int, entity_id: str, unit_of_measurement: str, friendly_name: str, type_var: str, from_mlforecaster: bool | None = False, publish_prefix: str | None = '', save_entities: bool | None = False, logger_levels: str | None = 'info', dont_post: bool | None = False)ā Noneļ
Post passed data to hass.
Parameters
:
data_df (pd.DataFrame) ā The DataFrame containing the data that will be posted to hass. This should be a one columns DF or a series.
idx (int) ā The int index of the location of the data within the passed DataFrame. We will post just one value at a time.
entity_id (str) ā The unique entity_id of the sensor in hass.
unit_of_measurement (str) ā The units of the sensor.
friendly_name (str) ā The friendly name that will be used in the hass frontend.
type_var (str) ā A variable to indicate the type of variable: power, SOC, etc.
publish_prefix (str, optional) ā A common prefix for all published data entity_id.
save_entities (bool, optional) ā if entity data should be saved in data_path/entities
logger_levels (str, optional) ā set logger level, info or debug, to output
dont_post (bool, optional) ā dont post to HA
2024-11-11 20:08:31,720 - web_server - INFO - Passed runtime parameters: {'save_entities': 'True', 'pv_power_forecast': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 405, 587, 753, 882, 1040, 1245, 1369, 1349, 1281, 1203, 1149, 1104, 1040, 942, 828, 608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'load_cost_forecast': [0.2628, 0.2628, 0.2521, 0.2521, 0.2486, 0.2486, 0.2469, 0.2469, 0.2511, 0.2511, 0.2448, 0.2448, 0.2388, 0.2388, 0.2302, 0.2302, 0.2273, 0.2273, 0.2427, 0.2427, 0.2476, 0.2476, 0.255, 0.255, 0.2921, 0.2921, 0.273, 0.273, 0.2709, 0.2709, 0.2555, 0.2555, 0.2599, 0.2599, 0.267, 0.267, 0.2711, 0.2711, 0.2934, 0.2934, 0.3192, 0.3192, 0.3474, 0.3474, 0.3268, 0.3268, 0.2998, 0.2998], 'prod_price_forecast': [0.1097, 0.1097, 0.0995, 0.0995, 0.0963, 0.0963, 0.0946, 0.0946, 0.0987, 0.0987, 0.0927, 0.0927, 0.087, 0.087, 0.0789, 0.0789, 0.0762, 0.0762, 0.0908, 0.0908, 0.0953, 0.0953, 0.1023, 0.1023, 0.1373, 0.1373, 0.1193, 0.1193, 0.1173, 0.1173, 0.1028, 0.1028, 0.1069, 0.1069, 0.1136, 0.1136, 0.1175, 0.1175, 0.1386, 0.1386, 0.1629, 0.1629, 0.1895, 0.1895, 0.1701, 0.1701, 0.1446, 0.1446], 'load_power_forecast': [1563, 700, 700, 600, 500, 600, 500, 500, 500, 600, 500, 500, 500, 600, 500, 200, 200, 400, 300, 200, 400, 200, 400, 300, 200, 200, 200, 300, 300, 200, 0, 200, 400, 300, 200, 300, 200, 300, 300, 200, 200, 200, 200, 500, 2000, 700, 1200, 1300]}
2024-11-11 20:08:31,721 - web_server - INFO - >> Setting input data dict
2024-11-11 20:08:31,721 - web_server - INFO - Setting up needed data
2024-11-11 20:08:31,727 - web_server - INFO - Retrieving weather forecast data using method = list
2024-11-11 20:08:31,733 - web_server - INFO - >> Performing dayahead optimization...
2024-11-11 20:08:31,733 - web_server - INFO - Performing day-ahead forecast optimization
2024-11-11 20:08:31,740 - web_server - INFO - Perform optimization for the day-ahead
2024-11-11 20:08:31,922 - web_server - INFO - Status: Optimal
2024-11-11 20:08:31,923 - web_server - INFO - Total value of the Cost function = -929.89
2024-11-11 20:08:31,928 - web_server - INFO - Publishing data to HASS instance
2024-11-11 20:08:31,933 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = 0
2024-11-11 20:08:31,935 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 1563
2024-11-11 20:08:31,937 - web_server - INFO - Successfully posted to sensor.p_hybrid_inverter = 1563.0
2024-11-11 20:08:31,938 - web_server - INFO - Successfully posted to sensor.p_deferrable0 = 0.0
2024-11-11 20:08:31,940 - web_server - INFO - Successfully posted to sensor.p_deferrable1 = 0.0
2024-11-11 20:08:31,941 - web_server - INFO - Successfully posted to sensor.p_batt_forecast = 1563.0
2024-11-11 20:08:31,942 - web_server - INFO - Successfully posted to sensor.soc_batt_forecast = 84.79
2024-11-11 20:08:31,944 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 0.0
2024-11-11 20:08:31,945 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = -0.93
2024-11-11 20:08:31,945 - web_server - INFO - Successfully posted to sensor.optim_status = Optimal
2024-11-11 20:08:31,947 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 0.2628
2024-11-11 20:08:31,948 - web_server - INFO - Successfully posted to sensor.unit_prod_price = 0.1097
2024-11-11 20:08:32,334 - web_server - INFO - Passed runtime parameters: {'publish_prefix': 'dh_'}
2024-11-11 20:08:32,334 - web_server - INFO - >> Setting input data dict
2024-11-11 20:08:32,334 - web_server - INFO - Setting up needed data
2024-11-11 20:08:32,335 - web_server - INFO - >> Publishing data...
2024-11-11 20:08:32,336 - web_server - INFO - Publishing data to HASS instance
2024-11-11 20:08:32,336 - web_server - ERROR - Exception on /action/publish-data [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/web_server.py", line 343, in action_call
_ = publish_data(input_data_dict, app.logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/command_line.py", line 813, in publish_data
opt_res = pd.concat(opt_res_list, axis=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/reshape/concat.py", line 372, in concat
op = _Concatenator(
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/reshape/concat.py", line 429, in __init__
raise ValueError("No objects to concatenate")
ValueError: No objects to concatenate
'''
Yes, thatās a bit confusing, thatās the argument in the python method.
The actual runtime parameter is named somewhat different:
Ā“entity_saveā
https://emhass.readthedocs.io/en/latest/intro.html#manual-home-assistant-automation-for-publish
I do this:
For the dayahead and the MPC:
{"entity_save": true, "publish_prefix": "dh_", ...
{"entity_save": true, "publish_prefix": "mpc_", ...
Got it:
2024-11-11 21:05:15,937 - web_server - INFO - Passed runtime parameters: {'entity_save': 'True', 'publish_prefix': 'dh_', 'pv_power_forecast': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 405, 587, 753, 882, 1040, 1245, 1369, 1349, 1281, 1203, 1149, 1104, 1040, 942, 828, 608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'load_cost_forecast': [0.2521, 0.2521, 0.2486, 0.2486, 0.2469, 0.2469, 0.2511, 0.2511, 0.2448, 0.2448, 0.2388, 0.2388, 0.2302, 0.2302, 0.2273, 0.2273, 0.2427, 0.2427, 0.2476, 0.2476, 0.255, 0.255, 0.2921, 0.2921, 0.273, 0.273, 0.2709, 0.2709, 0.2555, 0.2555, 0.2599, 0.2599, 0.267, 0.267, 0.2711, 0.2711, 0.2934, 0.2934, 0.3192, 0.3192, 0.3474, 0.3474, 0.3268, 0.3268, 0.2998, 0.2998, 0.2819, 0.2819], 'prod_price_forecast': [0.0995, 0.0995, 0.0963, 0.0963, 0.0946, 0.0946, 0.0987, 0.0987, 0.0927, 0.0927, 0.087, 0.087, 0.0789, 0.0789, 0.0762, 0.0762, 0.0908, 0.0908, 0.0953, 0.0953, 0.1023, 0.1023, 0.1373, 0.1373, 0.1193, 0.1193, 0.1173, 0.1173, 0.1028, 0.1028, 0.1069, 0.1069, 0.1136, 0.1136, 0.1175, 0.1175, 0.1386, 0.1386, 0.1629, 0.1629, 0.1895, 0.1895, 0.1701, 0.1701, 0.1446, 0.1446, 0.1277, 0.1277], 'load_power_forecast': [1556, 600, 500, 600, 500, 500, 500, 600, 500, 500, 500, 600, 500, 200, 200, 400, 300, 200, 400, 200, 400, 300, 200, 200, 200, 300, 300, 200, 0, 200, 400, 300, 200, 300, 200, 300, 300, 200, 200, 200, 200, 500, 2000, 700, 1200, 1300, 1300, 1600]}
2024-11-11 21:05:15,939 - web_server - INFO - >> Setting input data dict
2024-11-11 21:05:15,939 - web_server - INFO - Setting up needed data
2024-11-11 21:05:15,974 - web_server - INFO - Retrieving weather forecast data using method = list
2024-11-11 21:05:15,992 - web_server - INFO - >> Performing dayahead optimization...
2024-11-11 21:05:15,992 - web_server - INFO - Performing day-ahead forecast optimization
2024-11-11 21:05:16,004 - web_server - INFO - Perform optimization for the day-ahead
2024-11-11 21:05:16,200 - web_server - INFO - Status: Optimal
2024-11-11 21:05:16,200 - web_server - INFO - Total value of the Cost function = -1162.52
2024-11-11 21:05:16,216 - web_server - INFO - Publishing data to HASS instance
2024-11-11 21:05:16,232 - web_server - INFO - Successfully posted to sensor.dh_p_pv_forecast = 0
2024-11-11 21:05:16,235 - web_server - INFO - Successfully posted to sensor.dh_p_load_forecast = 1556
2024-11-11 21:05:16,237 - web_server - INFO - Successfully posted to sensor.dh_p_hybrid_inverter = 1556.0
2024-11-11 21:05:16,238 - web_server - INFO - Successfully posted to sensor.dh_p_deferrable0 = 0.0
2024-11-11 21:05:16,240 - web_server - INFO - Successfully posted to sensor.dh_p_deferrable1 = 0.0
2024-11-11 21:05:16,242 - web_server - INFO - Successfully posted to sensor.dh_p_batt_forecast = 1556.0
2024-11-11 21:05:16,243 - web_server - INFO - Successfully posted to sensor.dh_soc_batt_forecast = 84.81
2024-11-11 21:05:16,245 - web_server - INFO - Successfully posted to sensor.dh_p_grid_forecast = 0.0
2024-11-11 21:05:16,246 - web_server - INFO - Successfully posted to sensor.dh_total_cost_fun_value = -1.16
2024-11-11 21:05:16,247 - web_server - INFO - Successfully posted to sensor.dh_optim_status = Optimal
2024-11-11 21:05:16,248 - web_server - INFO - Successfully posted to sensor.dh_unit_load_cost = 0.2521
2024-11-11 21:05:16,249 - web_server - INFO - Successfully posted to sensor.dh_unit_prod_price = 0.0995
2024-11-11 21:05:49,464 - web_server - INFO - EMHASS server online, serving index.html...
web_server INFO Obtaining parameters from config.json:
I have an issue where the power curve of my battery results in difficulty charging to 100% due to the drop in power input towards the end of the cycle.
My sonnen battery is rated at 3300W in and out but in reality it seems to only maintain 3300 for 60 minutes or so then it slowly degrades to 2800W before it seems to recover to 3000 to 3200 or so causing not as good a result as expected or calculated by the MPC process.
But the main issue is from 90% on it will only take in 850W and consequently often doesnāt make it to 100% as the MPC forecast seems to expect a constant rate of charge or 3300W as set in the configuration.
Being a LiFePO4 cathode battery they need to charge to 100% often and will go into a recharge maintenance cycle where they will charge for days trying to reach 100% to balance the battery cells. So, this lack of slow charge at the end of the cycle may result in imbalance and possible damage to the battery (already had one cell replaced under warranty but not sure if it was as a result of this issue)
What is the best way to represent the power curve as it really is rather than this assumption that its a constant and to dictate a maximum period to expect non-stop full power input (and output).
Is it possible / allowed to include set_nocharge_from_grid
as part of runtime parameters in a REST call?
(Context: My electricity retailer has a demand charge during certain hours, during which Iād like to avoid charging from the grid. I already set the price to $99 but sometimes EMHASS still thinks it should charge from the grid and this could be a solution)
Hello Robert,
I can share what I do and maybe we can share thoughts and opinions.
I have a sonnen 8.2 and 10 batteries.
The maintenance mode is automatically triggered once per month if 100% charge is not reached in the meanwhile.
What I do is to store the last time the full charge is reached and after 28 days (Iām anticipating maintenance basically - because otherwise I donāt have control on when the maintenance mode happens - I run it at night with lowest prices) I trigger an automation that takes full control of the battery and charges it to 99% at full power, from 99% on I reduce the power to 1kW. It keeps control on the battery until 100% is reached for 10 seconds, after that I switch back to EMHASS and I store the date of full charge reached.
FYI: Sonnen is checking my 10 model as it discharges till 2-5% and then the ādischarge not allowedā flag turns true and the battery becomes idleā¦ but in this I discovered the maintenance mode corresponds to operating mode 6. But Iām scared of trying to force it via API as, if it works, I donāt know if Iām able to switch it back.
EDIT:
Iām applying the same strategy when charging via EMHASS: my automation limits the charging power to 1kW max when 99% is reached, regardless of EMAHSS input.
Thanks for that. Thatās excelent advice. Iāll do the same.
Hello,
Iām trying again to update to the latest version.
I copied the yaml configuration (Iām an add-on user) into the new interface, converted and saved it.
I before checking the parameter names in the commands I tried to re-run MPC and have a look at the log.
I got the following message, complaining about the number of days to retrieve (less than 9), which used to be (and should still be) 2 by default.
Any suggestions? Thanks
2024-11-13 17:15:25,643 - web_server - INFO - >> Setting input data dict
2024-11-13 17:15:25,643 - web_server - INFO - Setting up needed data
2024-11-13 17:15:25,644 - web_server - WARNING - warning `days_to_retrieve` is set to a value less than 9, this could cause an error with the fit
2024-11-13 17:15:25,645 - web_server - WARNING - setting`passed_data:days_to_retrieve` to 9 for fit/predict/tune
2024-11-13 17:15:25,646 - web_server - INFO - Retrieve hass get data method initiated...
2024-11-13 17:15:27,207 - web_server - ERROR - Exception on /action/naive-mpc-optim [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/web_server.py", line 325, in action_call
input_data_dict = set_input_data_dict(emhass_conf, costfun,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/command_line.py", line 155, in set_input_data_dict
if not rh.prepare_data(retrieve_hass_conf['sensor_power_load_no_var_loads'],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/emhass/retrieve_hass.py", line 285, in prepare_data
self.df_final[new_var_replace_zero] = self.df_final[
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/frame.py", line 3767, in __getitem__
indexer = self.columns._get_indexer_strict(key, "columns")[1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/pandas/core/indexes/base.py", line 5877, in _get_indexer_strict
self._raise_if_missing(keyarr, indexer, axis_name)
File "/usr/local/lib/python3.11/dist-packages/pandas/core/indexes/base.py", line 5938, in _raise_if_missing
raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Index(['sensor.power_photovoltaics'], dtype='object')] are in the [columns]"
EDIT: I think the 9 days is something different from the error; I tried day-ahead and got the same warning but the elaboration was successful. If somebody has suggestions about the error they are welcome, in the meantime Iāll check the parameter names.
The question about the reason for that warning remains open.
Thanks!
I just set it to 10 days, seems fine.
sensor.power_photovoltaics you can change in the new config window for your own sensor.