From ddb523c133f3d67039bb174584c9f814cfadea85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 13 Apr 2023 11:11:47 +0200 Subject: [PATCH] Use certificate status for better feedback when initialising remote (#16147) --- src/data/cloud.ts | 7 +++++ .../config/cloud/account/cloud-remote-pref.ts | 28 +++++++++++++++---- src/translations/en.json | 3 ++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/data/cloud.ts b/src/data/cloud.ts index 353a5601a7..454bbcc482 100644 --- a/src/data/cloud.ts +++ b/src/data/cloud.ts @@ -40,6 +40,13 @@ export interface CloudStatusLoggedIn { remote_domain: string | undefined; remote_connected: boolean; remote_certificate: undefined | CertificateInformation; + remote_certificate_status: + | null + | "error" + | "generating" + | "loaded" + | "loading" + | "ready"; http_use_ssl: boolean; active_subscription: boolean; } diff --git a/src/panels/config/cloud/account/cloud-remote-pref.ts b/src/panels/config/cloud/account/cloud-remote-pref.ts index 114bc0cbdf..d9ac6bd89c 100644 --- a/src/panels/config/cloud/account/cloud-remote-pref.ts +++ b/src/panels/config/cloud/account/cloud-remote-pref.ts @@ -31,10 +31,14 @@ export class CloudRemotePref extends LitElement { const { remote_enabled } = this.cloudStatus.prefs; - const { remote_connected, remote_domain, remote_certificate } = - this.cloudStatus; + const { + remote_connected, + remote_domain, + remote_certificate, + remote_certificate_status, + } = this.cloudStatus; - if (!remote_certificate) { + if (!remote_certificate || remote_certificate_status !== "ready") { return html`
- ${this.hass.localize( - "ui.panel.config.cloud.account.remote.access_is_being_prepared" - )} + ${remote_certificate_status === "error" + ? this.hass.localize( + "ui.panel.config.cloud.account.remote.cerificate_error" + ) + : remote_certificate_status === "loading" + ? this.hass.localize( + "ui.panel.config.cloud.account.remote.cerificate_loading" + ) + : remote_certificate_status === "loaded" + ? this.hass.localize( + "ui.panel.config.cloud.account.remote.cerificate_loaded" + ) + : this.hass.localize( + "ui.panel.config.cloud.account.remote.access_is_being_prepared" + )}
`; diff --git a/src/translations/en.json b/src/translations/en.json index f05539e79e..e3e1bfe853 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2736,6 +2736,9 @@ "not_connected": "Not Connected", "reconnecting": "Not connected. Trying to reconnect.", "access_is_being_prepared": "Remote control is being prepared. We will notify you when it's ready.", + "cerificate_loading": "Your certificate is loading.", + "cerificate_loaded": "Your certificate is loaded, waiting for validation.", + "cerificate_error": "There was an error generating the certficate, check your logs.", "info": "Home Assistant Cloud provides a secure remote connection to your instance while away from home.", "instance_is_available": "Your instance is available at your", "instance_will_be_available": "Your instance will be available at your",