From 46518271512ba46236a20ad666214a5f7136ba07 Mon Sep 17 00:00:00 2001 From: tteckster Date: Fri, 23 Jun 2023 13:17:03 -0400 Subject: [PATCH] Update esphome-install.sh install esphome in a python virtual environment --- install/esphome-install.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/install/esphome-install.sh b/install/esphome-install.sh index c9a67ba4..5b6cb0b7 100644 --- a/install/esphome-install.sh +++ b/install/esphome-install.sh @@ -30,20 +30,27 @@ rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED msg_ok "Updated Python3" msg_info "Installing ESPHome" +mkdir /srv/esphome +cd /srv/esphome +python3 -m venv . +source bin/activate $STD pip install esphome tornado esptool msg_ok "Installed ESPHome" msg_info "Creating Service" -service_path="/etc/systemd/system/esphomeDashboard.service" -echo "[Unit] +cat </etc/systemd/system/esphomeDashboard.service +[Unit] Description=ESPHome Dashboard After=network.target + [Service] -ExecStart=/usr/local/bin/esphome dashboard /root/config/ +ExecStart=/srv/esphome/bin/esphome dashboard /root/config/ Restart=always User=root + [Install] -WantedBy=multi-user.target" >$service_path +WantedBy=multi-user.target +EOF systemctl enable -q --now esphomeDashboard.service msg_ok "Created Service"