-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Convert Vallox integration to config flow #62780
Conversation
Hey there @andre-richter, mind taking a look at this pull request as it has been labeled with an integration ( |
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.
Thanks. 👍
Please add test coverage for the config flow. We need 100% for these.
Awesome. Thanks a lot for your effort 👍 |
Good point, added some more tests and improved the quality of the existing tests a bit too. How can I check the test coverage locally? 🤔 I ran |
Inside the venv |
Updated docs: home-assistant/home-assistant.io#20861 |
This has now been fixed. |
One thing I really don't know is if it's possible to support unloading the integration with |
I peeked into the vallox websocket API. Although I don’t know anything about websockets, it seems a connection is created (and closed again) for each request, and not once on class instantiation and kept open. So maybe no cleanup needed. |
Passes locally:
|
I checked the CI, and it looks like the problem was github having issues at the time and everything is fine with |
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.
Looks good 👍
Would you please retest yaml imports before I merge this?
I just tested this, and noticed no issues 👍. Config entry created from import was there, and you get the warning/hint to remove the yaml entry. |
Tested everything once more, seems to work in line with expectations. |
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 address the comments in a new PR. Thanks!
try: | ||
await validate_host(self.hass, host) | ||
except InvalidHost: | ||
_LOGGER.exception("An invalid host is configured for Vallox") |
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.
We normally only log the stack trace for unknown exceptions.
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.
Thanks, fixed this and all other comments in #63032.
"step": { | ||
"user": { | ||
"title": "Vallox", | ||
"description": "Set up the Vallox integration. If you have problems with configuration go to https://www.home-assistant.io/integrations/vallox.", |
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.
Links are best to put in a description placeholder to avoid translation of the link.
"description": "Set up the Vallox integration. If you have problems with configuration go to https://www.home-assistant.io/integrations/vallox.", | ||
"data": { | ||
"host": "[%key:common::config_flow::data::host%]", | ||
"name": "[%key:common::config_flow::data::name%]" |
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's no name item in the user step form.
"error": { | ||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", | ||
"invalid_host": "[%key:common::config_flow::error::invalid_host%]" | ||
} |
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.
We're missing a string for unknown error.
}, | ||
"abort": { | ||
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]" | ||
}, |
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.
We're missing many abort reasons.
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.
Looks like invalid_host
, cannot_connect
, unknown
are missing here
assert result["reason"] == "already_configured" | ||
|
||
|
||
async def test_import_cannot_connect_OSError(hass: HomeAssistant) -> 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.
Please use lowercase snake_case function names.
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 thought about it too, but because no linter or pre-commit check complained I just assumed it was fine. Could/should it be enforced somehow? 🤔
Breaking change
The Vallox integration migrated to configuration via the UI. Configuring Vallox via YAML configuration has been deprecated and will be removed in a future Home Assistant release.
Your existing YAML configuration is automatically imported on upgrade to this release; and thus can be safely removed from your YAML configuration after upgrading.
Proposed change
Update the Vallox integration to support UI configuration, and make the initialization of the integration more idiomatic. See #62308 (comment) and #61708 for more context.
Type 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
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: