mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 09:17:06 +00:00
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:
parent
c642bae708
commit
384b8b294e
@ -30,12 +30,28 @@ sensor:
|
|||||||
payload: '{ "device" : "heater" }'
|
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 %}
|
{% configuration %}
|
||||||
resource:
|
resource:
|
||||||
description: The resource or endpoint that contains the value.
|
description: The resource or endpoint that contains the value.
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
default: string
|
resource_template:
|
||||||
|
description: The resource or endpoint that contains the value with template support.
|
||||||
|
required: true
|
||||||
|
type: template
|
||||||
method:
|
method:
|
||||||
description: The method of the request. Either `POST` or `GET`.
|
description: The method of the request. Either `POST` or `GET`.
|
||||||
required: false
|
required: false
|
||||||
@ -103,6 +119,12 @@ force_update:
|
|||||||
Make sure that the URL exactly matches your endpoint or resource.
|
Make sure that the URL exactly matches your endpoint or resource.
|
||||||
</div>
|
</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/).
|
`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
|
```bash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user