Use single_config_entry in Accuweather manifest (#111548)

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
This commit is contained in:
Maciej Bieniek 2024-03-13 17:38:37 +01:00 committed by GitHub
parent 8bc3286343
commit 3d9a9c3847
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 10 deletions

View File

@ -41,11 +41,6 @@ class AccuWeatherFlowHandler(ConfigFlow, domain=DOMAIN):
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle a flow initialized by the user.""" """Handle a flow initialized by the user."""
# Under the terms of use of the API, one user can use one free API key. Due to
# the small number of requests allowed, we only allow one integration instance.
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
errors = {} errors = {}
if user_input is not None: if user_input is not None:

View File

@ -8,5 +8,6 @@
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["accuweather"], "loggers": ["accuweather"],
"quality_scale": "platinum", "quality_scale": "platinum",
"requirements": ["accuweather==2.1.1"] "requirements": ["accuweather==2.1.1"],
"single_config_entry": true
} }

View File

@ -17,9 +17,6 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_api_key": "[%key:common::config_flow::error::invalid_api_key%]", "invalid_api_key": "[%key:common::config_flow::error::invalid_api_key%]",
"requests_exceeded": "The allowed number of requests to Accuweather API has been exceeded. You have to wait or change API Key." "requests_exceeded": "The allowed number of requests to Accuweather API has been exceeded. You have to wait or change API Key."
},
"abort": {
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
} }
}, },
"entity": { "entity": {

View File

@ -15,7 +15,8 @@
"name": "AccuWeather", "name": "AccuWeather",
"integration_type": "service", "integration_type": "service",
"config_flow": true, "config_flow": true,
"iot_class": "cloud_polling" "iot_class": "cloud_polling",
"single_config_entry": true
}, },
"acer_projector": { "acer_projector": {
"name": "Acer Projector", "name": "Acer Projector",