Skip to content

Commit

Permalink
Fixing missing inputs to treat runtime params method
Browse files Browse the repository at this point in the history
  • Loading branch information
davidusb-geek committed Dec 25, 2024
1 parent 5ca132f commit fd31007
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/emhass/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def get_load_forecast(
if self.get_data_from_file:
filename_path = self.emhass_conf["data_path"] / "test_df_final.pkl"
with open(filename_path, "rb") as inp:
rh.df_final, days_list, var_list = pickle.load(inp)
rh.df_final, days_list, var_list, rh.ha_config = pickle.load(inp)
self.var_load = var_list[0]
self.retrieve_hass_conf["sensor_power_load_no_var_loads"] = (
self.var_load
Expand Down
1 change: 1 addition & 0 deletions tests/test_command_line_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def test_set_input_data_dict(self):
"load_power_forecast": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"load_cost_forecast": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"prod_price_forecast": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"prediction_horizon": 10,
}
runtimeparams_json = json.dumps(runtimeparams)
params = copy.deepcopy(json.loads(self.params_json))
Expand Down
3 changes: 3 additions & 0 deletions tests/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def test_get_forecasts_with_lists(self):
set_type,
logger,
emhass_conf,
{},
)
# Build RetrieveHass Object
rh = RetrieveHass(
Expand Down Expand Up @@ -560,6 +561,7 @@ def test_get_forecasts_with_longer_lists(self):
set_type,
logger,
emhass_conf,
{},
)
# Create Forecast Object
fcst = Forecast(
Expand Down Expand Up @@ -653,6 +655,7 @@ def test_get_forecasts_with_lists_special_case(self):
set_type,
logger,
emhass_conf,
{},
)
# Create RetrieveHass Object
rh = RetrieveHass(
Expand Down
6 changes: 6 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def test_treat_runtimeparams(self):
set_type,
logger,
emhass_conf,
{},
)
self.assertIsInstance(params, str)
params = json.loads(params)
Expand All @@ -184,6 +185,7 @@ def test_treat_runtimeparams(self):
set_type,
logger,
emhass_conf,
{},
)
self.assertIsInstance(params, str)
params = json.loads(params)
Expand Down Expand Up @@ -249,6 +251,7 @@ def test_treat_runtimeparams(self):
set_type,
logger,
emhass_conf,
{},
)
self.assertIsInstance(params, str)
params = json.loads(params)
Expand Down Expand Up @@ -344,6 +347,7 @@ def test_treat_runtimeparams_failed(self):
set_type,
logger,
emhass_conf,
{},
)

self.assertTrue(
Expand Down Expand Up @@ -402,6 +406,7 @@ def test_treat_runtimeparams_failed(self):
set_type,
logger,
emhass_conf,
{},
)
self.assertIsInstance(runtimeparams["pv_power_forecast"], list)
self.assertIsInstance(runtimeparams["load_power_forecast"], list)
Expand Down Expand Up @@ -433,6 +438,7 @@ def test_treat_runtimeparams_failed(self):
set_type,
logger,
emhass_conf,
{},
)
self.assertIsInstance(runtimeparams["pv_power_forecast"], str)
self.assertIsInstance(runtimeparams["load_power_forecast"], str)
Expand Down

0 comments on commit fd31007

Please sign in to comment.