Update getting started

This commit is contained in:
Paulus Schoutsen 2016-04-16 17:10:09 -07:00
parent 02022912d8
commit 432ee1a169
25 changed files with 691 additions and 540 deletions

View File

@ -1,5 +1,3 @@
require 'pry'
module Jekyll
class ActiveLinkTag < Liquid::Tag
def initialize(tag_name, text, token)
@ -10,8 +8,10 @@ module Jekyll
end
def render(context)
href = Liquid::Template.parse(@href).render context
title = Liquid::Template.parse(@title).render context
cls = @href == context.registers[:page]["url"] ? "class='active'" : ''
"<a #{cls} href='#{@href}'>#{@title}</a>"
"<a #{cls} href='#{href}'>#{title}</a>"
end
end
end

View File

@ -6,7 +6,7 @@ module Jekyll
end
def render(context)
title = Liquid::Template.parse(@markup).render context
title = Liquid::Template.parse(@title).render context
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
"<a class='title-link' name='#{slug}' href='\##{slug}'></a> #{title}"
end

View File

@ -204,85 +204,6 @@ p.note {
}
}
.install-instructions-container {
#normal-install, #raspberry-install, #docker-install, #synology-install, .install-instructions {
display: none;
}
label.menu-selector {
display: inline-block;
text-align: center;
padding: 20px;
white-space: nowrap;
border-bottom: 5px solid $grayLight;
transition: border-bottom-color .5s;
}
label.menu-selector + label.menu-selector {
margin-left: 10px;
}
#normal-install:checked ~ .menu-selector.normal,
#raspberry-install:checked ~ .menu-selector.raspberry,
#docker-install:checked ~ .menu-selector.docker,
#synology-install:checked ~ .menu-selector.synology
{
border-bottom-color: $blue;
}
#normal-install:checked ~ .install-instructions.normal,
#raspberry-install:checked ~ .install-instructions.raspberry,
#docker-install:checked ~ .install-instructions.docker,
#synology-install:checked ~ .install-instructions.synology
{
display: block;
}
.install-instructions {
margin-top: 30px;
}
}
.advanced-installs-container {
#upstart-install, #systemd-install, #osx-install, #synology-install, .advanced-installs {
display: none;
}
label.menu-selector {
display: inline-block;
text-align: center;
padding: 20px;
white-space: nowrap;
border-bottom: 5px solid $grayLight;
transition: border-bottom-color .5s;
}
label.menu-selector + label.menu-selector {
margin-left: 10px;
}
#upstart-install:checked ~ .menu-selector.upstart,
#systemd-install:checked ~ .menu-selector.systemd,
#osx-install:checked ~ .menu-selector.osx,
#synology-install:checked ~ .menu-selector.synology
{
border-bottom-color: $blue;
}
#upstart-install:checked ~ .advanced-installs.upstart,
#systemd-install:checked ~ .advanced-installs.systemd,
#osx-install:checked ~ .advanced-installs.osx,
#synology-install:checked ~ .advanced-installs.synology
{
display: block;
}
.advanced-installs {
margin-top: 30px;
}
}
#components-page {
.isotope-item {
z-index: 2;

View File

@ -0,0 +1,40 @@
<section class="aside-module grid__item one-whole lap-one-half">
{% include edit_github.html %}
<div class='section'>
<h1 class="title delta">Getting Started Guide</h1>
<ul class='divided sidebar-menu'>
<li>
{% active_link /getting-started/ Installation %}
<ul>
<li>{% active_link /getting-started/installation-raspberry-pi/ Raspberry Pi %}</li>
<li>{% active_link /getting-started/installation-docker/ Docker %}</li>
<li>{% active_link /getting-started/installation-synology/ Synology NAS %}</li>
<li>{% active_link /getting-started/installation-virtualenv/ Virtual Environment %}</li>
<li>{% active_link /getting-started/troubleshooting/ Troubleshooting %}</li>
</ul>
</li>
<li>
Configuration
<ul>
<li>{% active_link /getting-started/configuration/ Configuration.yaml %}</li>
<li>{% active_link /getting-started/devices/ Setting up devices %}</li>
<li>{% active_link /getting-started/presence-detection/ Presence Detection %}</li>
<li>{% active_link /getting-started/automation/ Automation %}</li>
<li>{% active_link /getting-started/troubleshooting-configuration/ Troubleshooting configuration.yaml %}</li>
</ul>
</li>
<li>
Auto-start Home Assistant
<ul>
<li>{% active_link /getting-started/autostart-systemd/ Linux - SystemD %}</li>
<li>{% active_link /getting-started/autostart-upstart/ Linux - Upstart %}</li>
<li>{% active_link /getting-started/autostart-macos/ macOS %}</li>
<li>{% active_link /getting-started/autostart-synology/ Synology NAS %}</li>
</ul>
</li>
<li><a href='/topics/'>Advanced Topics</a></li>
<li>{% active_link /getting-started/android/ Add to Android Homescreen %}</li>
</ul>
</div>
</section>

View File

@ -1,15 +1,15 @@
<ul class="menu pull-right">
{% comment %}
Example dropdown menu
<li>
<a>Getting started <i class="icon icon-caret-down"></i></a>
<ul>
<li><a href='/getting-started/'>Installing Home Assistant</a></li>
<li><a href='/getting-started/configuration/'>Configuration Basics</a></li>
<li><a href='/getting-started/devices/'>Adding devices</a></li>
<li><a href='/getting-started/presence-detection/'>Presence Detection</a></li>
<li><a href='/getting-started/automation/'>Automation</a></li>
<li><a href='/topics/'>Advanced Topics</a></li>
</ul>
</li>
{% endcomment %}
<li><a href='/getting-started/'>Getting started</a></li>
<li><a href='/components/'>Components</a></li>
<li><a href='/cookbook/'>Examples</a></li>
<li><a href="/developers/">Developers</a></li>

View File

@ -1,7 +1,4 @@
{% assign url_parts = page.url | split: '/' %}
{% if page.hide_github_edit != true and
url_parts[1] != 'components' and
url_parts[1] != 'cookbook' and
url_parts[1] != 'developers' %}
{% if page.hide_github_edit != true %}
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.io/tree/master/source/{{ page.path }}'>Edit this page on GitHub</a></div>
{% endif %}

View File

@ -6,6 +6,8 @@
{% include asides/cookbook_navigation.html | compact_newlines %}
{% elsif url_parts[1] == 'developers' %}
{% include asides/developers_navigation.html | compact_newlines %}
{% elsif url_parts[1] == 'getting-started' %}
{% include asides/getting_started_navigation.html | compact_newlines %}
{% else %}
{% include asides/about.html %}

View File

@ -3,7 +3,13 @@ layout: default
---
<article class="page">
{% assign url_parts = page.url | split: '/' %}
{% if url_parts[1] != 'components' and
url_parts[1] != 'cookbook' and
url_parts[1] != 'developers' and
url_parts[1] != 'getting-started' %}
{% include edit_github.html %}
{% endif %}
{% if page.title and page.show_title != false %}
<header>

View File

@ -3,7 +3,7 @@ layout: page
title: "Getting started on Android"
description: "Android instructions to add Home Assistant to your homescreen."
date: 2015-03-08 21:36
sidebar: false
sidebar: true
comments: false
sharing: true
footer: true

View File

@ -3,7 +3,7 @@ layout: page
title: "Automating Home Assistant"
description: "Steps to help you get automation setup in Home Assistant."
date: 2015-09-19 09:40
sidebar: false
sidebar: true
comments: false
sharing: true
footer: true

View File

@ -0,0 +1,31 @@
---
layout: page
title: "Autostart on macOS boot"
description: "Instructions how to setup Home Assistant to launch on macOS boot."
date: 2015-9-1 22:57
sidebar: true
comments: false
sharing: true
footer: true
---
Setting up Home Assistant to run as a background service is simple. OS X will start it on boot and make sure it's always running.
To get Home Assistant installed as a background service, run:
```bash
$ hass --install-osx
Home Assistant has been installed. Open it here: http://localhost:8123
```
Home Assistant will log to `~/Library/Logs/homeassistant.log`
To uninstall the service, run:
```bash
$ hass --uninstall-osx
Home Assistant has been uninstalled.
```

View File

@ -0,0 +1,49 @@
---
layout: page
title: "Autostart on Synology NAS boot"
description: "Instructions how to setup Home Assistant to launch on boot on Synology NAS."
date: 2015-9-1 22:57
sidebar: true
comments: false
sharing: true
footer: true
---
To get Home Assistant to automatically start when you boot your Synology NAS:
SSH onto your synology & login as admin or root
```bash
$ cd /volume1/homeassistant
```
Create "homeassistant.conf" file using the following code
```bash
# only start this service after the httpd user process has started
start on started httpd-user
# stop the service gracefully if the runlevel changes to 'reboot'
stop on runlevel [06]
# run the scripts as the 'http' user. Running as root (the default) is a bad ide
#setuid admin
# exec the process. Use fully formed path names so that there is no reliance on
# the 'www' file is a node.js script which starts the foobar application.
exec /bin/sh /volume1/homeassistant/hass-daemon start
```
Register the autostart
```bash
$ ln -s homeassistant-conf /etc/init/homeassistant-conf
```
Make the relevant files executable:
```bash
$ chmod -r 777 /etc/init/homeassistant-conf
```
That's it - reboot your NAS and Home Assistant should automatically start

View File

@ -0,0 +1,70 @@
---
layout: page
title: "Autostart using SystemD"
description: "Instructions how to setup Home Assistant to launch on boot using SystemD."
date: 2015-9-1 22:57
sidebar: true
comments: false
sharing: true
footer: true
---
Newer linux distributions are trending towards using systemd for managing daemons. Typically, systems based on Fedora or Debian 8 or later use systemd. This includes Ubuntu releases including and after 15.04, CentOS, and Red Hat. If you are unsure if your system is using `systemd`, you may check with the following command:
```bash
$ ps -p 1 -o comm=
```
If the preceding command returns the string `systemd`, you are likely using `systemd`.
If you want Home Assistant to be launched automatically, an extra step is needed to setup `systemd`. You need a service file to control Home Assistant with `systemd`. If you are using a Raspberry Pi with Raspbian then replace the `[your user]` with `pi` otherwise use your user you want to run Home Assistant. `ExecStart` contains the path to `hass` and this may vary. Check with `whereis hass` for the location.
```bash
$ su -c 'cat <<EOF >> /lib/systemd/system/home-assistant@[your user].service
[Unit]
Description=Home Assistant
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/usr/bin/hass
[Install]
WantedBy=multi-user.target
EOF'
```
There is also another [sample service file](https://raw.githubusercontent.com/balloob/home-assistant/master/script/home-assistant%40.service) available. To use this one, just download it.
```bash
$ sudo wget https://raw.githubusercontent.com/balloob/home-assistant/master/script/home-assistant%40.service -O /lib/systemd/system/home-assistant@[your user].service
```
You need to reload `systemd` to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.
```bash
$ sudo systemctl --system daemon-reload
$ sudo systemctl enable home-assistant@[your user]
$ sudo systemctl start home-assistant@[your user]
```
If everything went well, `sudo systemctl start home-assistant` should give you a positive feedback.
```bash
$ sudo systemctl status home-assistant@[your user] -l
● home-assistant@fab.service - Home Assistant for [your user]
Loaded: loaded (/usr/lib/systemd/system/home-assistant@[your user].service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2016-03-26 12:26:06 CET; 13min ago
Main PID: 30422 (hass)
CGroup: /system.slice/system-home\x2dassistant.slice/home-assistant@[your user].service
├─30422 /usr/bin/python3 /usr/bin/hass
└─30426 /usr/bin/python3 /usr/bin/hass
[...]
```
To get Home Assistant's logging output, simple use `journalctl`.
```bash
$ sudo journalctl -f -u home-assistant@[your user]
```

View File

@ -0,0 +1,31 @@
---
layout: page
title: "Autostart using Upstart"
description: "Instructions how to setup Home Assistant to launch on boot using Upstart."
date: 2015-9-1 22:57
sidebar: true
comments: false
sharing: true
footer: true
---
Many linux distributions use the Upstart system (or similar) for managing daemons. Typically, systems based on Debian 7 or previous use Upstart. This includes Ubuntu releases before 15.04. If you are unsure if your system is using Upstart, you may check with the following command:
```bash
$ ps -p 1 -o comm=
```
If the preceding command returns the string `init`, you are likely using Upstart.
Upstart will launch init scripts that are located in the directory `/etc/init.d/`. A sample init script for systems using Upstart is <a href="https://raw.githubusercontent.com/balloob/home-assistant/dev/script/hass-daemon">maintained by this project</a>.
To install this script, download it, tweak it to you liking, and install it by following the directions in the header. This script will setup Home Assistant to run when the system boots. To start/stop Home Assistant manually, issue the following commands:
```bash
$ sudo service hass-daemon start
$ sudo service hass-daemon stop
```
When running Home Assistant with this script, the configuration directory will be located at `/var/opt/homeassistant`. This directory will contain a verbose log rather than simply an error log.
When running daemons, it is good practice to have the daemon run under its own user name rather than the default user's name. Instructions for setting this up are outside the scope of this document.

View File

@ -1,174 +0,0 @@
---
layout: page
title: "Launch Home Assistant on boot"
description: "Instructions how to setup Home Assistant to launch on boot on various platforms."
date: 2015-9-1 22:57
sidebar: false
comments: false
sharing: true
footer: true
---
<div class='advanced-installs-container' markdown='0'>
<input name='advanced-installs' type='radio' id='upstart-install' checked>
<input name='advanced-installs' type='radio' id='systemd-install'>
<input name='advanced-installs' type='radio' id='osx-install'>
<input name='advanced-installs' type='radio' id='synology-install'>
<label class='menu-selector upstart' for='upstart-install'>Upstart Daemon</label>
<label class='menu-selector systemd' for='systemd-install'>Systemd Daemon</label>
<label class='menu-selector osx' for='osx-install'>OS X</label>
<label class='menu-selector synology' for='synology-install'>Synology NAS</label>
<div class='advanced-installs upstart' markdown='1'>
Many linux distributions use the Upstart system (or similar) for managing daemons. Typically, systems based on Debian 7 or previous use Upstart. This includes Ubuntu releases before 15.04. If you are unsure if your system is using Upstart, you may check with the following command:
```bash
$ ps -p 1 -o comm=
```
If the preceding command returns the string `init`, you are likely using Upstart.
Upstart will launch init scripts that are located in the directory `/etc/init.d/`. A sample init script for systems using Upstart is <a href="https://raw.githubusercontent.com/balloob/home-assistant/dev/script/hass-daemon">maintained by this project</a>.
To install this script, download it, tweak it to you liking, and install it by following the directions in the header. This script will setup Home Assistant to run when the system boots. To start/stop Home Assistant manually, issue the following commands:
```bash
$ sudo service hass-daemon start
$ sudo service hass-daemon stop
```
When running Home Assistant with this script, the configuration directory will be located at `/var/opt/homeassistant`. This directory will contain a verbose log rather than simply an error log.
When running daemons, it is good practice to have the daemon run under its own user name rather than the default user's name. Instructions for setting this up are outside the scope of this document.
</div> <!-- UPSTART -->
<div class='advanced-installs systemd' markdown='1'>
Newer linux distributions are trending towards using systemd for managing daemons. Typically, systems based on Fedora or Debian 8 or later use systemd. This includes Ubuntu releases including and after 15.04, CentOS, and Red Hat. If you are unsure if your system is using `systemd`, you may check with the following command:
```bash
$ ps -p 1 -o comm=
```
If the preceding command returns the string `systemd`, you are likely using `systemd`.
If you want Home Assistant to be launched automatically, an extra step is needed to setup `systemd`. You need a service file to control Home Assistant with `systemd`. If you are using a Raspberry Pi with Raspbian then replace the `[your user]` with `pi` otherwise use your user you want to run Home Assistant. `ExecStart` contains the path to `hass` and this may vary. Check with `whereis hass` for the location.
```bash
$ su -c 'cat <<EOF >> /lib/systemd/system/home-assistant@[your user].service
[Unit]
Description=Home Assistant
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/usr/bin/hass
[Install]
WantedBy=multi-user.target
EOF'
```
There is also another [sample service file](https://raw.githubusercontent.com/balloob/home-assistant/master/script/home-assistant%40.service) available. To use this one, just download it.
```bash
$ sudo wget https://raw.githubusercontent.com/balloob/home-assistant/master/script/home-assistant%40.service -O /lib/systemd/system/home-assistant@[your user].service
```
You need to reload `systemd` to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.
```bash
$ sudo systemctl --system daemon-reload
$ sudo systemctl enable home-assistant@[your user]
$ sudo systemctl start home-assistant@[your user]
```
If everything went well, `sudo systemctl start home-assistant` should give you a positive feedback.
```bash
$ sudo systemctl status home-assistant@[your user] -l
● home-assistant@fab.service - Home Assistant for [your user]
Loaded: loaded (/usr/lib/systemd/system/home-assistant@[your user].service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2016-03-26 12:26:06 CET; 13min ago
Main PID: 30422 (hass)
CGroup: /system.slice/system-home\x2dassistant.slice/home-assistant@[your user].service
├─30422 /usr/bin/python3 /usr/bin/hass
└─30426 /usr/bin/python3 /usr/bin/hass
[...]
```
To get Home Assistant's logging output, simple use `journalctl`.
```bash
$ sudo journalctl -f -u home-assistant@[your user]
```
</div> <!-- SYSTEMD -->
<div class='advanced-installs osx' markdown='1'>
Setting up Home Assistant to run as a background service is simple. OS X will start it on boot and make sure it's always running.
To get Home Assistant installed as a background service, run:
```bash
$ hass --install-osx
Home Assistant has been installed. Open it here: http://localhost:8123
```
Home Assistant will log to `~/Library/Logs/homeassistant.log`
To uninstall the service, run:
```bash
$ hass --uninstall-osx
Home Assistant has been uninstalled.
```
</div> <!-- OSX -->
<div class='advanced-installs synology' markdown='1'>
To get Home Assistant to automatically start when you boot your Synology NAS:
SSH onto your synology & login as admin or root
```bash
$ cd /volume1/homeassistant
```
Create "homeassistant.conf" file using the following code
```bash
# only start this service after the httpd user process has started
start on started httpd-user
# stop the service gracefully if the runlevel changes to 'reboot'
stop on runlevel [06]
# run the scripts as the 'http' user. Running as root (the default) is a bad ide
#setuid admin
# exec the process. Use fully formed path names so that there is no reliance on
# the 'www' file is a node.js script which starts the foobar application.
exec /bin/sh /volume1/homeassistant/hass-daemon start
```
Register the autostart
```bash
$ ln -s homeassistant-conf /etc/init/homeassistant-conf
```
Make the relevant files executable:
```bash
$ chmod -r 777 /etc/init/homeassistant-conf
```
That's it - reboot your NAS and Home Assistant should automatically start
</div> <!-- SYNOLOGY -->
</div>
### [&laquo; Back to Getting Started](/getting-started/)

View File

@ -3,7 +3,7 @@ layout: page
title: "Configuring Home Assistant"
description: "Configuring Home Assistant."
date: 2015-03-23 12:50
sidebar: false
sidebar: true
comments: false
sharing: true
footer: true

View File

@ -3,7 +3,7 @@ layout: page
title: "Adding devices to Home Assistant"
description: "Steps to help you get your devices in Home Assistant."
date: 2015-09-19 09:40
sidebar: false
sidebar: true
comments: false
sharing: true
footer: true

View File

@ -3,23 +3,12 @@ layout: page
title: "Getting Started"
description: "Step by step guide to get started with Home Assistant."
date: 2014-12-18 22:57
sidebar: false
sidebar: true
comments: false
sharing: true
footer: true
---
<div class='install-instructions-container' markdown='0'>
<input name='install-instructions' type='radio' id='normal-install' checked>
<input name='install-instructions' type='radio' id='raspberry-install'>
<input name='install-instructions' type='radio' id='docker-install'>
<input name='install-instructions' type='radio' id='synology-install'>
<label class='menu-selector normal' for='normal-install'>Local machine</label>
<label class='menu-selector raspberry' for='raspberry-install'>Raspberry Pi</label>
<label class='menu-selector docker' for='docker-install'>Docker</label>
<label class='menu-selector synology' for='synology-install'>Synology NAS</label>
<div class='install-instructions normal' markdown='1'>
Installing and running Home Assistant on your local machine is easy. Make sure you have [Python 3.4 or higher](https://www.python.org/downloads/) installed and execute the following code in a console:
<p class='note'>
@ -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.
</div> <!-- INSTALL-INSTRUCTIONS NORMAL -->
<div class='install-instructions docker' markdown='1'>
Installation with Docker is straightforward. Adjust the following command so that `/path/to/your/config/` points at the folder where you want to store your config and run it:
To update Home Assistant to the latest release when available, run:
```bash
$ docker run -d --name="home-assistant" -v /path/to/your/config:/config -v /etc/localtime:/etc/localtime:ro --net=host balloob/home-assistant
pip3 install --upgrade homeassistant
```
This will launch Home Assistant and serve the web interface from port 8123 on your Docker host.
<p class='note'>
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))
</p>
</div> <!-- INSTALL-INSTRUCTIONS DOCKER -->
<div class='install-instructions raspberry' markdown='1'>
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.
</div> <!-- INSTALL-INSTRUCTIONS RASPBERRY -->
<div class='install-instructions synology' markdown='1'>
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
```
</div> <!-- INSTALL-INSTRUCTIONS SYNOLOGY -->
</div>
After updating, restart Home Assistant 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.
If you run into any issues, please see [the troubleshooting page](/getting-started/troubleshooting/). It contains solutions to many of the common encountered issues.
In addition to this site, check out these sources for additional help:
@ -307,8 +54,6 @@ In addition to this site, check out these sources for additional help:
### {% linkable_title What's next %}
If you want to have Home Assistant start on boot, [autostart instructions can be found here](/getting-started/autostart/).
To see what Home Assistant can do, launch demo mode: `hass --demo-mode` or visit the [demo page](/demo).
### [Next step: Configuring Home Assistant &raquo;](/getting-started/configuration/)

View File

@ -0,0 +1,34 @@
---
layout: page
title: "Installation on Docker"
description: "Instructions to install Home Assistant on a Docker."
date: 2016-04-16 11:36
sidebar: true
comments: false
sharing: true
footer: true
---
Installation with Docker is straightforward. Adjust the following command so that `/path/to/your/config/` points at the folder where you want to store your config and run it:
```bash
$ docker run -d --name="home-assistant" -v /path/to/your/config:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant
```
This will launch Home Assistant and serve the web interface from port 8123 on your Docker host.
<p class='note'>
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))
</p>
### {% 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 &raquo;](/getting-started/configuration/)

View File

@ -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 &raquo;](/getting-started/configuration/)

View File

@ -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 &raquo;](/getting-started/configuration/)

View File

@ -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
```

View File

@ -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

View File

@ -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

View File

@ -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