Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forecast-cache action to weather-forecast-cache #320

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/forecasts.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ curl -i -H "Content-Type:application/json" -X POST -d '{"solcast_rooftop_id":"<y
For those who use the free plan and wish to use Solcast with MPC, you may like to cache the output of a Solcast weather forecast request, then reference it in your automated MPC actions:

```bash
# Run forecast and cache results (Recommended to run this 1-10 times a day, throughout the day)
curl -i -H 'Content-Type:application/json' -X POST -d {} http://localhost:5000/action/forecast-cache
# Run weather forecast and cache results (Recommended to run this 1-10 times a day, throughout the day)
curl -i -H 'Content-Type:application/json' -X POST -d {} http://localhost:5000/action/weather-forecast-cache

# Then run your regular MPC call (E.g. every 5 minutes)
curl -i -H 'Content-Type:application/json' -X POST -d {} http://localhost:5000/action/naive-mpc-optim
Expand All @@ -69,8 +69,8 @@ curl -i -H 'Content-Type:application/json' -X POST -d '{"weather_forecast_cache"
By default, if EMHASS finds a problem with the Solcast cache file, the cache will be automatically deleted. Due to the missing cache, the next optimization will run and pulling data from Solcast.
If you wish to make sure that a certain optimization will only use the cached data, (otherwise present an error) the runtime parameter `weather_forecast_cache_only` can be used:
```bash
# Run the forecast action 1-10 times a day
curl -i -H 'Content-Type:application/json' -X POST -d {} http://localhost:5000/action/forecast-cache
# Run the weather forecast action 1-10 times a day
curl -i -H 'Content-Type:application/json' -X POST -d {} http://localhost:5000/action/weather-forecast-cache

# Then run your regular MPC call (E.g. every 5 minutes) and make sure it only uses the Solcast cache. (do not pull from Solcast)
curl -i -H 'Content-Type:application/json' -X POST -d '{"weather_forecast_cache_only":true}' http://localhost:5000/action/naive-mpc-optim
Expand Down
6 changes: 3 additions & 3 deletions src/emhass/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def action_call(action_name):
runtimeparams = json.dumps(runtimeparams)

# Run action if weather_forecast_cache
if action_name == 'forecast-cache':
ActionStr = " >> Performing forecast, try to caching result"
if action_name == 'weather-forecast-cache':
ActionStr = " >> Performing weather forecast, try to caching result"
app.logger.info(ActionStr)
weather_forecast_cache(emhass_conf, params, runtimeparams, app.logger)
msg = f'EMHASS >> Forecast has run and results possibly cached... \n'
msg = f'EMHASS >> Weather Forecast has run and results possibly cached... \n'
if not checkFileLog(ActionStr):
return make_response(msg, 201)
return make_response(grabLog(ActionStr), 400)
Expand Down
Loading