Add ability to pass integration domain to report_usage (#130705)

* Add ability to pass integration domain to report_usage

* Adjust

* Fix

* Add tests

* Update test_frame.py

* Update test_frame.py

* Update test_frame.py

* Update test_frame.py

* Update test_frame.py

* Update test_frame.py

* Finish tests

* Docstring

* Replace logger warning with report_usage

* Improve

* docstring

* Improve tests

* Adjust docstring for exclude_integrations

* Fix behavior and improve tests
This commit is contained in:
epenet
2024-11-21 16:01:36 +01:00
committed by GitHub
parent 42dcfae6e7
commit 9add3a6c9b
4 changed files with 178 additions and 22 deletions

View File

@@ -2887,18 +2887,12 @@ class ConfigFlow(ConfigEntryBaseFlow):
) -> ConfigFlowResult:
"""Finish config flow and create a config entry."""
if self.source in {SOURCE_REAUTH, SOURCE_RECONFIGURE}:
report_issue = async_suggest_report_issue(
self.hass, integration_domain=self.handler
)
_LOGGER.warning(
(
"Detected %s config flow creating a new entry, "
"when it is expected to update an existing entry and abort. "
"This will stop working in %s, please %s"
),
self.source,
"2025.11",
report_issue,
report_usage(
f"creates a new entry in a '{self.source}' flow, "
"when it is expected to update an existing entry and abort",
core_behavior=ReportBehavior.LOG,
breaks_in_ha_version="2025.11",
integration_domain=self.handler,
)
result = super().async_create_entry(
title=title,