Skip to content

Commit 811f5b4

Browse files
authored
Rewriting of installation guide for Raspberry Pi and cleanup of associated components. (home-assistant#901)
Rewriting of installation guide for Raspberry Pi
2 parents 314ce89 + 76938c3 commit 811f5b4

5 files changed

+135
-33
lines changed

source/_components/binary_sensor.rpi_gpio.markdown

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ ha_category: Binary Sensor
1212
ha_release: pre 0.7
1313
---
1414

15-
1615
The `rpi_gpio` binary sensor platform allows you to read sensor values of the GPIOs of your [Raspberry Pi](https://www.raspberrypi.org/).
1716

1817
To use your Raspberry Pi's GPIO in your installation, add the following to your `configuration.yaml` file:
@@ -39,10 +38,3 @@ Configuration variables:
3938
4039
For more details about the GPIO layout, visit the Wikipedia [article](https://en.wikipedia.org/wiki/Raspberry_Pi#GPIO_connector) about the Raspberry Pi.
4140
42-
<p class='note warning'>
43-
If you are not running Raspbian Jessie, you will need to run Home Assistant as root.
44-
</p>
45-
46-
<p class='note warning'>
47-
To avoid having to run Home Assistant as root when using this component, run a Raspbian version released at or after September 29, 2015.
48-
</p>

source/_components/camera.rpi_camera.markdown

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ha_release: 0.17
1414
---
1515

1616

17-
The `rpi` platform allows you to integrate the Raspberry Pi camera into Home Assistant. This component uses the application [`raspistill`](https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md) to store the image from camera.
17+
The `rpi_camera` platform allows you to integrate the Raspberry Pi camera into Home Assistant. This component uses the application [`raspistill`](https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md) to store the image from camera.
1818

1919
To enable this camera in your installation, add the following to your `configuration.yaml` file:
2020

@@ -47,9 +47,3 @@ Configuration variables:
4747
4848
The given **file_path** must be an existing file because the camera platform setup make a writeable check on it.
4949
50-
Ensure that the user who is running Home Assistant is in the video group. Eg. for the user `hass`:
51-
52-
```bash
53-
$ sudo usermod -a -G video hass
54-
```
55-

source/_components/device_tracker.bluetooth_tracker.markdown

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ ha_release: 0.18
1616
This tracker discovers new devices on boot and tracks bluetooth devices periodically based on interval_seconds value. It is not required to pair the devices with each other!
1717
Devices discovered are stored with 'bt_' as the prefix for device mac addresses in `known_devices.yaml`.
1818

19-
<p class='note'>
20-
Requires PyBluez. If you are on Raspbian, make sure you first install `bluetooth` and `libbluetooth-dev` by running `sudo apt install bluetooth libbluetooth-dev`
21-
</p>
22-
2319
To use the Bluetooth tracker in your installation, add the following to your `configuration.yaml` file:
2420

2521
```yaml

source/_components/switch.rpi_gpio.markdown

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,3 @@ Configuration variables:
3535
3636
For more details about the GPIO layout, visit the Wikipedia [article](https://en.wikipedia.org/wiki/Raspberry_Pi#GPIO_connector) about the Raspberry Pi.
3737
38-
<p class='note warning'>
39-
If you are not running Raspbian Jessie, you will need to run Home Assistant as root.
40-
</p>

source/getting-started/installation-raspberry-pi.markdown

Lines changed: 134 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,152 @@
11
---
22
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
66
sidebar: true
77
comments: false
88
sharing: true
99
footer: true
1010
---
1111

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 %}
1313

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.
1516

17+
Connect to the Raspberry Pi over ssh. Default password is `raspberry`.
1618
```bash
17-
$ sudo pip3 install homeassistant
18-
$ hass
19+
$ ssh pi@ipadress
1920
```
2021

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.
2298

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.
25105

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.
27150

28151
### {% linkable_title Troubleshooting %}
29152

0 commit comments

Comments
 (0)