硬件:NanoPi m4v2。。。
系统:Armbian。。。(基于 Debian 11)
开始直接在 docker 中拉取镜像安装,但是安装完成后,发现没有 supervisor,没法集成米家的设备;
直接安装 hass os 比较方便省事,直接从官网下载对应版本的镜像安装即可。但是shell没办法开启 ssh;
所以最终是通过 supervised 方式安装,这种本质上也是安装在 docker 中,但是根据官网的指引可以达到直接安装 hass os 的效果,而且还可以安装自己的一些其他 docker 容器。
ps:在 Home Assistant 官网查看各种安装方式 https://www.home-assistant.io/installation/
进入 Home Assistant 官网安装页面 https://www.home-assistant.io/installation/,点击进入 Linux 选项卡
划到页面最下方,找到 Install Home Assistant Supervised 安装方式
点击 requirements 查看以此方式安装的要求:
点击 home-assistant/supervised-installer 按照指引开始正式的安装步骤:
注意:后续安装命令请用 root 用户或具有 root 权限的用户 sudo 操作
apt-get install \
jq \
wget \
curl \
udisks2 \
libglib2.0-bin \
network-manager \
dbus -y
curl -fsSL get.docker.com | sh
建议使用上方命令安装 Docker-CE,如果使用其他方式安装 Docker 后,安装 supervised 时报错:
The following packages have unmet dependencies:
homeassistant-supervised : Depends: docker-ce but it is not installable
E: Unable to correct problems, you have held broken packages.
那么检查一下安装的 Docker 是否是 CE 版本或版本号>= 19.03,使用 docker version
命令查看版本信息,如下:
Client: Docker Engine - Community
Version: 20.10.5
...
Server: Docker Engine - Community
Engine:
Version: 20.10.5
根据自己的设备架构下载最新版本OS-Agent安装包,我的是 aarch64,所以选择 os-agent_1.2.2_linux_aarch64.deb 下载即可。PS:不知道自己的架构可以输入命令 arch
查看
按照官方指引安装:
sudo dpkg -i os-agent_1.2.2_linux_aarch64.deb
如果提示报错:
zsh: command not found: dkpg
可以用以下命令替代:
apt install ./os-agent_1.2.2_linux_aarch64.deb
安装完成后,使用以下命令测试:
gdbus introspect --system --dest io.hass.os --object-path /io/hass/os
返回结果不报错、包含接口信息等即为正常。
官方给出的命令:
# 下载安装包
wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
# 安装
dpkg -i homeassistant-supervised.deb
和4. 安装 OS-Agent
中一样,使用以下命令替换:
apt install ./homeassistant-supervised.deb
我的安装过程中报错:
root@nanopim4v2:/mydata/pkg# sudo apt install ./homeassistant-supervised.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'homeassistant-supervised' instead of './homeassistant-supervised.deb'
The following additional packages will be installed:
apparmor
Suggested packages:
apparmor-profiles-extra apparmor-utils
The following NEW packages will be installed:
apparmor homeassistant-supervised
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 601 kB/607 kB of archives.
After this operation, 2,591 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 /mydata/pkg/homeassistant-supervised.deb homeassistant-supervised all 1.2.1 [5,968 B]
Get:2 http://deb.debian.org/debian bullseye/main arm64 apparmor arm64 2.13.6-10 [601 kB]
Fetched 601 kB in 1s (753 kB/s)
Preconfiguring packages ...
Selecting previously unselected package apparmor.
(Reading database ... 42354 files and directories currently installed.)
Preparing to unpack .../apparmor_2.13.6-10_arm64.deb ...
Unpacking apparmor (2.13.6-10) ...
Selecting previously unselected package homeassistant-supervised.
Preparing to unpack .../homeassistant-supervised.deb ...
[warn]
[warn] If you want more control over your own system, run
[warn] Home Assistant as a VM or run Home Assistant Core
[warn] via a Docker container.
[warn]
Adding 'diversion of /etc/NetworkManager/NetworkManager.conf to /etc/NetworkManager/NetworkManager.conf.real by homeassistant-supervised'
Adding 'diversion of /etc/NetworkManager/system-connections/default to /etc/NetworkManager/system-connections/default.real by homeassistant-supervised'
Adding 'diversion of /etc/docker/daemon.json to /etc/docker/daemon.json.real by homeassistant-supervised'
Adding 'diversion of /etc/network/interfaces to /etc/network/interfaces.real by homeassistant-supervised'
Unpacking homeassistant-supervised (1.2.1) ...
Setting up apparmor (2.13.6-10) ...
Created symlink /etc/systemd/system/sysinit.target.wants/apparmor.service → /lib/systemd/system/apparmor.service.
Reloading AppArmor profiles
Setting up homeassistant-supervised (1.2.1) ...
[info] Restarting NetworkManager
[info] Enable systemd-resolved
[info] Restarting docker service
PING version.home-assistant.io (172.67.68.90) 56(84) bytes of data.
--- version.home-assistant.io ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
[info] Waiting for version.home-assistant.io - network interface might be down...
PING version.home-assistant.io (104.26.5.238) 56(84) bytes of data.
--- version.home-assistant.io ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
[info] Waiting for version.home-assistant.io - network interface might be down...
PING version.home-assistant.io (104.26.4.238) 56(84) bytes of data.
64 bytes from 104.26.4.238: icmp_seq=1 ttl=52 time=294 ms
--- version.home-assistant.io ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 293.773/293.773/293.773/0.000 ms
[info] Install supervisor startup scripts
[info] Install AppArmor scripts
dpkg: error processing package homeassistant-supervised (--configure):
installed homeassistant-supervised package post-installation script subprocess returned error exit status 35
Processing triggers for man-db (2.9.4-2) ...
Errors were encountered while processing:
homeassistant-supervised
E: Sub-process /usr/bin/dpkg returned an error code (1)
至此,查找原因,发现还是 dpkg
的原因,查看 /usr/bin/dpkg
是有这个路径的,也就是说之前提示 command not found: dkpg
是配置的问题,经过网上冲浪,找到了解决办法,就是重新配置 dpkg database,运行如下命令:
sudo dpkg --configure -a
等待一段时间即可安装成功,并且 dpkg
命令也可以正常使用了。
等待一段时间后(10分钟左右),在浏览器中输入 设备ip:8123
即可访问Home Assistant。
不知道为什么访问 设备ip:4357
,进入看到 Supported: Unsupported
,但是可以正常接入设备使用,暂时未发现问题。
Home Assistant observer
Supervisor: Connected
Supported: Unsupported
Healthy: Healthy