Merge conflict

This commit is contained in:
Paulus Schoutsen 2019-07-31 16:26:56 -07:00
parent 9c0308b489
commit a425b65733

View File

@ -24,7 +24,7 @@ automation:
<div class='note warning'> <div class='note warning'>
Starting 0.42, it is no longer possible to listen for event `homeassistant_start`. Use the 'homeassistant' platform below instead. Starting 0.42, it is no longer possible to listen for event `homeassistant_start`. Use the 'homeassistant' platform below instead.
</div> </div>
@ -50,8 +50,8 @@ automation:
platform: mqtt platform: mqtt
topic: living_room/switch/ac topic: living_room/switch/ac
# Optional # Optional
payload: 'on' payload: "on"
encoding: 'utf-8' encoding: "utf-8"
``` ```
### Numeric state trigger ### Numeric state trigger
@ -59,13 +59,14 @@ automation:
Triggers when numeric value of an entity's state crosses a given threshold. On state change of a specified entity, attempts to parse the state as a number and triggers once if value is changing from above to below or from below to above the given threshold. Triggers when numeric value of an entity's state crosses a given threshold. On state change of a specified entity, attempts to parse the state as a number and triggers once if value is changing from above to below or from below to above the given threshold.
{% raw %} {% raw %}
```yaml ```yaml
automation: automation:
trigger: trigger:
platform: numeric_state platform: numeric_state
entity_id: sensor.temperature entity_id: sensor.temperature
# Optional # Optional
value_template: '{{ state.attributes.battery }}' value_template: "{{ state.attributes.battery }}"
# At least one of the following required # At least one of the following required
above: 17 above: 17
below: 25 below: 25
@ -76,6 +77,7 @@ automation:
minutes: 10 minutes: 10
seconds: 5 seconds: 5
``` ```
{% endraw %} {% endraw %}
<div class='note'> <div class='note'>
@ -86,25 +88,28 @@ In the example above, a numeric_state that goes to 17.1-24.9 (from 17 or below,
The `for:` can also be specified as `HH:MM:SS` like this: The `for:` can also be specified as `HH:MM:SS` like this:
{% raw %} {% raw %}
```yaml ```yaml
automation: automation:
trigger: trigger:
platform: numeric_state platform: numeric_state
entity_id: sensor.temperature entity_id: sensor.temperature
# Optional # Optional
value_template: '{{ state.attributes.battery }}' value_template: "{{ state.attributes.battery }}"
# At least one of the following required # At least one of the following required
above: 17 above: 17
below: 25 below: 25
# If given, will trigger when condition has been for X time. # If given, will trigger when condition has been for X time.
for: '01:10:05' for: "01:10:05"
``` ```
{% endraw %} {% endraw %}
You can also use templates in the `for` option. You can also use templates in the `for` option.
{% raw %} {% raw %}
```yaml ```yaml
automation: automation:
trigger: trigger:
@ -122,6 +127,7 @@ automation:
message: > message: >
{{ trigger.to_state.name }} too high for {{ trigger.for }}! {{ trigger.to_state.name }} too high for {{ trigger.for }}!
``` ```
{% endraw %} {% endraw %}
The `for` template(s) will be evaluated when an entity changes as specified. The `for` template(s) will be evaluated when an entity changes as specified.
@ -136,23 +142,24 @@ automation:
platform: state platform: state
entity_id: device_tracker.paulus, device_tracker.anne_therese entity_id: device_tracker.paulus, device_tracker.anne_therese
# Optional # Optional
from: 'not_home' from: "not_home"
# Optional # Optional
to: 'home' to: "home"
# If given, will trigger when state has been the to state for X time. # If given, will trigger when state has been the to state for X time.
for: '01:10:05' for: "01:10:05"
``` ```
You can also use templates in the `for` option. You can also use templates in the `for` option.
{% raw %} {% raw %}
```yaml ```yaml
automation: automation:
trigger: trigger:
platform: state platform: state
entity_id: device_tracker.paulus, device_tracker.anne_therese entity_id: device_tracker.paulus, device_tracker.anne_therese
to: 'home' to: "home"
for: for:
minutes: "{{ states('input_number.lock_min')|int }}" minutes: "{{ states('input_number.lock_min')|int }}"
seconds: "{{ states('input_number.lock_sec')|int }}" seconds: "{{ states('input_number.lock_sec')|int }}"
@ -160,14 +167,14 @@ automation:
service: lock.lock service: lock.lock
entity_id: lock.my_place entity_id: lock.my_place
``` ```
{% endraw %} {% endraw %}
The `for` template(s) will be evaluated when an entity changes as specified. The `for` template(s) will be evaluated when an entity changes as specified.
<div class='note warning'> <div class='note warning'>
Use quotes around your values for `from` and `to` to avoid the YAML parser interpreting values as booleans. Use quotes around your values for `from` and `to` to avoid the YAML parser interpreting values as booleans.
</div> </div>
@ -194,7 +201,7 @@ automation:
# Possible values: sunset, sunrise # Possible values: sunset, sunrise
event: sunset event: sunset
# Optional time offset. This example will trigger 45 minutes before sunset. # Optional time offset. This example will trigger 45 minutes before sunset.
offset: '-00:45:00' offset: "-00:45:00"
``` ```
#### Sun elevation trigger #### Sun elevation trigger
@ -202,6 +209,7 @@ automation:
Sometimes you may want more granular control over an automation than simply sunset or sunrise and specify an exact elevation of the sun. This can be used to layer automations to occur as the sun lowers on the horizon or even after it is below the horizon. This is also useful when the "sunset" event is not dark enough outside and you would like the automation to run later at a precise solar angle instead of the time offset such as turning on exterior lighting. For most things intended to trigger during dusk or dawn, a number between 0° and -6° is suitable; -4° is used in this example: Sometimes you may want more granular control over an automation than simply sunset or sunrise and specify an exact elevation of the sun. This can be used to layer automations to occur as the sun lowers on the horizon or even after it is below the horizon. This is also useful when the "sunset" event is not dark enough outside and you would like the automation to run later at a precise solar angle instead of the time offset such as turning on exterior lighting. For most things intended to trigger during dusk or dawn, a number between 0° and -6° is suitable; -4° is used in this example:
{% raw %} {% raw %}
```yaml ```yaml
automation: automation:
alias: "Exterior Lighting on when dark outside" alias: "Exterior Lighting on when dark outside"
@ -215,6 +223,7 @@ automation:
service: switch.turn_on service: switch.turn_on
entity_id: switch.exterior_lighting entity_id: switch.exterior_lighting
``` ```
{% endraw %} {% endraw %}
If you want to get more precise, start with the US Naval Observatory [tool](http://aa.usno.navy.mil/data/docs/AltAz.php) which will help you estimate what the solar elevation will be at any specific time. Then from this, you can select from the defined twilight numbers. If you want to get more precise, start with the US Naval Observatory [tool](http://aa.usno.navy.mil/data/docs/AltAz.php) which will help you estimate what the solar elevation will be at any specific time. Then from this, you can select from the defined twilight numbers.
@ -224,6 +233,7 @@ Although the actual amount of light depends on weather, topography and land cove
- Civil twilight: 0° > Solar angle > -6° - Civil twilight: 0° > Solar angle > -6°
This is what is meant by twilight for the average person: Under clear weather conditions, civil twilight approximates the limit at which solar illumination suffices for the human eye to clearly distinguish terrestrial objects. Enough illumination renders artificial sources unnecessary for most outdoor activities. This is what is meant by twilight for the average person: Under clear weather conditions, civil twilight approximates the limit at which solar illumination suffices for the human eye to clearly distinguish terrestrial objects. Enough illumination renders artificial sources unnecessary for most outdoor activities.
- Nautical twilight: 6° > Solar angle > -12° - Nautical twilight: 6° > Solar angle > -12°
- Astronomical twilight: 12° > Solar angle > -18° - Astronomical twilight: 12° > Solar angle > -18°
@ -235,6 +245,7 @@ Template triggers work by evaluating a [template](/docs/configuration/templating
With template triggers you can also evaluate attribute changes by using is_state_attr (`{% raw %}{{ is_state_attr('climate.living_room', 'away_mode', 'off') }}{% endraw %}`) With template triggers you can also evaluate attribute changes by using is_state_attr (`{% raw %}{{ is_state_attr('climate.living_room', 'away_mode', 'off') }}{% endraw %}`)
{% raw %} {% raw %}
```yaml ```yaml
automation: automation:
trigger: trigger:
@ -242,13 +253,15 @@ automation:
value_template: "{% if is_state('device_tracker.paulus', 'home') %}true{% endif %}" value_template: "{% if is_state('device_tracker.paulus', 'home') %}true{% endif %}"
# If given, will trigger when template remains true for X time. # If given, will trigger when template remains true for X time.
for: '00:01:00' for: "00:01:00"
``` ```
{% endraw %} {% endraw %}
You can also use templates in the `for` option. You can also use templates in the `for` option.
{% raw %} {% raw %}
```yaml ```yaml
automation: automation:
trigger: trigger:
@ -257,17 +270,13 @@ automation:
for: for:
minutes: "{{ states('input_number.minutes')|int(0) }}" minutes: "{{ states('input_number.minutes')|int(0) }}"
``` ```
{% endraw %} {% endraw %}
The `for` template(s) will be evaluated when the `value_template` becomes `true`. The `for` template(s) will be evaluated when the `value_template` becomes `true`.
<div class='note warning'> <div class='note warning'>
<<<<<<< HEAD
=======
>>>>>>> current
Rendering templates with time (`now()`) is dangerous as trigger templates only update based on entity state changes. Rendering templates with time (`now()`) is dangerous as trigger templates only update based on entity state changes.
</div> </div>
### Time trigger ### Time trigger
@ -279,7 +288,7 @@ automation:
trigger: trigger:
platform: time platform: time
# Military time format. This trigger will fire at 3:32 PM # Military time format. This trigger will fire at 3:32 PM
at: '15:32:00' at: "15:32:00"
``` ```
### Time pattern trigger ### Time pattern trigger
@ -297,19 +306,19 @@ automation 2:
trigger: trigger:
platform: time_pattern platform: time_pattern
# Trigger once per minute during the hour of 3 # Trigger once per minute during the hour of 3
hours: '3' hours: "3"
minutes: '*' minutes: "*"
automation 3: automation 3:
trigger: trigger:
platform: time_pattern platform: time_pattern
# You can also match on interval. This will match every 5 minutes # You can also match on interval. This will match every 5 minutes
minutes: '/5' minutes: "/5"
``` ```
<div class='note warning'> <div class='note warning'>
Do not prefix numbers with a zero - using `'00'` instead of '0' for example will result in errors. Do not prefix numbers with a zero - using `'00'` instead of '0' for example will result in errors.
</div> </div>
@ -326,7 +335,6 @@ automation:
You could test triggering the above automation by sending a POST HTTP request to `http://your-home-assistant:8123/api/webhook/some_hook_id`. An example with no data sent to a SSL/TLS secured installation and using the command-line curl program is `curl -d "" https://your-home-assistant:8123/api/webhook/some_hook_id`. You could test triggering the above automation by sending a POST HTTP request to `http://your-home-assistant:8123/api/webhook/some_hook_id`. An example with no data sent to a SSL/TLS secured installation and using the command-line curl program is `curl -d "" https://your-home-assistant:8123/api/webhook/some_hook_id`.
### Zone trigger ### Zone trigger
Zone triggers can trigger when an entity is entering or leaving the zone. For zone automation to work, you need to have setup a device tracker platform that supports reporting GPS coordinates. This includes [GPS Logger](/components/device_tracker.gpslogger/), the [OwnTracks platform](/components/device_tracker.owntracks/) and the [iCloud platform](/components/device_tracker.icloud/). Zone triggers can trigger when an entity is entering or leaving the zone. For zone automation to work, you need to have setup a device tracker platform that supports reporting GPS coordinates. This includes [GPS Logger](/components/device_tracker.gpslogger/), the [OwnTracks platform](/components/device_tracker.owntracks/) and the [iCloud platform](/components/device_tracker.icloud/).