From d8d60e8ffe1aab24234f232c16ce69f38b7f5c14 Mon Sep 17 00:00:00 2001 From: Nick Waring Date: Mon, 15 Feb 2016 08:06:20 +0000 Subject: [PATCH 1/4] Add configuration for Synology NAS --- source/getting-started/autostart.markdown | 35 +++++ source/getting-started/index.markdown | 176 ++++++++++++++++++++++ 2 files changed, 211 insertions(+) diff --git a/source/getting-started/autostart.markdown b/source/getting-started/autostart.markdown index 1907e2521f0..ef6f9093bfc 100644 --- a/source/getting-started/autostart.markdown +++ b/source/getting-started/autostart.markdown @@ -13,9 +13,11 @@ 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 and all current Raspian releases. If you are unsure if your system is using Upstart, you may check with the following command: @@ -130,6 +132,39 @@ Home Assistant has been uninstalled. ```
+ +
+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 "homeassistnat.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 homeassistant should automatically start +
### [« Back to Getting Started](/getting-started/) diff --git a/source/getting-started/index.markdown b/source/getting-started/index.markdown index ed52c900d0d..3ab7d5a21c7 100644 --- a/source/getting-started/index.markdown +++ b/source/getting-started/index.markdown @@ -74,6 +74,182 @@ Running these commands will: - Launch Home Assistant and serve the web interface on [http://localhost:8123](http://localhost:8123) + +
+ +The following configuration has been tested on a Synology 415+ running DSM 5.2-5644 Update 3 + +Running these commands will: + + - Install Home Assistant + - Ebable 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 /usr/local/python3/bin) +```bash +$ cd /usr/local/python3/bin +``` +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="/usr/local/python3/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 /usr/local/python3/bin python3 +$ ln -s /usr/local/python3/lib/python3.4/site-packages/homeassistant +``` +Set the owner and permissions on your config folder + +```bash +$ chown -r homeassistant:users /volume1/homeassistant +$ chmod -r 660 /volume1/homeassistant +``` +Make the daemon file executable: +```bash +$ chmod -r 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/pip3 install --upgrade homeassistant +``` + + +Execute the following code in a console: + +```bash +$ sudo pip3 install homeassistant +$ hass +``` +
### {% linkable_title Troubleshooting %} From f1cd8fc97bb86897d237cae327a8cf31c4514a6a Mon Sep 17 00:00:00 2001 From: Nick Waring Date: Mon, 15 Feb 2016 20:02:48 +0000 Subject: [PATCH 2/4] Corected typo --- source/getting-started/index.markdown | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/source/getting-started/index.markdown b/source/getting-started/index.markdown index 3ab7d5a21c7..5468b1d7785 100644 --- a/source/getting-started/index.markdown +++ b/source/getting-started/index.markdown @@ -82,7 +82,7 @@ The following configuration has been tested on a Synology 415+ running DSM 5.2-5 Running these commands will: - Install Home Assistant - - Ebable Home Assistant to be launched on [http://localhost:8123](http://localhost:8123) + - Enable Home Assistant to be launched on [http://localhost:8123](http://localhost:8123) Using the Synology webadmin: - Install python3 using the Synology package centre @@ -241,14 +241,6 @@ $ sh hass-daemon restart ```bash $ python3/pip3 install --upgrade homeassistant ``` - - -Execute the following code in a console: - -```bash -$ sudo pip3 install homeassistant -$ hass -``` From b96bf7d6c042c660c5f6d00717a757a3194f0e83 Mon Sep 17 00:00:00 2001 From: Nick Waring Date: Mon, 15 Feb 2016 20:04:34 +0000 Subject: [PATCH 3/4] corrected typo --- source/getting-started/autostart.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/getting-started/autostart.markdown b/source/getting-started/autostart.markdown index ef6f9093bfc..ac0c49e1366 100644 --- a/source/getting-started/autostart.markdown +++ b/source/getting-started/autostart.markdown @@ -140,7 +140,7 @@ SSH onto your synology & login as admin or root ```bash $ cd /volume1/homeassistant ``` -Create "homeassistnat.conf" file using the following code +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 From df8c1d8995d06877717eed004ed9a6b9f1f9707c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 17 Feb 2016 00:13:00 -0800 Subject: [PATCH 4/4] Fix broken stuff --- sass/custom/_paulus.scss | 16 +++++--- source/getting-started/autostart.markdown | 10 ++++- source/getting-started/index.markdown | 46 ++++++++++++++++++----- 3 files changed, 55 insertions(+), 17 deletions(-) diff --git a/sass/custom/_paulus.scss b/sass/custom/_paulus.scss index d564e748b84..1be90578a10 100644 --- a/sass/custom/_paulus.scss +++ b/sass/custom/_paulus.scss @@ -204,7 +204,7 @@ p.note { } .install-instructions-container { - #normal-install, #raspberry-install, #docker-install, .install-instructions { + #normal-install, #raspberry-install, #docker-install, #synology-install, .install-instructions { display: none; } @@ -223,14 +223,16 @@ p.note { #normal-install:checked ~ .menu-selector.normal, #raspberry-install:checked ~ .menu-selector.raspberry, - #docker-install:checked ~ .menu-selector.docker + #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 + #docker-install:checked ~ .install-instructions.docker, + #synology-install:checked ~ .install-instructions.synology { display: block; } @@ -242,7 +244,7 @@ p.note { .advanced-installs-container { - #upstart-install, #systemd-install, #osx-install, .advanced-installs { + #upstart-install, #systemd-install, #osx-install, #synology-install, .advanced-installs { display: none; } @@ -261,14 +263,16 @@ p.note { #upstart-install:checked ~ .menu-selector.upstart, #systemd-install:checked ~ .menu-selector.systemd, - #osx-install:checked ~ .menu-selector.osx + #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 + #osx-install:checked ~ .advanced-installs.osx, + #synology-install:checked ~ .advanced-installs.synology { display: block; } diff --git a/source/getting-started/autostart.markdown b/source/getting-started/autostart.markdown index ac0c49e1366..bbfd4cea6ec 100644 --- a/source/getting-started/autostart.markdown +++ b/source/getting-started/autostart.markdown @@ -137,10 +137,13 @@ Home Assistant has been uninstalled. 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 @@ -155,15 +158,20 @@ stop on runlevel [06] # 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 homeassistant should automatically start + +That's it - reboot your NAS and Home Assistant should automatically start diff --git a/source/getting-started/index.markdown b/source/getting-started/index.markdown index 5468b1d7785..a750a6e98ec 100644 --- a/source/getting-started/index.markdown +++ b/source/getting-started/index.markdown @@ -13,9 +13,11 @@ footer: true - - - + + + + +
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: @@ -29,8 +31,8 @@ Running these commands will: - Install Home Assistant - Launch Home Assistant and serve the web interface on [http://localhost:8123](http://localhost:8123) - - + + If would prefer to watch a video tutorial however, [tktino](https://github.com/tktino) has made some great ones. - [Windows 10](https://www.youtube.com/watch?v=X27eVvuqwnY) @@ -77,7 +79,7 @@ Running these commands will:
-The following configuration has been tested on a Synology 415+ running DSM 5.2-5644 Update 3 +The following configuration has been tested on Synology 415+ running DSM 5.2-5644 Update 3. Running these commands will: @@ -85,24 +87,33 @@ Running these commands will: - 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 /usr/local/python3/bin) + ```bash $ cd /usr/local/python3/bin ``` + 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 @@ -174,18 +185,18 @@ case $1 in exit 0 fi ;; - restart) + restart) if daemon_status; then echo Stopping ${DNAME} ... stop_daemon echo Starting ${DNAME} ... start_daemon - exit $? + exit $? else echo ${DNAME} is not running echo Starting ${DNAME} ... start_daemon - exit $? + exit $? fi ;; status) @@ -205,42 +216,58 @@ case $1 in exit 1 ;; esac + ``` + Create links to python folders to make things easier in the future: + ```bash $ ln -s /usr/local/python3/bin python3 $ ln -s /usr/local/python3/lib/python3.4/site-packages/homeassistant ``` + Set the owner and permissions on your config folder ```bash $ chown -r homeassistant:users /volume1/homeassistant $ chmod -r 660 /volume1/homeassistant ``` + Make the daemon file executable: + ```bash $ chmod -r 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/pip3 install --upgrade homeassistant ``` +
@@ -252,7 +279,6 @@ For additional help, in addition to this site, there are four sources: - [Forum](https://automic.us/forum/) - [Gitter Chatroom](https://gitter.im/balloob/home-assistant) for general Home Assistant discussions and questions. - - [Development Mailing List](https://groups.google.com/forum/#!forum/home-assistant-dev) for development related questions and discussing new features. - [GitHub Page](https://github.com/balloob/home-assistant/issues) for issue reporting. ### What's next