Skip to content
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

Make it possible to set options and system options on entry create #27044

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ async def _async_finish_flow(self, flow, result):
domain=result["handler"],
title=result["title"],
data=result["data"],
options={},
system_options={},
options=result.get("options", {}),
system_options=result.get("system_options", {}),
source=flow.context["source"],
connection_class=flow.CONNECTION_CLASS,
)
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/data_entry_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def async_create_entry(
data: Dict,
description: Optional[str] = None,
description_placeholders: Optional[Dict] = None,
**kwargs: Any,
) -> Dict[str, Any]:
"""Finish config flow and create a config entry."""
return {
Expand All @@ -219,6 +220,7 @@ def async_create_entry(
"data": data,
"description": description,
"description_placeholders": description_placeholders,
**kwargs,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a fan because it feels weird. Data should be the data for the config entry, all other is metadata about the step.

Not sure what the correct thing is .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever way that makes it possible to set disable_new_entities to True for a newly created config entry works for me. I wouldn't want to handle disabling the entities manually, and it would be weird if the UI shows new entities being enabled by default where in fact they are created disabled.

Anyway, not sure I understand your concern, but I do think this (options and system_options) is stuff about the config entry, it's not a step thing. It gets persistent with the config entry, UI shows the new entity enablement toggle for the entry, etc.

Or maybe you're concerned about opening the big kwargs possibility to data_entry_flow? As mentioned, that could be left alone and replaced by doing this in ConfigFlow just for options and system_options.

}

@callback
Expand Down