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
Modernize template weather #98064
Modernize template weather #98064
Conversation
Hey there @PhracturedBlue, @tetienne, @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
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.
Should we perhaps deprecate the forecast_template
configuration parameter and replace with daily_forecast_template
, hourly_forecast_template
, twice_daily_forecast_template
?
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
if result is None or isinstance(result, TemplateError): | ||
return None |
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.
If the template rendered to None, it's fine to return None, but if we got a TemplateError, shouldn't we raise?
Also, we should check the result is a list and raise if it isn't.
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.
The template will take care of that and skip the validator and go directly to _update_forecast()
.
Didn't we say to always return an empty list even if there is something wrong with the forecast?
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.
LGTM, thanks @gjohansson-ST 👍
9476f25
to
427b1a0
Compare
Deprecation
The
template
weather entity have been updated:forecast
state attribute is deprecated and will be removed in Home Assistant Core 2024.3, users should instead call the serviceweather.get_forecast
Proposed change
Modernize SMHI weather:
weather.get_forecast
serviceType of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: