Move PS4 URLs out of translatable strings (#154969)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
sairamsharan
2025-10-23 02:41:29 +05:30
committed by GitHub
parent b116619af1
commit d0c0247086
3 changed files with 21 additions and 5 deletions
+10 -2
View File
@@ -26,6 +26,7 @@ from .const import (
DEFAULT_ALIAS,
DEFAULT_NAME,
DOMAIN,
PS4_DOCS_URL,
)
CONF_MODE = "Config Mode"
@@ -66,7 +67,10 @@ class PlayStation4FlowHandler(ConfigFlow, domain=DOMAIN):
failed = await self.hass.async_add_executor_job(self.helper.port_bind, ports)
if failed in ports:
reason = PORT_MSG[failed]
return self.async_abort(reason=reason)
return self.async_abort(
reason=reason,
description_placeholders={"ps4_docs_url": PS4_DOCS_URL},
)
return await self.async_step_creds()
async def async_step_creds(
@@ -85,7 +89,11 @@ class PlayStation4FlowHandler(ConfigFlow, domain=DOMAIN):
except CredentialTimeout:
errors["base"] = "credential_timeout"
return self.async_show_form(step_id="creds", errors=errors)
return self.async_show_form(
step_id="creds",
errors=errors,
description_placeholders={"ps4_docs_url": PS4_DOCS_URL},
)
async def async_step_mode(
self, user_input: dict[str, Any] | None = None
+2
View File
@@ -9,6 +9,8 @@ from homeassistant.util.hass_dict import HassKey
if TYPE_CHECKING:
from . import PS4Data
PS4_DOCS_URL = "https://www.home-assistant.io/components/ps4/"
ATTR_MEDIA_IMAGE_URL = "media_image_url"
CONFIG_ENTRY_VERSION = 3
DEFAULT_NAME = "PlayStation 4"
+9 -3
View File
@@ -2,7 +2,13 @@
"config": {
"step": {
"creds": {
"description": "Credentials needed. Select **Submit** and then in the PS4 2nd Screen App, refresh devices and select the **Home-Assistant** device to continue."
"description": "Credentials needed. Select **Submit** and then in the PS4 2nd Screen App, refresh devices and select the **Home-Assistant** device to continue.",
"data": {
"token": "PSN Token"
},
"data_description": {
"token": "To get your PSN token, please follow these [instructions]({ps4_docs_url})."
}
},
"mode": {
"data": {
@@ -35,8 +41,8 @@
"credential_error": "Error fetching credentials.",
"no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]",
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"port_987_bind_error": "Could not bind to port 987. Refer to the [documentation](https://www.home-assistant.io/components/ps4/) for additional info.",
"port_997_bind_error": "Could not bind to port 997. Refer to the [documentation](https://www.home-assistant.io/components/ps4/) for additional info."
"port_987_bind_error": "Could not bind to port 987. Refer to the [documentation]({ps4_docs_url}) for additional info.",
"port_997_bind_error": "Could not bind to port 997. Refer to the [documentation]({ps4_docs_url}) for additional info."
}
},
"services": {