0

【笔记】玩客云部署 Homeassistant

 6 months ago
source link: https://loli.fj.cn/zh-CN/2024/03/03/%E7%8E%A9%E5%AE%A2%E4%BA%91%E9%83%A8%E7%BD%B2Homeassistant/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

玩客云部署 Homeassistant

玩客云刷入 Armbian

传送门

配置 Armbian 环境

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

更换软件源(可选)

清华大学软件源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse

更新软件列表

apt update
apt install -y  python3-dev  python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0-dev libpcap-dev tzdata

部署 Rust

安装 Rust

curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

/home/ha/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

/home/ha/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

/home/ha/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

/home/ha/.profile
/home/ha/.bashrc
/home/ha/.zshenv

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


default host triple: armv7-unknown-linux-gnueabihf
default toolchain: stable (default)
profile: default
modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

配置 Rust 环境

source $HOME/.cargo/env
export CRYPTOGRAPHY_DONT_BUILD_RUST=1
export CARGO_NET_GIT_FETCH_WITH_CLI=true

部署 Python

查看 Python 版本号

  • 确保 Python 版本为 3.10.6
python3 -V

设置 pip 源(可选)

清华大学软件源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

创建 pip 虚拟环境

python3 -m venv homeassistant-pip-env
source homeassistant-pip-env/bin/activate

下载 Homeassistant

python3 -m pip install wheel homeassistant
  • 首次启动会很慢,需要耐心等待
hass

配置开机自启

创建配置文件

touch /etc/systemd/system/homeassistant.service
[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=ha
WorkingDirectory=/home/ha/.homeassistant
ExecStart=/home/ha/homeassistant-pip-env/bin/hass -c /home/ha/.homeassistant
RestartForceExitStatus=100

[Install]
WantedBy=multi-user.target

设置为开机自启

systemctl enable homeassistant

知乎 —— 赵东颖


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK