Add My support for companion app settings (#17398)

This commit is contained in:
Franck Nijhof 2023-07-24 15:57:13 +02:00 committed by GitHub
parent 2c7e17ce89
commit 4fd5dfd6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -51,6 +51,9 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({
component: "calendar",
redirect: "/calendar",
},
companion_app: {
redirect: "#external-app-configuration",
},
config: {
redirect: "/config/dashboard",
},
@ -323,6 +326,15 @@ class HaPanelMy extends LitElement {
return;
}
if (this._redirect.redirect === "#external-app-configuration") {
if (this.hass.auth.external?.config.hasSettingsScreen) {
this.hass.auth.external!.fireMessage({ type: "config_screen/show" });
return;
}
this._error = "not_app";
return;
}
if (
this._redirect.component &&
!isComponentLoaded(this.hass, this._redirect.component)
@ -410,6 +422,18 @@ class HaPanelMy extends LitElement {
>`
);
break;
case "not_app":
error = this.hass.localize(
"ui.panel.my.not_app",
"link",
html`<a
target="_blank"
rel="noreferrer noopener"
href="https://companion.home-assistant.io/download"
>${this.hass.localize("ui.panel.my.download_app")}</a
>`
);
break;
default:
error = this.hass.localize("ui.panel.my.error") || "Unknown error";
}

View File

@ -1473,7 +1473,9 @@
"not_supported": "This redirect is not supported by your Home Assistant instance. Check the {link} for the supported redirects and the version they where introduced.",
"component_not_loaded": "This redirect is not supported by your Home Assistant instance. You need the integration {integration} to use this redirect.",
"no_supervisor": "This redirect is not supported by your Home Assistant installation. It needs either the Home Assistant Operating System or Home Assistant Supervised installation method. For more information, see the {docs_link}.",
"not_app": "This redirect only works from a mobile device that has the Home Assistant Companion app installed. {link}.",
"documentation": "documentation",
"download_app": "Click here to download the app",
"faq_link": "My Home Assistant FAQ",
"error": "An unknown error occurred"
},