diff --git a/atom.xml b/atom.xml index c106b2bca7..101fc00af0 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@
Easily deploy a complete Home Assistant server, with Websocket MQTT and Z-Wave driver support using Fabric!
+The “Raspberry Pi All-In-One Installer” deploy a complete Home Assistant server including support for MQTT with websocket support and Z-Wave using Fabric.
Requirements before installation:
git
installed.Installation instructions (all from your PC):
pip3 install fabric3
git clone https://github.com/jbags81/fabric-home-assistant.git
cd fabric-home-assistant
fabfile.py
and add the host info of your Raspberry Pi.git clone https://github.com/jbags81/fabric-home-assistant.git
cd fabric-home-assistant
fabfile.py
file and add the hostname or the IP address of your Raspberry Pi to env.hosts
. If you are using Debian 8 then replace the username pi
in the fabfile.py
file with your Debian user as well.fab deploy
Once rebooted, your Raspberry Pi will be up and running with Home Assistant. You can access it from http://your_raspberry_pi_ip:8123.
+Once rebooted, your Raspberry Pi will be up and running with Home Assistant. You can access it at http://your_raspberry_pi_ip:8123.
-The Home Assistant config is located at /home/hass
. The virtualenv with the Home Assistant installation is located at /srv/hass/hass_venv
.
The Home Assistant configuration is located at /home/hass
. The virtualenv with the Home Assistant installation is located at /srv/hass/hass_venv
.
The All-In-One Fabric script will do the following automatically:
@@ -130,13 +130,6 @@Fabric allows any of the underlying functions to be ran individually as well. Run fab -l
to see a list of all callable jobs.
Tested with:
- -There are several reasons why it makes sense to run Home Assistant in a virtual environment. A virtualenv encapsulates all aspect of a Python environment within a single directory tree. That means the Python packages you install for Home Assistant won’t interact with the rest of your system and vice-versa. It means a random upgrade for some other program on your computer won’t break Home Assitant, and it means you don’t need to install Python packages as root.
+There are several reasons why it makes sense to run Home Assistant in a virtual environment. A virtualenv encapsulates all aspect of a Python environment within a single directory tree. That means the Python packages you install for Home Assistant won’t interact with the rest of your system and vice-versa. It means a random upgrade for some other program on your computer won’t break Home Assitant, and it means you don’t need to install Python packages as root.
Virtualenvs are pretty easy to setup. This example will walk through one method of setting one up (there are certainly others). We’ll be using Debian in this example (as many Home Assistant users are running Raspbian on a Raspberry Pi), but all of the Python related steps should be the same on just about any platform.
sudo apt-get update -sudo apt-get upgrade -sudo apt-get install python-pip -sudo pip install --upgrade virtualenv +$ sudo apt-get update +$ sudo apt-get upgrade +$ sudo apt-get install python-pip +$ sudo pip install --upgrade virtualenv
This step is optional, but it’s a good idea to give services like Home Assistant their own user. It gives you more granular control over permissions, and reduces the exposure to the rest of your system in the event there is a security related bug in Home Assistant. This is a reasonably Linux oriented step, and will look different on other operating systems (or even other Linux distributions).
sudo adduser --system hass +$ sudo adduser --system hass
If you plan to use a Z-Wave controller, you will need to add this user to the dialout
group
sudo usermod -G dialout -a hass +$ sudo usermod -G dialout -a hass
This can be anywhere you want, but I generally put stuff related to servers in /srv
. You also need to change the ownership of the directory to the user you created above (if you created one)
This can be anywhere you want. AS example we put it in /srv
. You also need to change the ownership of the directory to the user you created above (if you created one).
sudo mkdir /srv/hass -sudo chown hass /srv/hass +$ sudo mkdir /srv/hass +$ sudo chown hass /srv/hass
## Step 3: Become the new user
-This is obviously only necessary if you created a ‘hass’ user, but if you did, be sure to switch to that user whenever you install things in your virtualenv, otherwise you’ll end up with mucked up permissions.
+This is obviously only necessary if you created a hass
user, but if you did, be sure to switch to that user whenever you install things in your virtualenv, otherwise you’ll end up with mucked up permissions.
sudo su -s /bin/bash hass +$ sudo su -s /bin/bash hass
The ‘su’ command means ‘switch’ user. We use the ‘-s’ flag because the hass user is a system user and doesn’t have a default shell by default (to prevent attackers from being able to log in as that user).
+The su
command means ‘switch’ user. We use the ‘-s’ flag because the hass
user is a system user and doesn’t have a default shell by default (to prevent attackers from being able to log in as that user).
All this step does is stick a Python environment in the directory we’re using. That’s it. It’s just a directory. There’s nothing ‘special’ about it, and it is entirely self-contained.
-It will include a ‘bin’ directory, which will contain all the executables used in the virtualenv (including hass itself). It also includes a script called ‘activate’ which we will use to activate the virtualenv.
+It will include a bin
directory, which will contain all the executables used in the virtualenv (including hass itself). It also includes a script called activate
which we will use to activate the virtualenv.
virtualenv -p python3 /srv/hass +$ virtualenv -p python3 /srv/hass
source /srv/hass/bin/activate +$ source /srv/hass/bin/activate
After that, your prompt should include ‘(hass)’.
+After that, your prompt should include (hass)
.
Once your virtualenv has been activated, you don’t need to sudo
any of your pip commands. Pip will be installing things in the virtualenv, which our ‘hass’ user has permission to modify.
Once your virtualenv has been activated, you don’t need to sudo
any of your pip
commands. pip
will be installing things in the virtualenv, which the hass
user has permission to modify.
(hass)pip3 install --upgrade homeassistant +(hass)$ pip3 install --upgrade homeassistant
And that’s it… you now have Home Assistant installed, and you can be sure that every bit of it is contained in /srv/hass
+And that’s it… you now have Home Assistant installed, and you can be sure that every bit of it is contained in /srv/hass
.
There are two ways to launch Home Assistant. If you are ‘in’ the virtualenv, you can just run hass
and it will work as normal. If the virtualenv is not activated, you just use the hass
executable in the bin
directory mentioned earlier. There is one caveat… Because Home Assistant stores it’s configuration in the user’s home directory, we need to be the user hass
user or specify the configuration with -c
.
There are two ways to launch Home Assistant. If you are in the virtualenv, you can just run hass
and it will work as normal. If the virtualenv is not activated, you just use the hass
executable in the bin
directory mentioned earlier. There is one caveat… Because Home Assistant stores it’s configuration in the user’s home directory, we need to be the user hass
user or specify the configuration with -c
.
sudo -u hass -H /srv/hass/bin/hass +$ sudo -u hass -H /srv/hass/bin/hass
The ‘-H’ flag is important. It sets the $HOME
environment variable to /home/hass
so hass
can find its configuration.
The -H
flag is important. It sets the $HOME
environment variable to /home/hass
so hass
can find its configuration.
If you want to use Z-Wave devices, you will need to install python-openzwave
in your virtualenv. This requires a small tweak to the instructions on home-assistant.io
Install the dependencies as normal (Note: you’ll need to do this as your normal user, since ‘hass’ isn’t a sudoer).
+Install the dependencies as normal (Note: you will need to do this as your normal user, since hass
isn’t a sudoer).
$ sudo apt-get install cython3 libudev-dev python3-sphinx python3-setuptools @@ -220,7 +220,7 @@ sudo chown hass /srv/hass
Finally, get and install python-openzwave
+Finally, get and install python-openzwave
.
(hass)$ mkdir /srv/hass/src diff --git a/sitemap.xml b/sitemap.xml index 4c21e23df3..b0a80c8005 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1600,26 +1600,26 @@https://home-assistant.io/demo/frontend.html -2016-05-13T20:24:27+00:00 +2016-05-13T21:08:05+00:00 https://home-assistant.io/demo/index.html -2016-05-13T20:24:27+00:00 +2016-05-13T21:08:05+00:00 https://home-assistant.io/googlef4f3693c209fe788.html -2016-05-13T20:24:27+00:00 +2016-05-13T21:08:05+00:00 https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html -2016-05-13T20:24:27+00:00 +2016-05-13T21:08:05+00:00 https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html -2016-05-13T20:24:27+00:00 +2016-05-13T21:08:05+00:00 https://home-assistant.io/static/mdi-demo.html -2016-05-13T20:24:27+00:00 +2016-05-13T21:08:05+00:00