esphome-install.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. $STD apt-get install -y git
  18. msg_ok "Installed Dependencies"
  19. msg_info "Updating Python3"
  20. $STD apt-get install -y \
  21. python3 \
  22. python3-dev \
  23. python3-pip \
  24. python3-venv
  25. msg_ok "Updated Python3"
  26. msg_info "Installing ESPHome"
  27. mkdir /root/config
  28. $STD pip install esphome tornado esptool
  29. msg_ok "Installed ESPHome"
  30. msg_info "Creating Service"
  31. cat <<EOF >/etc/systemd/system/esphomeDashboard.service
  32. [Unit]
  33. Description=ESPHome Dashboard
  34. After=network.target
  35. [Service]
  36. ExecStart=/usr/local/bin/esphome dashboard /root/config/
  37. Restart=always
  38. User=root
  39. [Install]
  40. WantedBy=multi-user.target
  41. EOF
  42. systemctl enable -q --now esphomeDashboard.service
  43. msg_ok "Created Service"
  44. motd_ssh
  45. customize
  46. msg_info "Cleaning up"
  47. $STD apt-get autoremove
  48. $STD apt-get autoclean
  49. msg_ok "Cleaned"