Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add optional location based region to dwd_weather_warnings #96027
Add optional location based region to dwd_weather_warnings #96027
Changes from 6 commits
bb7019f
051edc7
327680c
f4e72b6
3135078
ee0f181
b3c5908
13e1651
8edddbe
345ee77
df914c2
f7f1ce3
848cfc5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
All of this seems like duplicated logic which the coordinator also needs to handle, can you try to make it happen as a result of calling
DwdWeatherWarningsCoordinator.async_config_entry_first_refresh
instead?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.
I'll see what I can do, not familiar with that method though
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.
Took a few tries but I got it (see last 3 commits)
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.
This seems a bit unnecessary. Maybe just do a set intersection and check the length?
Not sure if my suggestion is more readable though.
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.
In my opinion the current solution is easier to understand though not as efficient probably
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.
That's fine, it's a matter of taste 👍
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.
I'd suggest to store
device_tracker
in the object instead, and just do like this here: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.
I'm not following completely. Do you mean having it defined in the
__init__
asself.device_tracker = None
and doing the initialization once inasync_config_entry_first_refresh
?Edit: Nevermind got it
Check warning on line 34 in homeassistant/components/dwd_weather_warnings/util.py
Codecov / codecov/patch
homeassistant/components/dwd_weather_warnings/util.py#L34