From 2f20db8a42fe740d963a6fd140892a5188e7e626 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Sat, 18 Jan 2025 20:54:11 +0100 Subject: [PATCH] breaking change: homeassistant upgrade os and python3 (#1550) * breaking change: homeassistant upgrade os and python3 * update json to new date and new ressource values --- ct/homeassistant-core.sh | 27 ++++++++++++------------ install/homeassistant-core-install.sh | 30 ++++++++++++++------------- json/homeassistant-core.json | 12 +++++------ 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/ct/homeassistant-core.sh b/ct/homeassistant-core.sh index f54bf4fd..df5df42d 100644 --- a/ct/homeassistant-core.sh +++ b/ct/homeassistant-core.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) -# Copyright (c) 2021-2025 tteck -# Author: tteck (tteckster) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: tteck (tteckster) | Co-Author: MickLesk (CanbiZ) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://www.home-assistant.io/ @@ -9,10 +9,10 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m APP="Home Assistant-Core" var_tags="automation;smarthome" var_cpu="2" -var_ram="1024" -var_disk="8" +var_ram="2048" +var_disk="10" var_os="ubuntu" -var_version="24.04" +var_version="24.10" var_unprivileged="1" # App Output & Base Settings @@ -51,10 +51,6 @@ function update_script() { echo -e "${GN}Updating to Stable Version${CL}" BR="" fi - if [[ "$PY" =~ ^python3\.(11|12)\.[0-9]+$ ]]; then - echo -e "⚠️ Home Assistant will soon require Python 3.13.x"; - fi - msg_info "Stopping Home Assistant" systemctl stop homeassistant msg_ok "Stopped Home Assistant" @@ -75,7 +71,7 @@ function update_script() { if [ "$UPD" == "2" ]; then msg_info "Installing Home Assistant Community Store (HACS)" apt update &>/dev/null - apt install unzip &>/dev/null + apt install -y unzip &>/dev/null cd .homeassistant bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null msg_ok "Installed Home Assistant Community Store (HACS)" @@ -102,16 +98,19 @@ function update_script() { msg_ok "Installed FileBrowser" msg_info "Creating Service" - service_path="/etc/systemd/system/filebrowser.service" - echo "[Unit] + cat < /etc/systemd/system/filebrowser.service +[Unit] Description=Filebrowser After=network-online.target + [Service] User=root WorkingDirectory=/root/ ExecStart=/usr/local/bin/filebrowser -r /root/.homeassistant + [Install] -WantedBy=default.target" >$service_path +WantedBy=default.target +EOF systemctl enable --now -q filebrowser.service msg_ok "Created Service" @@ -130,4 +129,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" -echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8123${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8123${CL}" \ No newline at end of file diff --git a/install/homeassistant-core-install.sh b/install/homeassistant-core-install.sh index e5cca687..5c27c4ae 100644 --- a/install/homeassistant-core-install.sh +++ b/install/homeassistant-core-install.sh @@ -44,34 +44,36 @@ $STD apt-get install -y \ libavfilter-dev \ libmariadb-dev-compat \ libatlas-base-dev \ - software-properties-common + software-properties-common \ + libmariadb-dev \ + pkg-config msg_ok "Installed Dependencies" -msg_info "Setup Python3" -$STD add-apt-repository -y ppa:deadsnakes/ppa +msg_info "Setup Python3/pip" $STD apt-get update +$STD rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +$STD apt-get remove --purge -y python3.12 python3.12-dev python3.12-venv + $STD apt-get install -y \ - python3.13-* \ + python3.13 \ python3-pip \ python3.13-dev \ python3.13-venv -msg_ok "Setup Python3" -msg_info "Installing UV" -$STD pip install uv -msg_ok "Installed UV" +ln -sf /usr/bin/python3.13 /usr/bin/python3 +msg_ok "Setup Python3" msg_info "Setting up Home Assistant-Core environment" mkdir /srv/homeassistant cd /srv/homeassistant -uv venv . &>/dev/null +python3 -m venv . source bin/activate -msg_ok "Created virtual environment with UV" +msg_ok "Created virtual environment" -msg_info "Installing Home Assistant-Core and packages" -$STD uv pip install webrtcvad wheel homeassistant mysqlclient psycopg2-binary isal +msg_info "Installing Home Assistant-Core" +$STD python3 -m pip install webrtcvad wheel homeassistant mysqlclient psycopg2-binary isal mkdir -p /root/.homeassistant -msg_ok "Installed Home Assistant-Core and required packages" +msg_ok "Installed Home Assistant-Core" msg_info "Creating Service" cat </etc/systemd/system/homeassistant.service @@ -97,4 +99,4 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -msg_ok "Cleaned" +msg_ok "Cleaned" \ No newline at end of file diff --git a/json/homeassistant-core.json b/json/homeassistant-core.json index ff4feb6d..ef362fe5 100644 --- a/json/homeassistant-core.json +++ b/json/homeassistant-core.json @@ -4,7 +4,7 @@ "categories": [ 2 ], - "date_created": "2024-04-29", + "date_created": "2025-01-17", "type": "ct", "updateable": true, "privileged": false, @@ -19,10 +19,10 @@ "script": "ct/homeassistant-core.sh", "resources": { "cpu": 2, - "ram": 1024, - "hdd": 8, + "ram": 2048, + "hdd": 10, "os": "ubuntu", - "version": "24.04" + "version": "24.10" } } ], @@ -40,7 +40,7 @@ "type": "warning" }, { - "text": "Use Ubuntu 24.04 ONLY", + "text": "Use Ubuntu 24.10 ONLY", "type": "warning" }, { @@ -48,4 +48,4 @@ "type": "info" } ] -} \ No newline at end of file +}