From 9e2c6d343a9b87cbe0ea619f88f668193c50fbbb Mon Sep 17 00:00:00 2001 From: michaelloercher Date: Mon, 16 Dec 2024 12:19:53 +0100 Subject: [PATCH] changes of review Signed-off-by: michaelloercher --- functions/packages.bash | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/functions/packages.bash b/functions/packages.bash index 27a7a9c28..a3d45b6b1 100644 --- a/functions/packages.bash +++ b/functions/packages.bash @@ -866,7 +866,7 @@ install_esphomedashboard() { echo "$(timestamp) [openHABian] Starting ESPHome Dashboard setup..." # Ensure the script is run with sudo - if [ "$EUID" -ne 0 ]; then + if [ "$EUID" -ne 0 ]; then echo "$(timestamp) [openHABian] Please run this script as root or with sudo." return fi @@ -926,13 +926,10 @@ install_esphomedashboard() { return fi - if ! systemctl enable esphome-dashboard.service; then - echo "$(timestamp) [openHABian] Error: Failed to enable ESPHome Dashboard service." - return - fi - - if ! systemctl start esphome-dashboard.service; then - echo "$(timestamp) [openHABian] Error: Failed to start ESPHome Dashboard service." + # Enable and start the ESPHome Dashboard service + echo "$(timestamp) [openHABian] Enabling and starting the ESPHome Dashboard service..." + if ! systemctl enable --now esphome-dashboard.service; then + echo "$(timestamp) [openHABian] Error: Failed to enable and start ESPHome Dashboard service." return fi