Added documentation for resource_template for REST sensor (#10918)

* Added documentation for resource_template

* Fix jinja issues

* minor changes

* ✏️ Tweak


Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Fredrik Erlandsson 2019-10-23 20:19:11 +02:00 committed by Franck Nijhof
parent c642bae708
commit 384b8b294e

View File

@ -30,12 +30,28 @@ sensor:
payload: '{ "device" : "heater" }'
```
or a template based request:
{% raw %}
```yaml
# Example configuration.yaml entry
sensor:
- platform: rest
resource_template: http://IP_ADDRESS/{{ now().strftime('%Y-%m-%d') }}
```
{% endraw %}
{% configuration %}
resource:
description: The resource or endpoint that contains the value.
required: true
type: string
default: string
resource_template:
description: The resource or endpoint that contains the value with template support.
required: true
type: template
method:
description: The method of the request. Either `POST` or `GET`.
required: false
@ -103,6 +119,12 @@ force_update:
Make sure that the URL exactly matches your endpoint or resource.
</div>
<div class='note'>
Use either `resource` or `resource_template`.
</div>
`curl` can help you identify the variable you want to display in your Home Assistant frontend. The example below shows the JSON response of a device that is running with [aREST](https://arest.io/).
```bash