diff --git a/src/panels/config/cloud/account/cloud-remote-pref.ts b/src/panels/config/cloud/account/cloud-remote-pref.ts index dbc31c7a94..223f58dd1a 100644 --- a/src/panels/config/cloud/account/cloud-remote-pref.ts +++ b/src/panels/config/cloud/account/cloud-remote-pref.ts @@ -24,7 +24,7 @@ import { showCloudCertificateDialog } from "../dialog-cloud-certificate/show-dia @customElement("cloud-remote-pref") export class CloudRemotePref extends LitElement { - @property({ attribute: false }) public hass?: HomeAssistant; + @property({ attribute: false }) public hass!: HomeAssistant; @property() public cloudStatus?: CloudStatusLoggedIn; @@ -33,6 +33,8 @@ export class CloudRemotePref extends LitElement { return html``; } + const { remote_enabled } = this.cloudStatus.prefs; + const { remote_connected, remote_domain, @@ -42,12 +44,12 @@ export class CloudRemotePref extends LitElement { if (!remote_certificate) { return html`
- ${this.hass!.localize( + ${this.hass.localize( "ui.panel.config.cloud.account.remote.access_is_being_prepared" )}
@@ -57,25 +59,26 @@ export class CloudRemotePref extends LitElement { return html` -
- +
+ ${this.hass.localize( + `ui.panel.config.cloud.account.remote.${ + remote_connected ? "connected" : "not_connected" + }` + )}
- ${this.hass!.localize("ui.panel.config.cloud.account.remote.info")} - ${remote_connected - ? this.hass!.localize( - "ui.panel.config.cloud.account.remote.instance_is_available" - ) - : this.hass!.localize( - "ui.panel.config.cloud.account.remote.instance_will_be_available" - )} + ${this.hass.localize("ui.panel.config.cloud.account.remote.info")} + ${this.hass.localize( + `ui.panel.config.cloud.account.remote.${ + remote_connected + ? "instance_is_available" + : "instance_will_be_available" + }` + )} https://${remote_domain}. + +
+

+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.remote_enabled.caption" + )} +

+
+ +
+
+

+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.remote_enabled.description" + )} +

${this.hass!.localize( + >${this.hass.localize( "ui.panel.config.cloud.account.remote.link_learn_how_it_works" )} @@ -101,7 +123,7 @@ export class CloudRemotePref extends LitElement { ? html`
- ${this.hass!.localize( + ${this.hass.localize( "ui.panel.config.cloud.account.remote.certificate_info" )} @@ -123,9 +145,9 @@ export class CloudRemotePref extends LitElement { try { if (toggle.checked) { - await connectCloudRemote(this.hass!); + await connectCloudRemote(this.hass); } else { - await disconnectCloudRemote(this.hass!); + await disconnectCloudRemote(this.hass); } fireEvent(this, "ha-refresh-cloud-status"); } catch (err) { @@ -145,7 +167,7 @@ export class CloudRemotePref extends LitElement { .break-word { overflow-wrap: break-word; } - .switch { + .connection-status { position: absolute; right: 24px; top: 24px; @@ -163,6 +185,25 @@ export class CloudRemotePref extends LitElement { .spacer { flex-grow: 1; } + .remote-enabled { + display: flex; + margin-top: 1.5em; + } + .remote-enabled + p { + margin-top: 0.5em; + } + h3 { + margin: 0 0 8px 0; + } + .remote-enabled h3 { + flex-grow: 1; + margin: 0; + } + .remote-enabled-switch { + margin-top: 0.25em; + margin-right: 7px; + margin-left: 0.5em; + } `; } } diff --git a/src/translations/en.json b/src/translations/en.json index 011cbcdfa5..108f4cf94f 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1794,10 +1794,16 @@ }, "remote": { "title": "Remote Control", - "access_is_being_prepared": "Remote access is being prepared. We will notify you when it's ready.", + "connected": "Connected", + "not_connected": "Not Connected", + "access_is_being_prepared": "Remote control is being prepared. We will notify you when it's ready.", "info": "Home Assistant Cloud provides a secure remote connection to your instance while away from home.", "instance_is_available": "Your instance is available at", "instance_will_be_available": "Your instance will be available at", + "remote_enabled": { + "caption": "Automatically connect", + "description": "Enable this option to make sure that your Home Assistant instance is always remotely accessible." + }, "link_learn_how_it_works": "Learn how it works", "certificate_info": "Certificate Info" },