2024年5月15日 0:38:50

Installing Home Assistant Core 2024.1.3 on Raspberry Pi 3B+ debian 12 step by step

1 个月 前
#29804 引用
bluetoothctl


I followed this documentation to come up with a small installer script.

https://www.home-assistant.io/installation/linux#install-home-assistant-core

I'm running my Raspberry 4 on Debian Bookworm.




#!/usr/bin/env bash

USER=homeassistant
DIR=/opt/homeassistant

sudo apt-get install -y python3 python3-venv python3-pip python3-dev \
    bluez libffi-dev autoconf build-essential tzdata ffmpeg \
    libssl-dev libjpeg-dev zlib1g-dev libopenjp2-7 libtiff6 libturbojpeg0-dev liblapack3 liblapack-dev libatlas-base-dev

if ! id -u "${USER}" >/dev/null 2>&1; then
    sudo useradd -rm "${USER}"
fi

sudo mkdir -p "${DIR}"
sudo mkdir -p "/home/${USER}/.homeassistant"
sudo chown "${USER}:${USER}" "${DIR}"

if systemctl is-active --quiet home-assistant; then
    sudo systemctl stop home-assistant
fi

sudo -u "${USER}" -H -s <<EOF
pushd "${DIR}" >/dev/null
python3 -m venv .
source bin/activate
python3 -m pip install wheel
pip3 install homeassistant==2024.1.3
popd >/dev/null
EOF

cat <<EOF | sudo tee "/etc/systemd/system/home-assistant.service"
[Unit]
Description=Home Assistant
Wants=network-online.target
After=network-online.target

[Service]
User=${USER}
WorkingDirectory=/home/${USER}/.homeassistant
ExecStart=${DIR}/bin/hass -c "/home/${USER}/.homeassistant"
RestartForceExitStatus=100
RestartSec=5
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant
sudo systemctl start home-assistant





https://github.com/home-assistant/core/issues/107981
0