Add single config entry to Analytics insights (#114427)

* Add single config entry to Analytics insights

* Add single config entry to Analytics insights

* Add single config entry to Analytics insights
This commit is contained in:
Joost Lekkerkerker 2024-03-31 15:47:24 +02:00 committed by GitHub
parent d5da0a053b
commit 52741d7114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,6 @@ class HomeassistantAnalyticsConfigFlow(ConfigFlow, domain=DOMAIN):
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle the initial step.""" """Handle the initial step."""
self._async_abort_entries_match()
errors: dict[str, str] = {} errors: dict[str, str] = {}
if user_input is not None: if user_input is not None:
if not user_input.get(CONF_TRACKED_INTEGRATIONS) and not user_input.get( if not user_input.get(CONF_TRACKED_INTEGRATIONS) and not user_input.get(

View File

@ -7,5 +7,6 @@
"integration_type": "service", "integration_type": "service",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["python_homeassistant_analytics"], "loggers": ["python_homeassistant_analytics"],
"requirements": ["python-homeassistant-analytics==0.6.0"] "requirements": ["python-homeassistant-analytics==0.6.0"],
"single_config_entry": true
} }

View File

@ -13,8 +13,7 @@
} }
}, },
"abort": { "abort": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
}, },
"error": { "error": {
"no_integration_selected": "You must select at least one integration to track" "no_integration_selected": "You must select at least one integration to track"

View File

@ -271,7 +271,8 @@
"name": "Home Assistant Analytics Insights", "name": "Home Assistant Analytics Insights",
"integration_type": "service", "integration_type": "service",
"config_flow": true, "config_flow": true,
"iot_class": "cloud_polling" "iot_class": "cloud_polling",
"single_config_entry": true
}, },
"android_ip_webcam": { "android_ip_webcam": {
"name": "Android IP Webcam", "name": "Android IP Webcam",

View File

@ -162,7 +162,7 @@ async def test_form_already_configured(
DOMAIN, context={"source": config_entries.SOURCE_USER} DOMAIN, context={"source": config_entries.SOURCE_USER}
) )
assert result["type"] == FlowResultType.ABORT assert result["type"] == FlowResultType.ABORT
assert result["reason"] == "already_configured" assert result["reason"] == "single_instance_allowed"
@pytest.mark.parametrize( @pytest.mark.parametrize(