视频教程如下:
https://youtu.be/CeiW-G1ghPc

更多视频教程请点这里

1.树莓派更换国内apt源(可选,中国大陆必须)

sudo su
echo 'deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi' > /etc/apt/sources.list
echo 'deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi' >> /etc/apt/sources.list
echo 'deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui' > /etc/apt/sources.list.d/raspi.list
echo 'deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui' >> /etc/apt/sources.list.d/raspi.list
apt-get update
exit

斐讯N1 ArmBian换apt源(可选,中国大陆必须)
sudo su
echo 'deb http://mirrors.ustc.edu.cn/debian stretch main contrib non-free' > /etc/apt/sources.list
echo 'deb http://mirrors.ustc.edu.cn/debian stretch-updates main contrib non-free' > /etc/apt/sources.list
echo 'deb http://mirrors.ustc.edu.cn/debian stretch-backports main contrib non-free' > /etc/apt/sources.list
echo 'deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main contrib non-free' > /etc/apt/sources.list
apt-get update
exit

2.安装依Python3运行环境
sudo apt-get -y install python3-pip build-essential libssl-dev libffi-dev python-dev openssl libssl-dev python3-cffi python3-setuptools python3-cryptography python3-bcrypt python-cryptography python-bcrypt python3-dev

3.修改阿里云pip源(可选,中国大陆必须)
sudo su
mv /etc/pip.conf /etc/pip.conf.bak
echo '[global]' > /etc/pip.conf
echo 'timeout = 6000' >> /etc/pip.conf
echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf
echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf
exit

4.安装python依赖包
pip3 install requests
pip3 install sqlalchemy
pip3 install distro
pip3 install hass-nabucasa
pip3 install xmltodict
pip3 install mutagen
pip3 install netdisco
pip3 install pynacl
pip3 install pyotp
pip3 install pyqrcode
pip3 install aiohttp
pip3 install aiohttp_cors
pip3 install cryptography
pip3 install gtts-token
pip3 install hass-nabucasa
sudo pip3 install pycryptodome
sudo pip3 install --upgrade pip

5.安装Home Assistant
sudo pip3 install homeassistant

6.手动启动测试一下是否正常,启动过程中会自动安装一些依赖包,耐心等待。
hass

7.创建系统服务

sudo chown -R $USER /tmp
echo $USER > /tmp/user.txt
sudo su
USER1=`cat /tmp/user.txt`
echo '[Unit]' > /etc/systemd/system/hass.service
echo 'Description=Home Assistant Service' >> /etc/systemd/system/hass.service
echo 'After=network.target' >> /etc/systemd/system/hass.service
echo 'Wants=network.target' >> /etc/systemd/system/hass.service
echo '[Service]' >> /etc/systemd/system/hass.service
echo 'User='$USER1 >> /etc/systemd/system/hass.service
echo 'Type=simple' >> /etc/systemd/system/hass.service
echo 'ExecStartPre=/bin/sleep 3' >> /etc/systemd/system/hass.service
echo 'ExecStart=/usr/local/bin/hass' >> /etc/systemd/system/hass.service
echo 'Restart=always' >> /etc/systemd/system/hass.service
echo '[Install]' >> /etc/systemd/system/hass.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/hass.service
exit

8.添加开机启动并启动Home Assistant

sudo systemctl enable hass
sudo systemctl start hass

打开Home Assistant 界面

http://xxx.xxx.xxx.xxx:8123

36 对 “树莓派/斐讯N1/Armbian/安装Home Assistant”的想法;

  1. 你好
    非常感谢作者的树莓派搭建智能家居安装教程
    但我再安装hass中出现问题显示如下错误“ ERROR: Package ‘homeassistant’ requires a different Python: 3.5.3 not in ‘>=3.6.0’
    ”是python的版本不对吗?如何解决?还请作者不吝赐教。如有可能想与作者建立联系,以便再日后学习中遇到问题可及时向您提问
    我的qq:1173472955
    微信:li15188677636

    1. 你好,很高兴你对我的教程感兴趣,8月31日之后home assistant要求升级Python大于3.6了,所以你要参考我另一篇文章升级Python。

      如果想进群讨论,请观看我教程上的视频,看下方显示的TG群连接,进群讨论。

    2. 请看文章里内嵌的视频链接,视频内有提供群组联系方式,还有就是你的python版本太低了,你要去看另一篇文章,参照文章里的视频升级到python3.7。

  2. 你好, 我看这个启动项的时候我只有这一个,
    pi@raspberrypi:~ $ ps -ef|grep hass
    pi 1089 1007 0 11:50 pts/0 00:00:00 grep –color=auto hass
    pi@raspberrypi:~ $
    另一个没有,要怎么解决

  3. Command “/usr/bin/python3 -m pip install –ignore-installed –no-user –prefix /tmp/pip-build-env-9qb4clxc –no-warn-script-location –no-binary :none: –only-binary :none: -i https://mirrors.aliyun.com/pypi/simple/ –trusted-host mirrors.aliyun.com — setuptools wheel “cffi>=1.4.1; python_implementation != ‘PyPy’”” failed with error code 1 in None 安装依赖时报错

  4. 你好;
    在这一步“安装Home Assistant
    sudo pip3 install homeassistant“
    发生错误,一大片红色,其中第一句是:ERROR: Command errored out with exit status 1:

  5. 不好意思,我前面就有一个错误忽略了,导致后面错误一大片红色;前面在执行pip3 install pynacl命令是的错误是Command “/usr/bin/python3 -m pip install –ignore-installed –no-user –prefix / tmp/pip-build-env-psg1pg9g –no-warn-script-location –no-binary :none: –only-b inary :none: -i https://mirrors.aliyun.com/pypi/simple/ –trusted-host mirrors.a liyun.com — setuptools wheel “cffi>=1.4.1; python_implementation != ‘PyPy'”” fa iled with error code 1 in None

          1. 树莓派3b,我装的应该是最新版本的镜像,我看了看内置python3版本是3.7的,是这个问题吗?

          2. 3.7的不能这样装,直接执行home assistant安装,不安装其他的,会自动安装。

  6. 大神几时出一个配置文件设置安装及怎么获取小米家token的教程,看了你的视频已经在ESXI下虚拟机安装了homeassistant,但不会设置配置文件。望解惑,感谢。

  7. Command “/usr/bin/python3 -m pip install –ignore-installed –no-user –prefix /tmp/pip-build-env-g3zkduoz –no-warn-script-location –no-binary :none: –only-binary :none: -i https://mirrors.aliyun.com/pypi/simple/ –trusted-host mirrors.aliyun.com — setuptools>=40.8.0 wheel “cffi>=1.1; python_implementation != ‘PyPy'”” failed with error code 1 in None

  8. 你好,我在安装homeassistant时总是出现保存,红色部分太多,应该怎么做,python版本查了一下是python3.5.3,
    其他地方都完成了,但是homeassistant的主页面没有见到,只显示无法访问,服务器端拒绝了链接

  9. 我遇到的问题是fatal error:ffi.h:No such file or directory,想着补一下运行库,后面安装libffi-dev时提示libffi6版本高,于是我执行了sudo apt-get install libffi6=3.2.1-6,覆盖了原本的,然后再安装libffi-dev就成功了,再次运行pip3 install homeassistant就没有报错一路通过了。

  10. 博主您好,针对这篇文章给您提个建议,上面的更换apt源那里,那个stretch,不同的树莓派系统版本要用不同的代号,我用的raspbian10就要改成buster,您用的raspbian9就用的stretch。这点会影响到后面的步骤

  11. 安装home assistant的时候卡在这里了,请问怎么解决呢。

    2021-03-09 09:39:47 INFO (MainThread) [homeassistant.components.switch] Setting up switch.xiaomi_miio
    2021-03-09 09:39:47 INFO (MainThread) [homeassistant.components.xiaomi_miio.switch] Initializing with host 172.29.121.126 (token d500c…)
    2021-03-09 09:39:52 ERROR (MainThread) [miio.device] Unable to discover a device at address 172.29.121.126
    2021-03-09 09:39:52 WARNING (MainThread) [homeassistant.components.switch] Platform xiaomi_miio not ready yet. Retrying in 180 seconds.
    2021-03-09 09:42:53 INFO (MainThread) [homeassistant.components.switch] Setting up switch.xiaomi_miio
    2021-03-09 09:42:53 INFO (MainThread) [homeassistant.components.xiaomi_miio.switch] Initializing with host 172.29.121.126 (token d500c…)
    2021-03-09 09:42:58 ERROR (MainThread) [miio.device] Unable to discover a device at address 172.29.121.126
    2021-03-09 09:42:58 WARNING (MainThread) [homeassistant.components.switch] Platform xiaomi_miio not ready yet. Retrying in 180 seconds.

回复 admin 取消回复