-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Update vasttrafik integration to be ui configurable #150886
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: dev
Are you sure you want to change the base?
Conversation
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.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
f2f3551 to
91ffda0
Compare
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.
Some initial comments where-of some might be a bit big so feel free to ask if it's not entirely clear.
Besides that you have subentries, there should be plenty of previous PR's to look at.
35590e4 to
2228584
Compare
Simplifies the usage of the validate_api_credentials function
|
@zbrox please avoid force-pushing. Instead merge upstream/dev to your branch, either manually or by using this button: |
Reuse the same schema Use text selector for simpler input of multivalue filters
Maybe add an optional configuration for it in the departure board configuration
Sorry, this was probably me making a change on a previous commit which I forgot I have already pushed anad |
|
CI is failing. |
| return self.async_create_entry(title="Västtrafik", data=user_input) | ||
|
|
||
| return self.async_show_form( | ||
| step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors or {} |
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.
| step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors or {} | |
| step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors |
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.
Mypy is complaining if we remove the default value here. Since above the errors can be reset to be a 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.
Sorry, didn't check but default error to be an empty dict and not None
| data_schema=self.add_suggested_values_to_schema( | ||
| STEP_USER_DATA_SCHEMA, user_input or entry.data | ||
| ), | ||
| errors=errors or {}, |
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.
| errors=errors or {}, | |
| errors=errors, |
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.
Same as above
|
|
||
| station_schema = vol.Schema( | ||
| { | ||
| vol.Required("station"): vol.In(station_options), |
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 you use the SelectSelectorinstead this could be presented nicely with the proper labels instead of just the station value.
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 a minute :)
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.
Something like in 82ae6ad maybe?
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.
station_options = [
SelectOptionDict(value=station["value"], label=station["label"])
for station in self._search_results
]
...
vol.Required("station"): SelectSelector(
SelectSelectorConfig(options=station_options)
)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.
Are you ok with the last commit?
Co-authored-by: G Johansson <[email protected]>
Co-authored-by: G Johansson <[email protected]>
Proposed change
The Västtrafik integration was legacy and you couldn't configure it from the UI. With this change it is configurable from the UI and should keep backwards compatibility.
First time contributing and I was unsure for most of the process when it comes to taking an integration out of legacy. Open to whatever feedback!
Type of change
Additional information
Checklist
ruff format 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.To help with the load of incoming pull requests: