294 lines
No EOL
11 KiB
HTML
294 lines
No EOL
11 KiB
HTML
<!doctype html>
|
||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<title>Launch Home Assistant on boot - Home Assistant</title>
|
||
<meta name="author" content="Paulus Schoutsen">
|
||
<meta name="description" content="Instructions how to setup Home Assistant to launch on boot on various platforms.">
|
||
|
||
<meta name="viewport" content="width=device-width">
|
||
<link rel="canonical" href="https://home-assistant.io/getting-started/autostart/">
|
||
|
||
<meta property="fb:app_id" content="338291289691179">
|
||
<meta property="og:title" content="Launch Home Assistant on boot">
|
||
<meta property="og:site_name" content="Home Assistant">
|
||
<meta property="og:url" content="https://home-assistant.io/getting-started/autostart/">
|
||
<meta property="og:type" content="website">
|
||
<meta property="og:description" content="Instructions how to setup Home Assistant to launch on boot on various platforms.">
|
||
<meta property="og:image" content="https://home-assistant.io/images/home-assistant-logo-2164x2164.png">
|
||
|
||
<meta name="twitter:card" content="summary">
|
||
<meta name="twitter:site" content="@home_assistant">
|
||
|
||
<meta name="twitter:title" content="Launch Home Assistant on boot">
|
||
<meta name="twitter:description" content="Instructions how to setup Home Assistant to launch on boot on various platforms.">
|
||
<meta name="twitter:image" content="https://home-assistant.io/images/home-assistant-logo-2164x2164.png">
|
||
|
||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||
</head>
|
||
|
||
<body >
|
||
|
||
<header>
|
||
<div class="grid-wrapper">
|
||
<div class="grid">
|
||
|
||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||
<a href="/" class="site-title">
|
||
<img width='40' src='/demo/favicon-192x192.png'>
|
||
<span>Home Assistant</span>
|
||
</a>
|
||
</div>
|
||
|
||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||
<nav>
|
||
<input type="checkbox" id="toggle">
|
||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||
<ul class="menu pull-right">
|
||
<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='/getting-started/templating/'>Templating</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href='/components/'>Components</a></li>
|
||
<li><a href='/cookbook'>Examples</a></li>
|
||
<li>
|
||
<a>Developers <i class="icon icon-caret-down"></i></a>
|
||
<ul>
|
||
<li><a href="/developers/">Setup Development</a></li>
|
||
<li><a href="/developers/architecture/">Architecture</a></li>
|
||
<li><a href="/developers/frontend/">Frontend development</a></li>
|
||
<li><a href="/developers/creating_components/">
|
||
Creating components
|
||
</a></li>
|
||
<li><a href="/developers/add_new_platform/">
|
||
Adding platform support
|
||
</a></li>
|
||
<li><a href="/developers/api/">API</a></li>
|
||
<li><a href="/developers/credits/">Credits</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a href="/blog/">Blog</a></li>
|
||
<li><a href="/help/">Need help?</a></li>
|
||
</ul>
|
||
</nav>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
|
||
|
||
<div class="grid-wrapper">
|
||
<div class="grid grid-center">
|
||
|
||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||
|
||
|
||
<article class="page">
|
||
|
||
|
||
<div class='edit-github'><a href='https://github.com/balloob/home-assistant.io/tree/master/source/getting-started/autostart.markdown'>Edit this page on GitHub</a></div>
|
||
|
||
|
||
|
||
<header>
|
||
<h1 class="title indent">
|
||
Launch Home Assistant on Boot
|
||
</h1>
|
||
</header>
|
||
<hr class="divider">
|
||
|
||
|
||
<div class="advanced-installs-container">
|
||
<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" />
|
||
<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>
|
||
|
||
<div class="advanced-installs upstart">
|
||
<p>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:</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ ps -p 1 -o comm=
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
<p>If the preceding command returns the string <code>init</code>, you are likely using Upstart.</p>
|
||
|
||
<p>Upstart will launch init scripts that are located in the directory <code>/etc/init.d/</code>. 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>.</p>
|
||
|
||
<p>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:</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ sudo service hass-daemon start
|
||
$ sudo service hass-daemon stop
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
<p>When running Home Assistant with this script, the configuration directory will be located at <code>/var/opt/homeassistant</code>. This directory will contain a verbose log rather than simply an error log.</p>
|
||
|
||
<p>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.</p>
|
||
</div> <!-- UPSTART -->
|
||
|
||
<div class="advanced-installs systemd">
|
||
<p>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:</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ ps -p 1 -o comm=
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
<p>If the preceding command returns the string <code>systemd</code>, you are likely using systemd.</p>
|
||
|
||
<p>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.</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ su -c 'cat <<EOF >> /lib/systemd/system/home-assistant.service
|
||
[Unit]
|
||
Description=Home Assistant
|
||
After=network.target
|
||
|
||
[Service]
|
||
Type=simple
|
||
ExecStart=/usr/local/bin/hass
|
||
# Next line is to run as a specific user
|
||
# for Raspberry Pi users, keep it at 'pi'
|
||
User=pi
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
EOF'
|
||
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
<p>You need to reload systemd to make the daemon aware of the new configuration. Enable and launch Home Assistant after that.</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ sudo systemctl --system daemon-reload
|
||
$ sudo systemctl enable home-assistant
|
||
$ sudo systemctl start home-assistant
|
||
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
<p>If everything went well, <code>sudo systemctl start home-assistant</code> should give you a positive feedback.</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ sudo systemctl status home-assistant -l
|
||
● home-assistant.service - Home Assistant
|
||
Loaded: loaded (/usr/lib/systemd/system/home-assistant.service; disabled; vendor preset: disabled)
|
||
Active: active (running) since Thu 2015-06-25 23:38:37 CEST; 3min 13s ago
|
||
Main PID: 8557 (python3.4)
|
||
CGroup: /system.slice/home-assistant.service
|
||
└─8557 /usr/bin/python3.4 -m homeassistant
|
||
[...]
|
||
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
<p>To get Home Assistant’s logging output, simple use <code>journalctl</code>.</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ sudo journalctl -f -u home-assistant
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
</div> <!-- SYSTEMD -->
|
||
|
||
<div class="advanced-installs osx">
|
||
<p>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.</p>
|
||
|
||
<p>To get Home Assistant installed as a background service, run:</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ hass --install-osx
|
||
|
||
Home Assistant has been installed. Open it here: http://localhost:8123
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
<p>Home Assistant will log to <code>~/Library/Logs/homeassistant.log</code></p>
|
||
|
||
<p>To uninstall the service, run:</p>
|
||
|
||
<div class="highlighter-coderay"><div class="CodeRay">
|
||
<div class="code"><pre>$ hass --uninstall-osx
|
||
|
||
Home Assistant has been uninstalled.
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
|
||
</div> <!-- OSX -->
|
||
</div>
|
||
|
||
<h3><a href="/getting-started/">« Back to Getting Started</a></h3>
|
||
|
||
|
||
</article>
|
||
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<footer>
|
||
<div class="grid-wrapper">
|
||
<div class="grid">
|
||
<div class="grid__item">
|
||
<div class="copyright">
|
||
<a rel="me" href='https://twitter.com/home_assistant'><i class="icon-twitter"></i></a>
|
||
<a rel="me" href='https://github.com/balloob/home-assistant'><i class="icon-github"></i></a>
|
||
|
||
<div class="credit">
|
||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||
Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
<!--[if lt IE 7]>
|
||
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
|
||
<![endif]-->
|
||
|
||
<script>
|
||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||
</script>
|
||
|
||
</body>
|
||
</html> |