Raspberry Pi 上安装 Home Assistant

参考1: https://www.home-assistant.io/docs/installation/virtualenv/

参考2: https://www.home-assistant.io/docs/installation/raspberry-pi/

硬件环境:raspberry 3B+

软件环境:RASPBIAN STRETCH WITH DESKTOP 2018-06-27

说明: 基本是抄录hass.io官网资料,只是很多情况需要FQ才看到到,身为天朝的开发者真是醉了。

 

1. Update the system

$ sudo apt-get update
$ sudo apt-get upgrade -y

2. Install the dependencies

sudo apt-get install python3 python3-venv python3-pip

3. Add an account for Home Assistant called homeassistant

$ sudo useradd -rm homeassistant -G dialout,gpio

4. Create a directory for the installation of Home Assistant

$ cd /srv
$ sudo mkdir homeassistant
$ sudo chown homeassistant:homeassistant homeassistant

5. Create and Change to a Virtual environment for Home Assistant

$ sudo -u homeassistant -H -s
$ cd /srv/homeassistant
$ python3 -m venv .
$ source bin/activate

 pi@raspberrypi:/srv/homeassistant $ source bin/activate
 (homeassistant) pi@raspberrypi:/srv/homeassistant $

6. Once activated the virtual environment, Install a required python package

(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ python3 -m pip install wheel

7. Now it's time to Install Home Assistant

(homeassistant) homeassistant@raspberrypi:/srv/homeassistant $ pip3 install homeassistant

8. Create /home/homeassistant/.homeassistant configuration directory

(homeassistant) pi@raspberrypi:/home $ ls /home/homeassistant/.homeassistant/
automations.yaml custom_components deps groups.yaml home-assistant_v2.db scripts.yaml tts
configuration.yaml customize.yaml entity_registry.yaml home-assistant.log known_devices.yaml secrets.yaml
(homeassistant) pi@raspberrypi:/home $

9. Run hass, And you can reach your installation on your Raspberry Pi over the web interface on http://ipaddress:8123

(homeassistant) pi@raspberrypi:/home $ hass 

10. When you login in you pi system, before you run hass, you should change to the virtual environment

$ sudo -u homeassistant -H -s
$ source /srv/homeassistant/bin/activate

11. To upgrade to the latest version of Home Assistant

$ pip3 install --upgrade homeassistant

 12. Start HA

hass

 

posted @ 2018-08-15 20:37  Dream_2017  阅读(296)  评论(0编辑  收藏  举报