Merge branch 'current' into next

This commit is contained in:
Paulus Schoutsen 2017-04-08 16:59:36 -07:00
commit cc81f09b65
36 changed files with 736 additions and 85 deletions

View file

@ -15,6 +15,8 @@ Triggers are what starts the processing of an automation rule. It is possible to
### {% linkable_title Event trigger %}
Triggers when an event is being processed. Events are the raw building blocks of Home Assistant. You can match events on just the event name or also require specific event data to be present.
Events can be fired by components or via the API. There is no limitation to the types. A list of built-in events can be found [here](/docs/configuration/events/).
```yaml
automation:
trigger:
@ -24,7 +26,22 @@ automation:
event_data:
mood: happy
```
For example, to carry out actions when Home Assistant starts, you can use `event_type: homeassistant_start`. See other 'events' supported by Home Assistant [here](https://home-assistant.io/topics/events/).
<p class='note warning'>
Starting 0.42, it is no longer possible to listen for event `homeassistant_start`. Use the 'homeassistant' platform below instead.
</p>
### {% linkable_title Home Assistant trigger %}
Use this platform to trigger when Home Assistant starts up and shuts down.
```yaml
automation:
trigger:
platform: homeassistant
# Event can also be 'shutdown'
event: start
```
### {% linkable_title MQTT trigger %}
Triggers when a specific message is received on given topic. Optionally can match on the payload being sent over the topic.
@ -62,7 +79,7 @@ automation:
trigger:
platform: state
entity_id: device_tracker.paulus, device_tracker.anne_therese
# Optional
# Optional
from: 'not_home'
to: 'home'
@ -105,6 +122,8 @@ automation:
value_template: "{% raw %}{% if is_state('device_tracker.paulus', 'home') %}true{% endif %}{% endraw %}"
```
[template]: /docs/configuration/templating/
### {% linkable_title Time trigger %}
Time can be triggered in many ways. The most common is to specify `after` and trigger at a specific point in time each day. Alternatively, you can also match if the hour, minute or second of the current time has a specific value. You can prefix the value with a `/` to match whenever the value is divisible by that number. You cannot use `after` together with hour, minute or second.

View file

@ -18,12 +18,12 @@ $ 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`. A service file is needed to control Home Assistant with `systemd`. The template below should be created using a text editor. Note, root permissions via 'sudo' will likely be needed. The following should be noted to modify the template:
If you want Home Assistant to be launched automatically, an extra step is needed to setup `systemd`. A service file is needed to control Home Assistant with `systemd`. The template below should be created using a text editor. Note, root permissions via `sudo` will likely be needed. The following should be noted to modify the template:
+ `ExecStart` contains the path to `hass` and this may vary. Check with `whereis hass` for the location.
+ If running Home Assistant in a python virtual environment or a docker, please skip to section below.
+ For most systems, the file is `/etc/systemd/system/home-assistant@[your user].service` with [your user] replaced by the user account that Home Assistant will run as - normally `homeassistant`. For Ubuntu 16.04, the file is `/lib/systemd/system/home-assistant.service` and requires running this command `sudo ln -s /lib/systemd/system/home-assistant.service /etc/systemd/system/home-assistant.service` after file is created.
+ If unfamiliar with command line text editors, `sudo nano -w [filename]` can be used with `[filename]` replaced with the full path to the file. Ex. `sudo nano -w /etc/systemd/system/home-assistant@homeassistant.service`. After text entered, press CTRL-X then press Y to save and exit.
- `ExecStart` contains the path to `hass` and this may vary. Check with `whereis hass` for the location.
- If running Home Assistant in a Python virtual environment or a Docker container, please skip to section below.
- For most systems, the file is `/etc/systemd/system/home-assistant@[your user].service` with [your user] replaced by the user account that Home Assistant will run as - normally `homeassistant`. For Ubuntu 16.04, the file is `/lib/systemd/system/home-assistant.service` and requires running this command `sudo ln -s /lib/systemd/system/home-assistant.service /etc/systemd/system/home-assistant.service` after file is created.
- If unfamiliar with command-line text editors, `sudo nano -w [filename]` can be used with `[filename]` replaced with the full path to the file. Ex. `sudo nano -w /etc/systemd/system/home-assistant@homeassistant.service`. After text entered, press CTRL-X then press Y to save and exit.
```
[Unit]
@ -39,7 +39,9 @@ ExecStart=/usr/bin/hass
WantedBy=multi-user.target
```
If you've setup Home Assistant in `virtualenv` following our [python installation guide](https://home-assistant.io/getting-started/installation-virtualenv/) or [manual installation guide for raspberry pi](https://home-assistant.io/getting-started/installation-raspberry-pi/), the following template should work for you. If Home Assistant install is not located at `/srv/homeassistant`, please modify the `ExecStart=` line appropriately.
### {% linkable_title Python virtual environment %}
If you've setup Home Assistant in `virtualenv` following our [Python installation guide](https://home-assistant.io/getting-started/installation-virtualenv/) or [manual installation guide for Raspberry Pi](https://home-assistant.io/getting-started/installation-raspberry-pi/), the following template should work for you. If Home Assistant install is not located at `/srv/homeassistant`, please modify the `ExecStart=` line appropriately.
```
[Unit]
@ -55,7 +57,9 @@ ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
WantedBy=multi-user.target
```
If you want to use docker, the following template should work for you.
### {% linkable_title Docker %}
If you want to use Docker, the following template should work for you.
```
[Unit]

View file

@ -23,14 +23,14 @@ Templating is a powerful feature in Home Assistant that allows the user control
- Formatting outgoing messages in, for example, the [notify] and [alexa] components.
- Process incoming data from sources that provide raw data, like [MQTT], [REST sensor], or the [command line sensor].
- [Advanced Automation templating]auto-template]
- [Automation Templating].
[notify]: /components/notify/
[alexa]: /components/alexa/
[MQTT]: /components/mqtt/
[REST sensor]: /components/sensor.rest/
[command line sensor]: /components/sensor.command_line/
[auto-template]: /getting-started/automation-templating/
[Automation Templating]: /docs/automation/templating/
## {% linkable_title Building templates %}
@ -74,7 +74,7 @@ Home Assistant adds extensions to allow templates to access all of the current s
- `is_state_attr('device_tracker.paulus', 'battery', 40)` will test if the given entity is specified state.
- `now()` will be rendered as current time in your time zone.
- `utcnow()` will be rendered as UTC time.
- `as_timestamp` will convert datetime object or string to UNIX timestamp
- `as_timestamp()` will convert datetime object or string to UNIX timestamp
- `distance()` will measure the distance in meters between home, entity, coordinates.
- `closest()` will find the closest entity.
- `relative_time(timestamp)` will format the date time as relative time vs now (ie 7 seconds)

View file

@ -55,7 +55,7 @@ If you don't want HTTPS, you can change `<VirtualHost *:443>` to `<VirtualHost *
<p class='note'>
In case you are getting occasional HTTP 504 error messages ("Gateway Timeout") when accessing the Web UI through your proxy, try adding disablereuse=on to both ProxyPass directives:
</p>
```text
<VirtualHost *:443>
[...]
@ -65,7 +65,6 @@ In case you are getting occasional HTTP 504 error messages ("Gateway Timeout") w
[...]
</VirtualHost>
```
</p>
#### {% linkable_title Multiple Instance %}

View file

@ -93,7 +93,7 @@ This will in order do the following:
- Change directory to the Home Assistant configuration directory.
- Open the log file in the nano editor.
Optionaly, you can also view the log with `journalctl`.
Optionally, you can also view the log with `journalctl`.
Log in as the `pi` account and execute the following commands:
```bash

View file

@ -14,7 +14,7 @@ To allow you to customize your installation further, we have included a set of H
- Install Samba. Allows anyone on your network to edit your configuration from any computer. This share is unsecured and it's usage is not recommended if you share your network with others.
- Install Libcec. Adds local [HDMI CEC support][cec].
- Install Mossquitto MQTT server. Installs the latest Mosquitto package and client tools from the Mosquitto projects offical repository. Now includes websocket support.
- Install Mosquitto MQTT server. Installs the latest Mosquitto package and client tools from the Mosquitto projects offical repository. Now includes websocket support.
- Install Open Z-Wave. Installs Open Z-Wave and prepares for using a USB or GPIO ZWave controller.
All of these scripts are available in the directory `/home/pi/hassbian-scripts/`. For more information about these scripts have a look at the [hassbian-scripts repository][hassbian-repo].

View file

@ -24,7 +24,7 @@ and Home Assistant itself.
$ pip3 install homeassistant
```
Home Assistant is part of the [AUR](https://aur.archlinux.org/packages/home-assistant/). This meand that it can be installed directly with `pacman`:
Home Assistant is part of the [AUR](https://aur.archlinux.org/packages/home-assistant/). This means that it can be installed directly with `pacman`:
```bash
$ sudo pacman -S home-assistant

View file

@ -23,3 +23,24 @@ and Home Assistant itself.
$ pip3 install homeassistant
```
To isolate the Home Assistant installation a [venv](https://docs.python.org/3/library/venv.html) is handy. First create a new directory to store the installation.
```bash
$ sudo mkdir -p /opt/homeassistant
$ cd /opt/homeassistant
```
Now switch to the new directory, setup the venv, and activate it.
```bash
$ cd /opt/homeassistant
$ pyvenv-3.5 .
$ source bin/activate
```
Install Home Assistant itself.
```bash
$ pip3 install homeassistant
```
Check the [autostart](/docs/autostart/systemd/) section in the documentation for further details.