From 124e0e191b7a8180c361d143bb1bc3bf39d18352 Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 7 Dec 2022 16:02:05 -0500 Subject: [PATCH] Update pyenv2.sh --- misc/pyenv2.sh | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/misc/pyenv2.sh b/misc/pyenv2.sh index 70e99977..77a3d610 100644 --- a/misc/pyenv2.sh +++ b/misc/pyenv2.sh @@ -27,6 +27,7 @@ cd /srv/homeassistant python3 -m venv . source bin/activate python3 -m pip install wheel &>/dev/null +pip3 install --upgrade pip &>/dev/null pip3 install psycopg2-binary &>/dev/null pip3 install --pre homeassistant &>/dev/null systemctl enable homeassistant &>/dev/null @@ -40,19 +41,35 @@ if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ] ESP="Y" fi if [[ $ESP == "Y" ]]; then -echo "Installing ESPHome" +echo "Installing ESPHome Beta" +mkdir /srv/esphome +cd /srv/esphome +python3 -m venv . +source bin/activate +python3 -m pip install wheel &>/dev/null +pip3 install --upgrade pip &>/dev/null pip3 install --pre esphome &>/dev/null -cat </etc/systemd/system/esphomeDashboard.service +cat </srv/esphome/start.sh +#!/bin/bash +source /srv/esphome/bin/activate +esphome dashboard /srv/esphome/ +EOF +chmod +x start.sh +cat </etc/systemd/system/esphomedashboard.service [Unit] -Description=ESPHome Dashboard +Description=ESPHome Dashboard Service After=network.target [Service] -ExecStart=/root/.pyenv/versions/3.10.8/bin/esphome /root/.pyenv/versions/3.10.8/lib/python3.10/site-packages/esphome_dashboard dashboard -Restart=always +Type=simple User=root +WorkingDirectory=/srv/esphome +ExecStart=/srv/esphome/start.sh +RestartSec=30 +Restart=on-failure [Install] WantedBy=multi-user.target EOF -systemctl enable --now esphomeDashboard &>/dev/null -echo "Installed ESPHome" +systemctl enable --now esphomedashboard &>/dev/null +echo "Installed ESPHome Beta" +echo -e " Go to $(hostname -I | awk '{print $1}'):6052" fi