mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-09 17:28:31 +00:00
update: esphome to install and run ESPHome Device Builder (#15195)
This commit is contained in:
parent
70e14ef238
commit
9b619969ad
2 changed files with 26 additions and 22 deletions
|
|
@ -24,13 +24,14 @@ function update_script() {
|
||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -f /etc/systemd/system/esphomeDashboard.service ]]; then
|
if [[ ! -f /etc/systemd/system/esphome-device-builder.service && ! -f /etc/systemd/system/esphomeDashboard.service ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
systemctl stop esphomeDashboard
|
systemctl stop esphome-device-builder 2>/dev/null || true
|
||||||
|
systemctl stop esphomeDashboard 2>/dev/null || true
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
VENV_PATH="/opt/esphome/.venv"
|
VENV_PATH="/opt/esphome/.venv"
|
||||||
|
|
@ -46,33 +47,36 @@ function update_script() {
|
||||||
$STD uv venv --clear "$VENV_PATH"
|
$STD uv venv --clear "$VENV_PATH"
|
||||||
$STD "$VENV_PATH/bin/python" -m ensurepip --upgrade
|
$STD "$VENV_PATH/bin/python" -m ensurepip --upgrade
|
||||||
$STD "$VENV_PATH/bin/python" -m pip install --upgrade pip
|
$STD "$VENV_PATH/bin/python" -m pip install --upgrade pip
|
||||||
$STD "$VENV_PATH/bin/python" -m pip install esphome tornado esptool
|
$STD "$VENV_PATH/bin/python" -m pip install esphome esphome-device-builder esptool
|
||||||
msg_ok "Migrated to uv/venv"
|
msg_ok "Migrated to uv/venv"
|
||||||
else
|
else
|
||||||
msg_info "Updating ESPHome"
|
msg_info "Updating ESPHome Device Builder"
|
||||||
PYTHON_VERSION="3.12" setup_uv
|
PYTHON_VERSION="3.12" setup_uv
|
||||||
$STD "$VENV_PATH/bin/python" -m pip install --upgrade esphome tornado esptool
|
$STD "$VENV_PATH/bin/python" -m pip install --upgrade esphome esphome-device-builder esptool
|
||||||
msg_ok "Updated ESPHome"
|
msg_ok "Updated ESPHome Device Builder"
|
||||||
fi
|
fi
|
||||||
SERVICE_FILE="/etc/systemd/system/esphomeDashboard.service"
|
|
||||||
if ! grep -q "${VENV_PATH}/bin/esphome" "$SERVICE_FILE"; then
|
msg_info "Migrating to ESPHome Device Builder service"
|
||||||
msg_info "Updating systemd service"
|
if [[ -f /etc/systemd/system/esphomeDashboard.service ]]; then
|
||||||
cat <<EOF >"$SERVICE_FILE"
|
systemctl disable -q esphomeDashboard 2>/dev/null || true
|
||||||
|
rm -f /etc/systemd/system/esphomeDashboard.service
|
||||||
|
fi
|
||||||
|
cat <<EOF >/etc/systemd/system/esphome-device-builder.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=ESPHome Dashboard
|
Description=ESPHome Device Builder
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=${VENV_PATH}/bin/esphome dashboard /root/config/
|
ExecStart=${VENV_PATH}/bin/esphome-device-builder /root/config/
|
||||||
Restart=always
|
Restart=always
|
||||||
User=root
|
User=root
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
$STD systemctl daemon-reload
|
$STD systemctl daemon-reload
|
||||||
msg_ok "Updated systemd service"
|
$STD systemctl enable esphome-device-builder
|
||||||
fi
|
msg_ok "Migrated to ESPHome Device Builder service"
|
||||||
|
|
||||||
msg_info "Linking esphome to /usr/local/bin"
|
msg_info "Linking esphome to /usr/local/bin"
|
||||||
rm -f /usr/local/bin/esphome
|
rm -f /usr/local/bin/esphome
|
||||||
|
|
@ -80,7 +84,7 @@ EOF
|
||||||
msg_ok "Linked esphome binary"
|
msg_ok "Linked esphome binary"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start esphomeDashboard
|
systemctl start esphome-device-builder
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
exit
|
exit
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ cd /opt/esphome
|
||||||
$STD uv venv --clear /opt/esphome/.venv
|
$STD uv venv --clear /opt/esphome/.venv
|
||||||
$STD /opt/esphome/.venv/bin/python -m ensurepip --upgrade
|
$STD /opt/esphome/.venv/bin/python -m ensurepip --upgrade
|
||||||
$STD /opt/esphome/.venv/bin/python -m pip install --upgrade pip
|
$STD /opt/esphome/.venv/bin/python -m pip install --upgrade pip
|
||||||
$STD /opt/esphome/.venv/bin/python -m pip install esphome tornado esptool
|
$STD /opt/esphome/.venv/bin/python -m pip install esphome esphome-device-builder esptool
|
||||||
msg_ok "Setup and Installed ESPHome"
|
msg_ok "Setup and Installed ESPHome Device Builder"
|
||||||
|
|
||||||
msg_info "Linking esphome to /usr/local/bin"
|
msg_info "Linking esphome to /usr/local/bin"
|
||||||
rm -f /usr/local/bin/esphome
|
rm -f /usr/local/bin/esphome
|
||||||
|
|
@ -36,13 +36,13 @@ msg_ok "Linked esphome binary"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
mkdir -p /root/config
|
mkdir -p /root/config
|
||||||
cat <<EOF >/etc/systemd/system/esphomeDashboard.service
|
cat <<EOF >/etc/systemd/system/esphome-device-builder.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=ESPHome Dashboard
|
Description=ESPHome Device Builder
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/opt/esphome/.venv/bin/esphome dashboard /root/config/
|
ExecStart=/opt/esphome/.venv/bin/esphome-device-builder /root/config/
|
||||||
Restart=always
|
Restart=always
|
||||||
User=root
|
User=root
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ User=root
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl enable -q --now esphomeDashboard
|
systemctl enable -q --now esphome-device-builder
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue