-
Notifications
You must be signed in to change notification settings - Fork 0
Add config flow for Sony Projector integration #9
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: sony_projector_switch_upgrade
Are you sure you want to change the base?
Add config flow for Sony Projector integration #9
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| async def async_step_user( | ||
| self, user_input: Mapping[str, Any] | None = None | ||
| ) -> ConfigFlowResult: | ||
| """Handle a flow initiated by the user.""" | ||
|
|
||
| errors: dict[str, str] = {} | ||
|
|
||
| if user_input is not None: | ||
| host = user_input[CONF_HOST] | ||
|
|
||
| try: | ||
| await _async_validate_input(self.hass, user_input) | ||
| except CannotConnect: | ||
| errors["base"] = "cannot_connect" | ||
| except UnknownError: | ||
| errors["base"] = "unknown" | ||
| else: | ||
| await self.async_set_unique_id(host) | ||
| self._abort_if_unique_id_configured(updates={CONF_HOST: host}) | ||
|
|
||
| return self.async_create_entry( | ||
| title=DEFAULT_TITLE, | ||
| data={CONF_HOST: 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.
Config entries created but integration never sets up entities
The flow now calls async_create_entry and the manifest enables config_flow, but the integration still only exposes the legacy setup_platform in switch.py and has no async_setup_entry to load platforms from a config entry. After users complete the UI flow, Home Assistant will store the entry but never create a switch, leaving the projector unusable. Config entry support (e.g. forwarding to the switch platform) needs to be implemented in the integration before exposing a flow.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_6903eb25bc0c8333a45b6d20d2546712