davidusb-geek / emhass

emhass: Energy Management for Home Assistant, is a Python module designed to optimize your home energy interfacing with Home Assistant.
MIT License
284 stars 54 forks source link

Issue #154: "perform_backtest": "false" has no effect #174

Closed davidusb-geek closed 8 months ago

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (d37aac3) 89.96% compared to head (6db8415) 89.96%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #174 +/- ## ======================================= Coverage 89.96% 89.96% ======================================= Files 6 6 Lines 1644 1644 ======================================= Hits 1479 1479 Misses 165 165 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

davidusb-geek commented 8 months ago

Hi @GeoDerp . Will it be possible for you to check this? This is related to #154. I'm able to reproduce the issue by just summoning:

curl -i -H "Content-Type:application/json" -X POST -d '{"perform_backtest": "False"}' http://localhost:5000/action/forecast-model-fit

Which don't take the passed perform_backtest=False and performs the back-testing nevertheless

davidusb-geek commented 8 months ago

I added some tests to aid debug this in this PR but tests are passsing correctly

GeoDerp commented 8 months ago

I'll see if I can have a look tomorrow (it's 1am currently)

GeoDerp commented 8 months ago

I wonder if it's something dumb like:

curl -i -H "Content-Type:application/json" -X POST -d '{"perform_backtest": "false"}' http://localhost:5000/action/forecast-model-fit

Or

curl -i -H "Content-Type:application/json" -X POST -d '{"perform_backtest": False}' http://localhost:5000/action/forecast-model-fit
davidusb-geek commented 8 months ago

I've just tested this:

curl -i -H "Content-Type:application/json" -X POST -d '{"perform_backtest": "false"}' http://localhost:5000/action/forecast-model-fit

And still using the "perform_backtest": "true".

This one:

curl -i -H "Content-Type:application/json" -X POST -d '{"perform_backtest": False}' http://localhost:5000/action/forecast-model-fit

just exists as bad request

GeoDerp commented 8 months ago

I think its the: https://github.com/davidusb-geek/emhass/blob/d37aac3ae18fc54f340fb7d1ed4a67c353a5022f/src/emhass/machine_learning_forecaster.py#L166

Needs to be:

if perform_backtest is True:

for some reason.

davidusb-geek commented 8 months ago

I think its the:

https://github.com/davidusb-geek/emhass/blob/d37aac3ae18fc54f340fb7d1ed4a67c353a5022f/src/emhass/machine_learning_forecaster.py#L166

Needs to be:

if perform_backtest is True:

for some reason.

This is very strage. That is basic Python, I don't see how could that not work. But I will test it with your PR.