Fix default values in REST switch (#4922)

* Fix default values in REST switch

According to https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/switch/rest.py
* Resource does not have any default value.
* Method is set in lowercase "post"
* Default name is not "REST Binary Switch" but "REST Switch"
* Default body_on is "ON" not true
* Default body_off is "OFF" not false

* ✏️ Tweaks
This commit is contained in:
Filip Bednárik 2018-03-23 21:44:39 +01:00 committed by Franck Nijhof
parent 9165380172
commit 6e1fe76243

View File

@ -13,7 +13,6 @@ ha_release: 0.7.6
ha_iot_class: "Local Polling"
---
The `rest` switch platform allows you to control a given endpoint that supports a [RESTful API](https://en.wikipedia.org/wiki/Representational_state_transfer). The switch can get the state via GET and set the state via POST on a given REST resource.
To enable this switch, add the following lines to your `configuration.yaml` file:
@ -30,17 +29,16 @@ resource:
description: The resource or endpoint that contains the value.
required: true
type: string
default: string
method:
description: "The method of the request. Supported `post` or `put`."
required: false
type: string
default: POST
default: post
name:
description: Name of the REST Switch.
required: false
type: string
default: REST Binary Switch
default: REST Switch
timeout:
description: Timeout for the request.
required: false
@ -78,13 +76,12 @@ Make sure that the URL matches exactly your endpoint or resource.
### {% linkable_title Switch with templated value %}
This example shows a switch that uses a [template](/topics/templating/) to allow Home Assistant to determine its state. In this example the REST endpoint returns this JSON response with true indicating the switch is on.
This example shows a switch that uses a [template](/topics/templating/) to allow Home Assistant to determine its state. In this example, the REST endpoint returns this JSON response with true indicating the switch is on.
```json
{"is_active": "true"}
```
```yaml
switch:
- platform: rest
@ -95,4 +92,3 @@ switch:
```
`body_on` and `body_off` can also depend on the state of the system. For example, to enable a remote temperature sensor tracking on a radio thermostat, one has to send the current value of the remote temperature sensor. This can be achieved by using the template `{% raw %}'{"rem_temp":{{states.sensor.bedroom_temp.state}}}'{% endraw %}`.