diff --git a/src/dialogs/restart/dialog-restart.ts b/src/dialogs/restart/dialog-restart.ts
index 9b8491e68f8e..3e409fb3cc4c 100644
--- a/src/dialogs/restart/dialog-restart.ts
+++ b/src/dialogs/restart/dialog-restart.ts
@@ -1,6 +1,12 @@
import "@material/mwc-list/mwc-list";
-import { mdiAutoFix, mdiPower, mdiPowerCycle, mdiRefresh } from "@mdi/js";
-import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
+import {
+ mdiAutoFix,
+ mdiLifebuoy,
+ mdiPower,
+ mdiPowerCycle,
+ mdiRefresh,
+} from "@mdi/js";
+import { CSSResultGroup, LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { isComponentLoaded } from "../../common/config/is_component_loaded";
import { fireEvent } from "../../common/dom/fire_event";
@@ -14,8 +20,8 @@ import {
ignoreSupervisorError,
} from "../../data/hassio/common";
import {
- fetchHassioHostInfo,
HassioHostInfo,
+ fetchHassioHostInfo,
rebootHost,
shutdownHost,
} from "../../data/hassio/host";
@@ -54,18 +60,6 @@ class DialogRestart extends LitElement {
this._loadingHostInfo = false;
}
}
-
- const showReload = this.hass.userData?.showAdvanced;
- const showRebootShutdown = !!this._hostInfo;
-
- // Present restart core dialog if no host actions and not advanced mode as it's the only option
- if (!showReload && !showRebootShutdown) {
- this._open = false;
- this._showRestartDialog().then(() => this.closeDialog());
- return;
- }
-
- await this.updateComplete;
}
public closeDialog(): void {
@@ -145,15 +139,14 @@ class DialogRestart extends LitElement {
-
- ${showRebootShutdown
- ? html`
-
-
+
+
+ ${showRebootShutdown
+ ? html`
-
-
- `
- : nothing}
+ `
+ : nothing}
+
+
+
+
+
+ ${this.hass.localize(
+ "ui.dialogs.restart.restart-safe-mode.title"
+ )}
+
+
+ ${this.hass.localize(
+ "ui.dialogs.restart.restart-safe-mode.description"
+ )}
+
+
+
+
`}
`;
@@ -262,6 +279,47 @@ class DialogRestart extends LitElement {
}
}
+ private async _restartSafeMode(ev) {
+ if (!shouldHandleRequestSelectedEvent(ev)) {
+ return;
+ }
+ this._showRestartSafeModeDialog();
+ }
+
+ private async _showRestartSafeModeDialog() {
+ const confirmed = await showConfirmationDialog(this, {
+ title: this.hass.localize(
+ "ui.dialogs.restart.restart-safe-mode.confirm_title"
+ ),
+ text: this.hass.localize(
+ "ui.dialogs.restart.restart-safe-mode.confirm_description"
+ ),
+ confirmText: this.hass.localize(
+ "ui.dialogs.restart.restart-safe-mode.confirm_action"
+ ),
+ destructive: true,
+ });
+
+ if (!confirmed) {
+ return;
+ }
+
+ this.closeDialog();
+
+ try {
+ await this.hass.callService("homeassistant", "restart", {
+ safe_mode: true,
+ });
+ } catch (err: any) {
+ showAlertDialog(this, {
+ title: this.hass.localize(
+ "ui.dialogs.restart.restart-safe-mode.failed"
+ ),
+ text: err.message,
+ });
+ }
+ }
+
private async _hostReboot(ev): Promise {
if (!shouldHandleRequestSelectedEvent(ev)) {
return;
@@ -382,6 +440,10 @@ class DialogRestart extends LitElement {
background-color: #0b1d29;
color: #fff;
}
+ .restart-safe-mode {
+ background-color: #e48629;
+ color: #fff;
+ }
.divider {
height: 1px;
background-color: var(--divider-color);
diff --git a/src/translations/en.json b/src/translations/en.json
index c944970cbc49..2752f93c70e9 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -1233,6 +1233,14 @@
"confirm_action": "Shut down",
"shutting_down": "Shutting down system",
"failed": "Failed to shut down system"
+ },
+ "restart-safe-mode": {
+ "title": "Restart Home Assistant in safe mode",
+ "description": "Restart Home Assistant without loading any custom integrations and modules.",
+ "confirm_title": "Restart Home Assistant in safe mode?",
+ "confirm_description": "This will restart Home Assistant without loading any custom integrations and modules.",
+ "confirm_action": "Restart",
+ "failed": "Failed to restart Home Assistant"
}
},
"aliases": {