Refactor: ESPHome to uv based install (#5413)

* Refactor: ESPHome to uv based install

* fix curl
This commit is contained in:
CanbiZ
2025-06-24 11:33:26 +02:00
committed by GitHub
parent daad486c5e
commit 66ab254fb2
2 changed files with 59 additions and 24 deletions

View File

@ -17,34 +17,34 @@ msg_info "Installing Dependencies"
$STD apt-get install -y git
msg_ok "Installed Dependencies"
msg_info "Setup Python3"
$STD apt-get install -y \
python3 \
python3-dev \
python3-pip \
python3-venv
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
msg_ok "Setup Python3"
PYTHON_VERSION="3.12" setup_uv
msg_info "Installing ESPHome"
mkdir /root/config
$STD pip install esphome tornado esptool
msg_ok "Installed ESPHome"
msg_info "Setting up Virtual Environment"
mkdir -p /opt/esphome
mkdir -p /root/config
cd /opt/esphome
$STD uv venv /opt/esphome/.venv
$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 esphome tornado esptool
msg_ok "Setup and Installed ESPHome"
msg_info "Creating Service"
mkdir -p /root/config
cat <<EOF >/etc/systemd/system/esphomeDashboard.service
[Unit]
Description=ESPHome Dashboard
After=network.target
[Service]
ExecStart=/usr/local/bin/esphome dashboard /root/config/
ExecStart=/opt/esphome/.venv/bin/esphome dashboard /root/config/
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now esphomeDashboard
msg_ok "Created Service"