-
Notifications
You must be signed in to change notification settings - Fork 0
Provider independence #11
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
base: main
Are you sure you want to change the base?
Conversation
I added a separate sensor name for each API service. The save_forecasts_to_db function now checks which service we are using, and accordingly maps the value we are interested in to the relevant Flexmeasures sensor. Signed-off-by: Devansh Sharma <46666171+devansh287@users.noreply.github.com>
Here we ensure that the mock API response is as per the API service provider. Also popping the values for the API service provider sensors in commands. Signed-off-by: Devansh Sharma <46666171+devansh287@users.noreply.github.com>
Really appreciate you pointing this out, @nhoening. I just added "Closes #10" to the PR description. Will do so for all future PRs and their related issues. |
|
I haven't tested yet but one thing I can say: Earlier you added a Readme section called "Extending to Other Weather API Services" - I believe that now needs an extension, to also add the mapping for the service in the right place. |
@nhoening, I am waiting for the review on my changes to the code to be completed. Once that is done, I will accordingly update the README in this PR itself or a separate PR, whatever you prefer. |
|
@nhoening just bumping this |
|
Yes, sorry. |
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
nhoening
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two failing tests (which work well on main) - please investigate.
Here some output:
[FLEXMEASURES] Task get-weather-forecasts encountered a problem: "'time_epoch'".
More details: {'src_module': '/home/nicolas/workspace/seita/flexmeasures-weather/flexmeasures_weather/utils/weather.py', 'src_linenr': 212, 'src_func': 'save_forecasts_in_db', 'src_code': 'time_key = fc["dt"] if provider == "OWM" else fc["time_epoch"]'}
You'll have to git pull, as I fixed a formatting error that black didn't like during linting (are you running pre-commit locally?)
|
@devansh287 just bumping this :) |
Description
I have made the mapping of the data received from Weather API to Flexmeasures sensors independent of what is going on in OWM. I did that by modifying the mapping dicts in
sensor_specs.pyto include fields for each weather api service provider. Then I modified thesave_forecasts_to_dbfunction inweather.pyto check which API service provider it is and accordingly map the data received from the api call to the flexmeasures sensor. I also made the test mock API response be as per the API service provider.This PR Closes #10.
How to test
One can test by running the flexmeasures get-weather-forecasts command on the CLI.