Hi,
Anyone else having this error?
Cannot infer dst time from 2024-04-07 02:00:00, try using the ‘ambiguous’ argument
I was using an old version (0.4 I think), so I tried to setup the EMHASS addon but having a similar issue
2024-04-06 14:21:32,598 - web_server - INFO - EMHASS server online, serving index.html…
2024-04-06 14:21:33,297 - web_server - INFO - Passed runtime parameters: {‘prod_price_forecast’: [0.03, 0.02, 0.03, 0.02, 0.02, 0.05, 0.07, 0.08, 0.11, 0.12, 0.13, 0.11, 0.12, 0.12, 0.11, 0.11, 0.11, 0.11, 0.14, 0.12, 0.11, 0.14, 0.13, 0.11, 0.11, 0.11, 0.11, 0.09, 0.09, 0.08, 0.08, 0.06, 0.02, 0.01, 0.06, 0.07, 0.06, 0.05, 0.05, 0.06, 0.05, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01], ‘load_cost_forecast’: [0.14, 0.13, 0.27, 0.27, 0.27, 0.3, 0.33, 0.33, 0.37, 0.37, 0.38, 0.37, 0.37, 0.37, 0.22, 0.22, 0.23, 0.22, 0.26, 0.23, 0.23, 0.26, 0.24, 0.23, 0.23, 0.23, 0.22, 0.2, 0.2, 0.2, 0.19, 0.17, 0.13, 0.12, 0.17, 0.18, 0.17, 0.16, 0.16, 0.16, 0.16, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12], ‘load_power_forecast’: [754, 1700, 1200, 900, 900, 800, 1400, 1400, 600, 500, 600, 900, 1200, 1300, 1200, 1300, 1300, 1000, 500, 500, 500, 400, 500, 500, 500, 500, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 800, 1000, 2000, 1300, 900, 1600, 1500, 1700, 1900, 2000, 1800, 1900], ‘pv_power_forecast’: [2639, 1627, 1618, 1653, 1608, 1409, 1040, 592, 184, 52, 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, 9, 104, 358, 832, 1147, 1396, 1573, 1731, 1896, 1983, 1992, 2052, 2162, 2264, 2352, 2438, 2490, 2292, 1885, 1399, 987, 461, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ‘prediction_horizon’: 48, ‘alpha’: 1, ‘beta’: 0, ‘num_def_loads’: 0, ‘soc_init’: 0.63, ‘soc_final’: 0.05}
2024-04-06 14:21:33,297 - web_server - INFO - >> Setting input data dict
2024-04-06 14:21:33,297 - web_server - INFO - Setting up needed data
2024-04-06 14:21:33,304 - 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 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/flask/app.py”, line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/flask/app.py”, line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/flask/app.py”, line 855, 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 108, in action_call
input_data_dict = set_input_data_dict(config_path, str(data_path), costfun,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/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.11/dist-packages/emhass/forecast.py”, line 164, in init
freq=self.freq).round(self.freq, ambiguous=‘infer’, nonexistent=‘shift_forward’)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/pandas/core/indexes/extension.py”, line 98, in method
result = attr(self._data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/pandas/core/arrays/datetimelike.py”, line 2026, in round
return self._round(freq, RoundTo.NEAREST_HALF_EVEN, ambiguous, nonexistent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/pandas/core/arrays/datetimelike.py”, line 2002, in _round
return result.tz_localize(
^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/pandas/core/arrays/_mixins.py”, line 86, in method
return meth(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/pandas/core/arrays/datetimes.py”, line 1040, in tz_localize
new_dates = tzconversion.tz_localize_to_utc(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “pandas/_libs/tslibs/tzconversion.pyx”, line 322, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc
File “pandas/_libs/tslibs/tzconversion.pyx”, line 637, in pandas._libs.tslibs.tzconversion._get_dst_hours
pytz.exceptions.AmbiguousTimeError: 2024-04-07 02:00:00
2024-04-06 14:21:33,330 - web_server - INFO - Passed runtime parameters: {}
2024-04-06 14:21:33,331 - web_server - INFO - >> Setting input data dict
2024-04-06 14:21:33,331 - web_server - INFO - Setting up needed data
2024-04-06 14:21:33,335 - web_server - ERROR - Exception on /action/publish-data [POST]
Traceback (most recent call last):
EDIT 2: Now seems to be working
2024-04-06 14:32:33,293 - web_server - INFO - Passed runtime parameters: {‘prod_price_forecast’: [0.02, 0.02, 0.02, 0.02, 0.05, 0.07, 0.08, 0.11, 0.12, 0.13, 0.11, 0.12, 0.12, 0.11, 0.11, 0.11, 0.11, 0.14, 0.12, 0.11, 0.14, 0.13, 0.11, 0.11, 0.11, 0.11, 0.09, 0.09, 0.08, 0.08, 0.06, 0.02, 0.01, 0.06, 0.07, 0.06, 0.05, 0.05, 0.06, 0.05, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01], ‘load_cost_forecast’: [0.13, 0.27, 0.27, 0.27, 0.3, 0.33, 0.33, 0.37, 0.37, 0.38, 0.37, 0.37, 0.37, 0.22, 0.22, 0.23, 0.22, 0.26, 0.23, 0.23, 0.26, 0.24, 0.23, 0.23, 0.23, 0.22, 0.2, 0.2, 0.2, 0.19, 0.17, 0.13, 0.12, 0.17, 0.18, 0.17, 0.16, 0.16, 0.16, 0.16, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12], ‘load_power_forecast’: [872, 1200, 900, 900, 800, 1400, 1400, 600, 500, 600, 900, 1200, 1300, 1200, 1300, 1300, 1000, 500, 500, 500, 400, 500, 500, 500, 500, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 800, 1000, 2000, 1300, 900, 1600, 1500, 1700, 1900, 2000, 1800, 1900, 1300], ‘pv_power_forecast’: [2954, 1618, 1653, 1608, 1409, 1040, 592, 184, 52, 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, 9, 104, 358, 832, 1147, 1396, 1573, 1731, 1896, 1983, 1992, 2052, 2162, 2264, 2352, 2438, 2490, 2292, 1885, 1399, 987, 461, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ‘prediction_horizon’: 48, ‘alpha’: 1, ‘beta’: 0, ‘num_def_loads’: 0, ‘soc_init’: 0.66, ‘soc_final’: 0.05}
2024-04-06 14:32:33,295 - web_server - INFO - >> Setting input data dict
2024-04-06 14:32:33,295 - web_server - INFO - Setting up needed data
2024-04-06 14:32:33,297 - web_server - INFO - Retrieve hass get data method initiated…
2024-04-06 14:32:36,342 - web_server - INFO - Retrieving weather forecast data using method = list
2024-04-06 14:32:36,352 - web_server - INFO - >> Performing naive MPC optimization…
2024-04-06 14:32:36,353 - web_server - INFO - Performing naive MPC optimization
2024-04-06 14:32:36,369 - web_server - INFO - Perform an iteration of a naive MPC controller
2024-04-06 14:32:36,409 - web_server - WARNING - Solver default unknown, using default
Welcome to the CBC MILP Solver
Version: 2.10.3
Build Date: Dec 15 2019
command line - /usr/local/lib/python3.11/dist-packages/pulp/solverdir/cbc/linux/64/cbc /tmp/7541742d607049e0967f6fb68c9c42b2-pulp.mps -max -timeMode elapsed -branch -printingOptions all -solution /tmp/7541742d607049e0967f6fb68c9c42b2-pulp.sol (default strategy 1)
At line 2 NAME MODEL
At line 3 ROWS
At line 342 COLUMNS
At line 5815 RHS
At line 6153 BOUNDS
At line 6538 ENDATA
Problem MODEL has 337 rows, 288 columns and 5184 elements
Coin0008I MODEL read with 0 errors
Option for timeMode changed from cpu to elapsed
Continuous objective value is -0.393301 - 0.00 seconds
Cgl0003I 0 fixed, 0 tightened bounds, 71 strengthened rows, 0 substitutions
Cgl0003I 0 fixed, 0 tightened bounds, 1 strengthened rows, 0 substitutions
Cgl0004I processed model has 332 rows, 288 columns (96 integer (96 of which binary)) and 5191 elements
Cbc0038I Initial state - 37 integers unsatisfied sum - 4.91781
Cbc0038I Pass 1: suminf. 4.04198 (36) obj. 1.00374 iterations 77
Cbc0038I Pass 2: suminf. 0.69500 (12) obj. 1.14495 iterations 56
Cbc0038I Solution found of 1.14495
Cbc0038I Relaxing continuous gives 0.954144
Cbc0038I Before mini branch and bound, 39 integers at bound fixed and 115 continuous
Cbc0038I Full problem 332 rows 288 columns, reduced to 21 rows 27 columns
Cbc0038I Mini branch and bound improved solution from 0.954144 to 0.393301 (0.03 seconds)
Cbc0038I Freeing continuous variables gives a solution of 0.393301
Cbc0038I After 0.03 seconds - Feasibility pump exiting with objective of 0.393301 - took 0.01 seconds
Cbc0012I Integer solution of 0.39330141 found by feasibility pump after 0 iterations and 0 nodes (0.03 seconds)
Cbc0001I Search completed - best objective 0.3933014127418696, took 0 iterations and 0 nodes (0.03 seconds)
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
Cuts at root node changed objective from 0.393301 to 0.393301
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Result - Optimal solution found
Objective value: -0.39330141
Enumerated nodes: 0
Total iterations: 0
Time (CPU seconds): 0.03
Time (Wallclock seconds): 0.04
Option for printingOptions changed from normal to all
Total time (CPU seconds): 0.03 (Wallclock seconds): 0.04
2024-04-06 14:32:36,472 - web_server - INFO - Status: Optimal
2024-04-06 14:32:36,472 - web_server - INFO - Total value of the Cost function = -0.39
2024-04-06 14:32:36,702 - web_server - INFO - Passed runtime parameters: {}
2024-04-06 14:32:36,702 - web_server - INFO - >> Setting input data dict
2024-04-06 14:32:36,702 - web_server - INFO - Setting up needed data
2024-04-06 14:32:36,704 - web_server - INFO - >> Publishing data…
2024-04-06 14:32:36,705 - web_server - INFO - Publishing data to HASS instance
2024-04-06 14:32:36,723 - web_server - INFO - Successfully posted to sensor.p_pv_forecast = 2954
2024-04-06 14:32:36,741 - web_server - INFO - Successfully posted to sensor.p_load_forecast = 872
2024-04-06 14:32:36,742 - web_server - ERROR - P_deferrable0 was not found in results DataFrame. Optimization task may need to be relaunched or it did not converge to a solution.
2024-04-06 14:32:36,758 - web_server - INFO - Successfully posted to sensor.p_batt_forecast = -4166.4
2024-04-06 14:32:36,781 - web_server - INFO - Successfully posted to sensor.soc_batt_forecast = 86.62
2024-04-06 14:32:36,794 - web_server - INFO - Successfully posted to sensor.p_grid_forecast = 2084.4
2024-04-06 14:32:36,808 - web_server - INFO - Successfully posted to sensor.total_cost_fun_value = -0.39
2024-04-06 14:32:36,816 - web_server - INFO - Successfully posted to sensor.optim_status = Optimal
2024-04-06 14:32:36,829 - web_server - INFO - Successfully posted to sensor.unit_load_cost = 0.13
2024-04-06 14:32:36,843 - web_server - INFO - Successfully posted to sensor.unit_prod_price = 0.02