Use single_instance_allowed in hassio (#128060)

* use single_instance_allowed

* mark hassio as `single_config_entry`
This commit is contained in:
Michael 2024-10-11 23:37:14 +02:00 committed by GitHub
parent 8ee8421af7
commit 07021dbd65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 6 deletions

View File

@ -18,7 +18,4 @@ class HassIoConfigFlow(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."""
# We only need one Hass.io config entry
await self.async_set_unique_id(DOMAIN)
self._abort_if_unique_id_configured()
return self.async_create_entry(title="Supervisor", data={}) return self.async_create_entry(title="Supervisor", data={})

View File

@ -6,5 +6,6 @@
"documentation": "https://www.home-assistant.io/integrations/hassio", "documentation": "https://www.home-assistant.io/integrations/hassio",
"iot_class": "local_polling", "iot_class": "local_polling",
"quality_scale": "internal", "quality_scale": "internal",
"requirements": ["aiohasupervisor==0.2.0b0"] "requirements": ["aiohasupervisor==0.2.0b0"],
"single_config_entry": true
} }

View File

@ -2470,7 +2470,8 @@
"name": "Home Assistant Supervisor", "name": "Home Assistant Supervisor",
"integration_type": "hub", "integration_type": "hub",
"config_flow": false, "config_flow": false,
"iot_class": "local_polling" "iot_class": "local_polling",
"single_config_entry": true
}, },
"havana_shade": { "havana_shade": {
"name": "Havana Shade", "name": "Havana Shade",

View File

@ -38,4 +38,4 @@ async def test_multiple_entries(hass: HomeAssistant) -> None:
DOMAIN, context={"source": "system"} DOMAIN, context={"source": "system"}
) )
assert result["type"] is FlowResultType.ABORT assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "already_configured" assert result["reason"] == "single_instance_allowed"