1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Move translatable URL out of strings.json for airnow integration (#154557)

Co-authored-by: jbouwh <jan@jbsoft.nl>
This commit is contained in:
Akanksha
2025-10-19 00:28:29 +05:30
committed by Franck Nijhof
parent 56ae579e83
commit 66bb0db08b
3 changed files with 9 additions and 1 deletions

View File

@@ -26,6 +26,10 @@ from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
# Documentation URL for API key generation
_API_KEY_URL = "https://docs.airnowapi.org/account/request/"
async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> bool:
"""Validate the user input allows us to connect.
@@ -114,6 +118,7 @@ class AirNowConfigFlow(ConfigFlow, domain=DOMAIN):
),
}
),
description_placeholders={"api_key_url": _API_KEY_URL},
errors=errors,
)

View File

@@ -2,7 +2,7 @@
"config": {
"step": {
"user": {
"description": "To generate API key go to https://docs.airnowapi.org/account/request/",
"description": "To generate API key go to {api_key_url}",
"data": {
"api_key": "[%key:common::config_flow::data::api_key%]",
"latitude": "[%key:common::config_flow::data::latitude%]",

View File

@@ -25,6 +25,9 @@ async def test_form(
)
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {}
assert result["description_placeholders"] == {
"api_key_url": "https://docs.airnowapi.org/account/request/"
}
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], config)
assert result2["type"] is FlowResultType.CREATE_ENTRY