【IoT】安装 Home Assistant Core

Posted by 西维蜀黍 on 2021-02-09, Last Modified on 2024-04-29

Install on Raspberry Pi

# Install Software Properties Common
sudo apt install -y software-properties-common

# Add the Deadsnakes PPA
sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update; sudo apt install -y python3.12

# Update Python 3 to Point to the New Version
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.x 1
sudo update-alternatives --config python3

# verify
python3 --version

# homeassistant 2024.2.4 needs python3.12
sudo apt-get install python3.12-distutils
python3 -m pip install wheel
pip3 install homeassistant==2024.2.4

# 我出现了找不到该版本错误,2024.2.1 Requires-Python >=3.11.0
# 这时候需要升级 Python版本

ref

Install on Ubuntu

Maintain

# ha home
$  cd /home/homeassistant/.homeassistant
# modify config
$ vim configuration.yaml

Potential Issue

requests 2.25.1 requires idna<3,>=2.5, but you'll have idna 3.1 which is incompatible.

My HA on Ubuntu2

# run
$ /srv/homeassistant/bin/python3.8 /srv/homeassistant/bin/hass -c /home/homeassistant/.homeassistant

# view logs
$ ccat /home/homeassistant/.homeassistant/home-assistant.log

Install on macOS

# Create the virtual Python environment
$ virtualenv homeassistant --python=python3
$ cd homeassistant

Set Python to the virtual environment:

$ source bin/activate

Install Home Assistant

$ pip3 install homeassistant
# 如果找不到源,可以用
$ pip install homeassistant -i https://pypi.python.org/simple

To start it after for example a server reboot, opening a new Terminal window first the virtual environment has to be activated before starting it.

$ source bin/activate
$ bin/hass

Access http://127.0.0.1:8123

Ref

Updating

To update to the latest version of Home Assistant Core follow these simple steps:

sudo -u homeassistant -H -s
source bin/activate
pip3 install --upgrade homeassistant

Install Other Stuff

HACS

https://hacs.xyz/docs/installation/installation

Stop your HA

Open a terminal

Change to the user that is running Home Assistant

sudo -u homeassistant -H -s

Run the HACS install script

wget -q -O - https://hacs.xyz/install | bash -

Then, follow https://hacs.xyz/docs/configuration/basic

Reference