explaining geo location automation trigger (#7041)

This commit is contained in:
Malte Franken 2018-10-24 09:14:48 +11:00 committed by Fabian Affolter
parent 3c9e71cdc5
commit fc92cf476c
2 changed files with 64 additions and 0 deletions

View File

@ -14,3 +14,52 @@ ha_release: "0.78"
Geo Location aware entities are typically related to events in the real world in the vicinity of Home Assistant's location, like for example weather events, bush fires or earthquakes.
Entities can have associated geo location coordinates (latitude and longitude) so that they are displayed on the map. The distance from the entity's coordinates to Home Assistant's location can be used for filtering.
## {% linkable_title Geo Location trigger %}
The [Geo Location trigger](/docs/automation/trigger/#geo-location-trigger) can be used in automations triggered by Geo Location entities appearing in or disappearing from zones. The following value must be used as `source` of the trigger depending on which platform is managing the entities:
| Platform | Source |
|----------------------------------|-------------------------------|
| GeoJSON Events | `geo_json_events` |
| NSW Rural Fire Service Incidents | `nsw_rural_fire_service_feed` |
Conditions can be used to further filter entities, for example by inspecting their state attributes.
## {% linkable_title Geo Location notification example %}
The following example automation creates a notification on the screen when a fire classified as 'Bush Fire' is reported within a predefined bush fire alert zone:
{% raw %}
```yaml
geo_location:
- platform: nsw_rural_fire_service_feed
categories:
- 'Emergency Warning'
- 'Watch and Act'
- 'Advice'
zone:
- name: Bush Fire Alert Zone
latitude: -36.666667
longitude: 149.833333
radius: 15000
passive: true
automation:
- alias: 'Bush Fire Alert'
trigger:
platform: geo_location
source: nsw_rural_fire_service_feed
zone: zone.bush_fire_alert_zone
event: enter
condition:
condition: template
value_template: "{{ trigger.to_state.attributes.type == 'Bush Fire' }}"
action:
- service: persistent_notification.create
data_template:
message: "{{ trigger.to_state.name }} - {{ trigger.to_state.attributes.status }}"
title: "Bush Fire Alert"
```
{% endraw %}

View File

@ -218,6 +218,21 @@ automation:
event: enter # or "leave"
```
### {% linkable_title Geo Location trigger %}
Geo Location triggers can trigger when an entity is appearing in or disappearing from a zone. Entities that are created by a [Geo Location](/components/geo_location/) platform support reporting GPS coordinates.
Because entities are generated and removed by these platforms automatically, the entity id normally cannot be predicted. Instead, this trigger requires the definition of a `source` which is directly linked to one of the Geo Location platforms.
```yaml
automation:
trigger:
platform: geo_location
source: nsw_rural_fire_service_feed
zone: zone.bushfire_alert_zone
# Event is either enter or leave
event: enter # or "leave"
```
### {% linkable_title Multiple triggers %}
When your want your automation rule to have multiple triggers, just prefix the first line of each trigger with a dash (-) and indent the next lines accordingly. Whenever one of the triggers fires, your rule is executed.