diff --git a/homeassistant/components/systemmonitor/config_flow.py b/homeassistant/components/systemmonitor/config_flow.py index 34b28a1d47a0ceb4a4aa6b405cee6ff543a456cb..4be31f6944caa7fb9d2beefbfc85e2ba43d36e1f 100644 --- a/homeassistant/components/systemmonitor/config_flow.py +++ b/homeassistant/components/systemmonitor/config_flow.py @@ -8,8 +8,6 @@ from typing import Any import voluptuous as vol from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN -from homeassistant.config_entries import ConfigFlowResult -from homeassistant.core import callback from homeassistant.helpers import entity_registry as er from homeassistant.helpers.schema_config_entry_flow import ( SchemaCommonFlowHandler, @@ -100,12 +98,3 @@ class SystemMonitorConfigFlowHandler(SchemaConfigFlowHandler, domain=DOMAIN): def async_config_entry_title(self, options: Mapping[str, Any]) -> str: """Return config entry title.""" return "System Monitor" - - @callback - def async_create_entry( - self, data: Mapping[str, Any], **kwargs: Any - ) -> ConfigFlowResult: - """Finish config flow and create a config entry.""" - if self._async_current_entries(): - return self.async_abort(reason="already_configured") - return super().async_create_entry(data, **kwargs) diff --git a/homeassistant/components/systemmonitor/manifest.json b/homeassistant/components/systemmonitor/manifest.json index 21b9798ef466aa8a5d49c2e9aba3731b4c5c2718..bd16464b2906f7e7cae4191062d2df775dcbd10c 100644 --- a/homeassistant/components/systemmonitor/manifest.json +++ b/homeassistant/components/systemmonitor/manifest.json @@ -6,5 +6,6 @@ "documentation": "https://www.home-assistant.io/integrations/systemmonitor", "iot_class": "local_push", "loggers": ["psutil"], - "requirements": ["psutil-home-assistant==0.0.1", "psutil==6.1.1"] + "requirements": ["psutil-home-assistant==0.0.1", "psutil==6.1.1"], + "single_config_entry": true } diff --git a/homeassistant/components/systemmonitor/strings.json b/homeassistant/components/systemmonitor/strings.json index e595e6288532b9b64d08ae3741f70d48f9b6ec91..fb8a318ff453bc0de8c9f403874ec9c907abdc15 100644 --- a/homeassistant/components/systemmonitor/strings.json +++ b/homeassistant/components/systemmonitor/strings.json @@ -1,7 +1,7 @@ { "config": { "abort": { - "already_configured": "[%key:common::config_flow::abort::already_configured_service%]" + "single_instance_allowed": "[%key:common::config_flow::abort::already_configured_service%]" }, "step": { "user": { diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 96ca8a9f7669c395fa4108a6ffdbfa7e9848965e..9b58587543d44f9e8d79410f3a9d7b570a24d139 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -6183,7 +6183,8 @@ "name": "System Monitor", "integration_type": "hub", "config_flow": true, - "iot_class": "local_push" + "iot_class": "local_push", + "single_config_entry": true }, "tado": { "name": "Tado", diff --git a/tests/components/systemmonitor/test_config_flow.py b/tests/components/systemmonitor/test_config_flow.py index f5cc46da0960d09b10c2c37b6603249e899774b5..60a70da27a2aeb77796db520d1487013d923dfc0 100644 --- a/tests/components/systemmonitor/test_config_flow.py +++ b/tests/components/systemmonitor/test_config_flow.py @@ -48,17 +48,9 @@ async def test_form_already_configured( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) - assert result["step_id"] == "user" - assert result["type"] is FlowResultType.FORM - - result = await hass.config_entries.flow.async_configure( - result["flow_id"], - {}, - ) - await hass.async_block_till_done() assert result["type"] is FlowResultType.ABORT - assert result["reason"] == "already_configured" + assert result["reason"] == "single_instance_allowed" async def test_add_and_remove_processes(