From b61919ec719b8adf4f7dd9c03f5e896c73a27968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Mon, 27 May 2024 15:58:22 +0200 Subject: [PATCH] Add helper strings for myuplink application credentials (#115349) --- .../components/myuplink/application_credentials.py | 11 ++++++++++- homeassistant/components/myuplink/strings.json | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/myuplink/application_credentials.py b/homeassistant/components/myuplink/application_credentials.py index fe3cd22f037..a083418ec3a 100644 --- a/homeassistant/components/myuplink/application_credentials.py +++ b/homeassistant/components/myuplink/application_credentials.py @@ -3,7 +3,7 @@ from homeassistant.components.application_credentials import AuthorizationServer from homeassistant.core import HomeAssistant -from .const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN +from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationServer: @@ -12,3 +12,12 @@ async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationSe authorize_url=OAUTH2_AUTHORIZE, token_url=OAUTH2_TOKEN, ) + + +async def async_get_description_placeholders(hass: HomeAssistant) -> dict[str, str]: + """Return description placeholders for the credentials dialog.""" + return { + "more_info_url": f"https://www.home-assistant.io/integrations/{DOMAIN}/", + "create_creds_url": "https://dev.myuplink.com/apps", + "callback_url": "https://my.home-assistant.io/redirect/oauth", + } diff --git a/homeassistant/components/myuplink/strings.json b/homeassistant/components/myuplink/strings.json index e4aea8c5a5e..30cfefe5e18 100644 --- a/homeassistant/components/myuplink/strings.json +++ b/homeassistant/components/myuplink/strings.json @@ -1,4 +1,7 @@ { + "application_credentials": { + "description": "Follow the [instructions]({more_info_url}) to give Home Assistant access to your myUplink account. You also need to create application credentials linked to your account:\n1. Go to [Applications at myUplink developer site]({create_creds_url}) and get credentials from an existing application or click **Create New Application**.\n1. Set appropriate Application name and Description\n2. Enter `{callback_url}` as Callback Url\n\n" + }, "config": { "step": { "pick_implementation": {