|
1 | 1 | ---
|
2 | 2 | layout: page
|
3 |
| -title: "Installation on a Raspberry Pi" |
4 |
| -description: "Instructions to install Home Assistant on a Raspberry Pi." |
5 |
| -date: 2016-04-16 11:36 |
| 3 | +title: "Raspbian Lite on a Raspberry Pi" |
| 4 | +description: "Instructions to install Home Assistant on a Raspberry Pi runnning Raspbian Lite." |
| 5 | +date: 2016-09-05 16:00 |
6 | 6 | sidebar: true
|
7 | 7 | comments: false
|
8 | 8 | sharing: true
|
9 | 9 | footer: true
|
10 | 10 | ---
|
11 | 11 |
|
12 |
| -Home Assistant requires the Raspberry Pi to run [Raspbian Jessie](https://www.raspberrypi.org/downloads/raspbian/). This version was released on September 24, 2015 and comes by default with Python 3.4 which is required for Home Assistant. |
| 12 | +### {% linkable_title Installation %} |
13 | 13 |
|
14 |
| -Execute the following code in a console: |
| 14 | +This installation of Home Assistant requires the Raspberry Pi to run [Raspbian Lite](https://www.raspberrypi.org/downloads/raspbian/). |
| 15 | +The installation will be installed in a [Virtual Environment](/getting-started/installation-virtualenv) with minimal overhead. Instructions assume this is a new installation of Raspbian Lite. |
15 | 16 |
|
| 17 | +Connect to the Raspberry Pi over ssh. Default password is `raspberry`. |
16 | 18 | ```bash
|
17 |
| -$ sudo pip3 install homeassistant |
18 |
| -$ hass |
| 19 | +$ ssh pi@ipadress |
19 | 20 | ```
|
20 | 21 |
|
21 |
| -Running these commands will: |
| 22 | +Changing the default password is encouraged. |
| 23 | +```bash |
| 24 | +$ passwd |
| 25 | +``` |
| 26 | + |
| 27 | +Update the system. |
| 28 | +```bash |
| 29 | +$ sudo apt-get update |
| 30 | +$ sudo apt-get upgrade -y |
| 31 | +``` |
| 32 | + |
| 33 | +Install the dependencies. |
| 34 | +```bash |
| 35 | +$ sudo apt-get install python3 python3-venv python3-pip |
| 36 | +``` |
| 37 | + |
| 38 | +Add an account for Home Assistant called `homeassistant`. |
| 39 | +Since this account is only for running Home Assistant the extra arguments of `-rm` is added to create a system account and create a home directory. |
| 40 | +```bash |
| 41 | +$ sudo useradd -rm homeassistant |
| 42 | +``` |
| 43 | + |
| 44 | +Next we will create a directory for the installation of Home Assistant and change the owner to the `homeassistant` account. |
| 45 | +```bash |
| 46 | +$ cd /srv |
| 47 | +$ sudo mkdir homeassistant |
| 48 | +$ sudo chown homeassistant:homeassistant homeassistant |
| 49 | +``` |
| 50 | + |
| 51 | +Next up is to create and change to a virtual environment for Home Assistant. This will be done as the `homeassistant` account. |
| 52 | +```bash |
| 53 | +$ sudo su -s /bin/bash homeassistant |
| 54 | +$ cd /srv/homeassistant |
| 55 | +$ python3 -m venv homeassistant_venv |
| 56 | +$ source /srv/homeassistant/homeassistant_venv/bin/activate |
| 57 | +``` |
| 58 | +Once you have activated the virtual environment you will notice the prompt change and then you can install Home Assistant. |
| 59 | +```bash |
| 60 | +(homeassistant_venv) homeassistant@raspberrypi:/srv/homeassistant $ pip3 install homeassistant |
| 61 | +``` |
| 62 | + |
| 63 | +Start Home Assistant for the first time. This will complete the installation, create the `.homeasssistant` configuration directory in the `/home/homeassistant` directory and install any basic dependencies. |
| 64 | +```bash |
| 65 | +(homeassistant_venv) $ hass |
| 66 | +``` |
| 67 | + |
| 68 | +You can now reach your installation on your raspberry pi over the web interface on [http://ipaddress:8123](http://ipaddress:8123). |
| 69 | +For instruction on how to configure Home Assistant continue on with [Configuring Home Assistant](/getting-started/configuration/). |
| 70 | + |
| 71 | +### {% linkable_title Raspberry Pi Hardware Specific Components %} |
| 72 | + |
| 73 | +Some components that are specific for the Raspberry Pi can require some further configuration outside of Home Assistant. All commands below are assumed to be executed with the `pi` account. For full documentation of these components refer to the [components](/components) page. |
| 74 | + |
| 75 | +### {% linkable_title Bluetooth Tracker %} |
| 76 | +The Bluetooth tracker will work on a Raspberry Pi 3 with the built-in Bluetooth module or with a USB Bluetooth device on any of the other Raspberry Pi's. |
| 77 | + |
| 78 | +Install the following external dependencies. |
| 79 | +```bash |
| 80 | +$ sudo apt-get install bluetooth libbluetooth-dev |
| 81 | +``` |
| 82 | +After this follow the [Bluetooth Tracker component](/components/device_tracker.bluetooth_tracker/) and [Device Tracker page](/components/device_tracker/) pages. |
| 83 | + |
| 84 | + |
| 85 | +### {% linkable_title Raspberry Pi Camera %} |
| 86 | +The Raspberry Pi Camera is a specific camera for the Raspberry Pi boards. For more information about the camera I suggest reading the [documentation](https://www.raspberrypi.org/documentation/usage/camera/) from the Raspberry Pi foundation. |
| 87 | + |
| 88 | +To use the camera it needs to be enabled with the `raspi-config` utility. |
| 89 | +```bash |
| 90 | +$ sudo raspi-config |
| 91 | +``` |
| 92 | +Select `Enable camera` choose `<Yes>` and hit `Enter`, then go to `Finish` and you'll be prompted to reboot. |
| 93 | +After reboot add your `homeassistant` account to the `video` group. |
| 94 | +```bash |
| 95 | +$ sudo adduser homeassistant video |
| 96 | +``` |
| 97 | +After this follow the [Raspberry Pi Camera component](/components/camera.rpi_camera/) page. |
22 | 98 |
|
23 |
| - - Install Home Assistant |
24 |
| - - Launch Home Assistant and serve the web interface on [http://localhost:8123](http://localhost:8123) |
| 99 | +### {% linkable_title Raspberry Pi GPIO %} |
| 100 | +Each of the following devices are connected to the GPIO pins on the Raspberry Pi. |
| 101 | +For more details about the GPIO layout, visit the [documentation](https://www.raspberrypi.org/documentation/usage/gpio/) from the Raspberry |
| 102 | +Pi foundation. |
| 103 | +Since these are not normally used some extra permission will need to be added. |
| 104 | +In general the permission that is needed is granted by adding the `homeassistant` account to the `gpio` group. |
25 | 105 |
|
26 |
| -There is also a [video tutorial](https://www.youtube.com/watch?v=GjzOXkPb7XE) created by [brusc](https://github.com/brusc). |
| 106 | + |
| 107 | +#### {% linkable_title Raspberry Pi Cover %} |
| 108 | +Add your `homeassistant` account to the `gpio` group |
| 109 | +```bash |
| 110 | +$ sudo adduser homeassistant gpio |
| 111 | +``` |
| 112 | +After this follow the [Raspberry Pi Cover component](/components/cover.rpi_gpio/) page. |
| 113 | + |
| 114 | +#### {% linkable_title DHT Sensor %} |
| 115 | +Add your `homeassistant` account to the `gpio` group |
| 116 | +```bash |
| 117 | +$ sudo adduser homeassistant gpio |
| 118 | +``` |
| 119 | +After this follow the [DHT Sensor component](/components/sensor.dht/) page. |
| 120 | + |
| 121 | + |
| 122 | +#### {% linkable_title Raspberry PI GPIO Binary Sensor %} |
| 123 | +Add your `homeassistant` account to the `gpio` group |
| 124 | +```bash |
| 125 | +$ sudo adduser homeassistant gpio |
| 126 | +``` |
| 127 | +After this follow the [Raspberry PI GPIO Binary Sensor component](/components/binary_sensor.rpi_gpio/) page. |
| 128 | + |
| 129 | +#### {% linkable_title Raspberry PI GPIO Switch %} |
| 130 | +Add your `homeassistant` account to the `gpio` group. |
| 131 | +```bash |
| 132 | +$ sudo adduser homeassistant gpio |
| 133 | +``` |
| 134 | +After this follow the [Raspberry PI GPIO Switch component](/components/switch.rpi_gpio/) page. |
| 135 | + |
| 136 | +#### {% linkable_title Raspberry Pi RF Switch %} |
| 137 | +Add your `homeassistant` account to the `gpio` group |
| 138 | +```bash |
| 139 | +$ sudo adduser homeassistant gpio |
| 140 | +``` |
| 141 | +After this follow the [Raspberry Pi RF Switch component](/components/switch.rpi_rf/) page. |
| 142 | + |
| 143 | +#### {% linkable_title One wire Sensor %} |
| 144 | +The One wire sensor requires that support for it is enabled on the Raspberry Pi and that the One Wire device is connected to GPIO pin 4. |
| 145 | +To enable One Wire support add the following line to the end of `/boot/config.txt` |
| 146 | +```yaml |
| 147 | +dtoverlay=w1-gpio |
| 148 | +``` |
| 149 | +After this follow the [One Wire Sensor component](/components/sensor.onewire/) page. |
27 | 150 |
|
28 | 151 | ### {% linkable_title Troubleshooting %}
|
29 | 152 |
|
|
0 commit comments