@@ -45,259 +34,17 @@ If you prefer to watch a video tutorial, [tktino](https://github.com/tktino) has ### {% linkable_title Updating %} -To update Home Assistant to the latest release when available, run: `pip3 install --upgrade homeassistant` - -You have to restart Home Assistant (`hass` itself or with the help of the autostarting daemon if you use any) for the changes to take effect. - -
-When using boot2docker on OS X you are unable to map the local time to your Docker container. Replace `-v /etc/localtime:/etc/localtime:ro` with `-e "TZ=America/Los_Angeles"` (replacing America/Los_Angeles with [your timezone](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones)) -
- -+When using boot2docker on OS X you are unable to map the local time to your Docker container. Replace `-v /etc/localtime:/etc/localtime:ro` with `-e "TZ=America/Los_Angeles"` (replacing America/Los_Angeles with [your timezone](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones)) +
+ +### {% linkable_title Troubleshooting %} + +If you run into any issues, please see [the troubleshooting page](/getting-started/troubleshooting/). It contains solutions to many of the more commonly encountered issues. + +In addition to this site, check out these sources for additional help: + + - [Forum](https://community.home-assistant.io) for Home Assistant discussions and questions. + - [Gitter Chat Room](https://gitter.im/balloob/home-assistant) for real-time chat about Home Assistant. + - [GitHub Page](https://github.com/home-assistant/home-assistant/issues) for issue reporting. + +### [Next step: Configuring Home Assistant »](/getting-started/configuration/) diff --git a/source/getting-started/installation-raspberry-pi.markdown b/source/getting-started/installation-raspberry-pi.markdown new file mode 100644 index 00000000000..5cc49c1c008 --- /dev/null +++ b/source/getting-started/installation-raspberry-pi.markdown @@ -0,0 +1,50 @@ +--- +layout: page +title: "Installation on a Raspberry Pi" +description: "Instructions to install Home Assistant on a Raspberry Pi." +date: 2016-04-16 11:36 +sidebar: true +comments: false +sharing: true +footer: true +--- + +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. + +Execute the following code in a console: + +```bash +$ sudo pip3 install homeassistant +$ hass +``` + +Running these commands will: + + - Install Home Assistant + - Launch Home Assistant and serve the web interface on [http://localhost:8123](http://localhost:8123) + +There is also a [video tutorial](https://www.youtube.com/watch?v=GjzOXkPb7XE) created by [brusc](https://github.com/brusc). + +### {% linkable_title Updating %} + +To update Home Assistant to the latest release when available, run: `pip3 install --upgrade homeassistant` + +You have to restart Home Assistant (`hass` itself or with the help of the autostarting daemon if you use any) for the changes to take effect. + +### {% linkable_title Troubleshooting %} + +If you run into any issues, please see [the troubleshooting page](/getting-started/troubleshooting/). It contains solutions to many of the more commonly encountered issues. + +In addition to this site, check out these sources for additional help: + + - [Forum](https://community.home-assistant.io) for Home Assistant discussions and questions. + - [Gitter Chat Room](https://gitter.im/balloob/home-assistant) for real-time chat about Home Assistant. + - [GitHub Page](https://github.com/home-assistant/home-assistant/issues) for issue reporting. + +### {% linkable_title What's next %} + +If you want to have Home Assistant start on boot, [autostart instructions can be found here](/getting-started/autostart-systemd/). + +To see what Home Assistant can do, launch demo mode: `hass --demo-mode` or visit the [demo page](/demo). + +### [Next step: Configuring Home Assistant »](/getting-started/configuration/) diff --git a/source/getting-started/installation-synology.markdown b/source/getting-started/installation-synology.markdown new file mode 100644 index 00000000000..0903aed1854 --- /dev/null +++ b/source/getting-started/installation-synology.markdown @@ -0,0 +1,223 @@ +--- +layout: page +title: "Installation on a Synology NAS" +description: "Instructions to install Home Assistant on a Synology NAS." +date: 2016-04-16 11:36 +sidebar: true +comments: false +sharing: true +footer: true +--- + +The following configuration has been tested on Synology 413j running DSM 6.0-7321 Update 1. + +Running these commands will: + + - Install Home Assistant + - Enable Home Assistant to be launched on [http://localhost:8123](http://localhost:8123) + +Using the Synology webadmin: + + - Install python3 using the Synology package centre + - Create homeassistant user and add to the "users" group + +SSH onto your synology & login as admin or root + +Check the path to python3 (assumed to be /volume1/@appstore/py3k/usr/local/bin) + +```bash +$ cd /volume1/@appstore/py3k/usr/local/bin +``` + +Install PIP (Python's package management system) + +```bash +$ python -m ensurepip +``` + +Use PIP to install Homeassistant package + +```bash +$ pip3 install homeassistant +``` + +Create homeassistant config directory & switch to it + +```bash +$ mkdir /volume1/homeassistant +$ cd /volume1/homeassistant +``` + +Create hass-daemon file using the following code (edit the variables in uppercase if necessary) + +```bash +#!/bin/sh + +# Package +PACKAGE="homeassistant" +DNAME="Home Assistant" + +# Others +USER="homeassistant" +PYTHON_DIR="/volume1/@appstore/py3k/usr/local/bin" +PYTHON="$PYTHON_DIR/python3" +HASS="$PYTHON_DIR/hass" +INSTALL_DIR="/volume1/homeassistant" +PID_FILE="$INSTALL_DIR/home-assistant.pid" +FLAGS="-v --config $INSTALL_DIR --pid-file $PID_FILE --daemon" +REDIRECT="> $INSTALL_DIR/home-assistant.log 2>&1" + +start_daemon () +{ + su ${USER} -s /bin/sh -c "$PYTHON $HASS $FLAGS $REDIRECT;" +} + +stop_daemon () +{ + kill `cat ${PID_FILE}` + wait_for_status 1 20 || kill -9 `cat ${PID_FILE}` + rm -f ${PID_FILE} +} + +daemon_status () +{ + if [ -f ${PID_FILE} ] && kill -0 `cat ${PID_FILE}` > /dev/null 2>&1; then + return + fi + rm -f ${PID_FILE} + return 1 +} + +wait_for_status () +{ + counter=$2 + while [ ${counter} -gt 0 ]; do + daemon_status + [ $? -eq $1 ] && return + let counter=counter-1 + sleep 1 + done + return 1 +} + +case $1 in + start) + if daemon_status; then + echo ${DNAME} is already running + exit 0 + else + echo Starting ${DNAME} ... + start_daemon + exit $? + fi + ;; + stop) + if daemon_status; then + echo Stopping ${DNAME} ... + stop_daemon + exit $? + else + echo ${DNAME} is not running + exit 0 + fi + ;; + restart) + if daemon_status; then + echo Stopping ${DNAME} ... + stop_daemon + echo Starting ${DNAME} ... + start_daemon + exit $? + else + echo ${DNAME} is not running + echo Starting ${DNAME} ... + start_daemon + exit $? + fi + ;; + status) + if daemon_status; then + echo ${DNAME} is running + exit 0 + else + echo ${DNAME} is not running + exit 1 + fi + ;; + log) + echo ${LOG_FILE} + exit 0 + ;; + *) + exit 1 + ;; +esac + +``` + +Create links to python folders to make things easier in the future: + +```bash +$ ln -s /volume1/@appstore/py3k/usr/local/bin python3 +$ ln -s /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/homeassistant +``` + +Set the owner and permissions on your config folder + +```bash +$ chown -R homeassistant:users /volume1/homeassistant +$ chmod -R 664 /volume1/homeassistant +``` + +Make the daemon file executable: + +```bash +$ chmod 777 /volume1/homeassistant/hass-daemon +``` + +Copy your configuration.yaml file into the config folder +That's it... you're all set to go + +Here are some useful commands: + +- Start Home Assistant: + +```bash +$ sh hass-daemon start +``` + +- Stop Home Assistant: + +```bash +$ sh hass-daemon stop +``` + +- Restart Home Assistant: + +```bash +$ sh hass-daemon restart +``` + +- Upgrade Home Assistant:: + +```bash +$ python3 -m pip install --upgrade homeassistant +``` + +### {% linkable_title Troubleshooting %} + +If you run into any issues, please see [the troubleshooting page](/getting-started/troubleshooting/). It contains solutions to many of the more commonly encountered issues. + +In addition to this site, check out these sources for additional help: + + - [Forum](https://community.home-assistant.io) for Home Assistant discussions and questions. + - [Gitter Chat Room](https://gitter.im/balloob/home-assistant) for real-time chat about Home Assistant. + - [GitHub Page](https://github.com/home-assistant/home-assistant/issues) for issue reporting. + +### {% linkable_title What's next %} + +If you want to have Home Assistant start on boot, [autostart instructions can be found here](/getting-started/autostart-synology/). + +To see what Home Assistant can do, launch demo mode: `hass --demo-mode` or visit the [demo page](/demo). + +### [Next step: Configuring Home Assistant »](/getting-started/configuration/) diff --git a/source/getting-started/installation-virtualenv.markdown b/source/getting-started/installation-virtualenv.markdown new file mode 100644 index 00000000000..ec1acce3ebe --- /dev/null +++ b/source/getting-started/installation-virtualenv.markdown @@ -0,0 +1,126 @@ +--- +layout: page +title: "Installation in virtualenv" +description: "Instructions how to install Home Assistant in a virtual environment." +date: 2016-4-16 16:40 +sidebar: true +comments: false +sharing: true +footer: true +--- + +There are several reasons why it makes sense to run Home Assistant in a virtualenv. 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 HA, and it means you don't need to install a bunch of 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 HA users are running Raspbian on a Raspberry Pi), but all of the Python related steps should be the same on just about any platform. + +## Step 0: Install some dependencies + +```bash +sudo apt-get update +sudo apt-get upgrade +sudo apt-get install python-pip +sudo pip install --upgrade virtualenv +``` + +## Step 1: Create a Home Assistant user + +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 HA. This is a reasonably Linux oriented step, and will look different on other OS's (or even other Linux distros). + +```bash +sudo adduser --system hass +``` + +Home Assistant stores its config in `$HOME/.homeassistant` by default, so in this case, it would be in `/home/hass/.homeassistant` + +## Step 2: Create a directory for Home Assistant + +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) + +```bash +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. + +```bash +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). + +## Step 4: Set up the virtualenv + +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. + +```bash +virtualenv -p python3 /srv/hass +``` + +## Step 5: Activate the virtualenv + +```bash +source /srv/hass/bin/activate +``` + +After that, your prompt should include '(hass)'. + +## Step 6: Install Home Assistant + +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. + +```bash +(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 + +## Finally... Run Home Assistant + +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 that bin directory I mentioned earlier. There is one caveat... Because Home Assistant stores it's config in the user's home directory, we need to be the hass user. + +```bash +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 configs. + +## Upgrading Home Assistant + +Upgrading HA is simple, just repeat steps 3, 5 and 6. + +## Starting Home Assistant on boot + +The autostart instructions on home-assistant.io will work just fine, just be sure to replace `/usr/bin/hass` with `/srv/hass/bin/hass` and specify the 'hass' user where appropriate. + +## Installing python-openzwave + +If you want to use Z Wave devices, you'll 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). + +```bash +$ sudo apt-get install cython3 libudev-dev python3-sphinx python3-setuptools +``` + +Then, activate your virtualenv (steps 3 and 5 above) and upgrade cython. + +```bash +(hass)$ pip3 install --upgrade cython +``` + +Finally, get and install python-openzwave + +```bash +(hass)$ mkdir /srv/hass/src +(hass)$ cd /srv/hass/src +(hass)$ git clone https://github.com/OpenZWave/python-openzwave.git +(hass)$ cd python-openzwave +(hass)$ git checkout python3 +(hass)$ PYTHON_EXEC=`which python3` make build +(hass)$ PYTHON_EXEC=`which python3` make install +``` \ No newline at end of file diff --git a/source/getting-started/presence-detection.markdown b/source/getting-started/presence-detection.markdown index edb2093da74..873921b2ef0 100644 --- a/source/getting-started/presence-detection.markdown +++ b/source/getting-started/presence-detection.markdown @@ -3,7 +3,7 @@ layout: page title: "Setting up presence detection" description: "Instructions how to setup presence detection within Home Assistant." date: 2015-10-4 12:08 -sidebar: false +sidebar: true comments: false sharing: true footer: true diff --git a/source/getting-started/troubleshooting-configuration.markdown b/source/getting-started/troubleshooting-configuration.markdown index 55e69fb2b92..00a1651d11b 100644 --- a/source/getting-started/troubleshooting-configuration.markdown +++ b/source/getting-started/troubleshooting-configuration.markdown @@ -3,7 +3,7 @@ layout: page title: "Troubleshooting your configuration" description: "Common problems with tweaking your configuration and their solutions." date: 2015-01-20 22:36 -sidebar: false +sidebar: true comments: false sharing: true footer: true diff --git a/source/getting-started/troubleshooting.markdown b/source/getting-started/troubleshooting.markdown index 984a73525ed..111213daaae 100644 --- a/source/getting-started/troubleshooting.markdown +++ b/source/getting-started/troubleshooting.markdown @@ -3,7 +3,7 @@ layout: page title: "Troubleshooting installation problems" description: "Common installation problems and their solutions." date: 2015-01-20 22:36 -sidebar: false +sidebar: true comments: false sharing: true footer: true