Add webhook trigger docs (#6610)

This commit is contained in:
Paulus Schoutsen 2018-10-08 20:16:29 +02:00 committed by Paulus Schoutsen
parent 3664d24f90
commit 6d1c5eda38
2 changed files with 22 additions and 2 deletions

View File

@ -126,6 +126,15 @@ The following tables show the available trigger data per platform.
| `trigger.platform` | Hardcoded: `time`
| `trigger.now` | DateTime object that triggered the time trigger.
### {% linkable_title webhook %}
| Template variable | Data |
| ---- | ---- |
| `trigger.platform` | Hardcoded: `webhook`
| `trigger.webhook_id` | The webhook ID that was triggered.
| `trigger.json` | The JSON data of the request (if it had a JSON content type).
| `trigger.data` | The form data of the request (if it had a form data content type).
### {% linkable_title zone %}
| Template variable | Data |

View File

@ -193,6 +193,17 @@ automation 3:
Remember that if you are using matching to include both `minutes` and `seconds`. Without `seconds`, your automation will trigger 60 times during the matching minute.
</p>
### {% linkable_title Webhook trigger %}
Webhook triggers are triggered by web requests made to the webhook endpoint: `/api/webhook/<webhook_id>`. This endpoint does not require authentication besides knowing the webhook id. You can either send encoded form or JSON data, available in the template as either `trigger.json` or `trigger.data`.
```yaml
automation:
trigger:
platform: webhook
webhook_id:
```
### {% linkable_title 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/).