diff --git a/source/_components/binary_sensor.rest.markdown b/source/_components/binary_sensor.rest.markdown index 0a5c789d36e..4739781d2fb 100644 --- a/source/_components/binary_sensor.rest.markdown +++ b/source/_components/binary_sensor.rest.markdown @@ -47,25 +47,61 @@ binary_sensor: method: POST ``` -Configuration variables: - -- **resource** (*Required*): The resource or endpoint that contains the value. -- **method** (*Optional*): The method of the request. Default is GET. -- **name** (*Optional*): Name of the REST binary sensor. -- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend. -- **value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the value. -- **payload** (*Optional*): The payload to send with a POST request. Usually formed as a dictionary. -- **verify_ssl** (*Optional*): Verify the certification of the endpoint. Default to True. -- **authentication** (*Optional*): Type of the HTTP authentication. `basic` or `digest`. -- **username** (*Optional*): The username for accessing the REST endpoint. -- **password** (*Optional*): The password for accessing the REST endpoint. -- **headers** (*Optional*): The headers for the requests. +{% configuration %} +resource: + description: The resource or endpoint that contains the value. + required: true + type: string + default: string +method: + description: The method of the request. + required: false + type: string + default: GET +name: + description: Name of the REST binary sensor. + required: false + type: string + default: REST Binary Sensor +device_class: + description: "The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend." + required: false + type: string +value_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the value." + required: false + type: template +payload: + description: The payload to send with a POST request. Usually formed as a dictionary. + required: false + type: string +verify_ssl: + description: Verify the certification of the endpoint. + required: false + type: boolean + default: True +authentication: + description: Type of the HTTP authentication. `basic` or `digest`. + required: false + type: string +username: + description: The username for accessing the REST endpoint. + required: false + type: string +password: + description: The password for accessing the REST endpoint. + required: false + type: string +headers: + description: The headers for the requests. + required: false + type: list, string +{% endconfiguration %}
Make sure that the URL exactly matches your endpoint or resource.
- ## {% linkable_title Examples %} In this section you find some real life examples of how to use this sensor. diff --git a/source/_components/sensor.rest.markdown b/source/_components/sensor.rest.markdown index aa34b219058..15a366f78e4 100644 --- a/source/_components/sensor.rest.markdown +++ b/source/_components/sensor.rest.markdown @@ -36,20 +36,60 @@ sensor: payload: '{ "device" : "heater" }' ``` -Configuration variables: - -- **resource** (*Required*): The resource or endpoint that contains the value. -- **method** (*Optional*): The method of the request. Default is `GET`. -- **value_template** (*Optional*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the value. -- **payload** (*Optional*): The payload to send with a POST request. Depends on the service, but usually formed as JSON. -- **name** (*Optional*): Name of the REST sensor. -- **unit_of_measurement** (*Optional*): Defines the unit of measurement of the sensor, if any. -- **verify_ssl** (*Optional*): Verify the certification of the endpoint. Default to `True`. -- **authentication** (*Optional*): Type of the HTTP authentication. `basic` or `digest`. -- **username** (*Optional*): The username for accessing the REST endpoint. -- **password** (*Optional*): The password for accessing the REST endpoint. -- **headers** (*Optional*): The headers for the requests. -- **json_attributes** (*Optional*): A list of keys to extract values from a JSON dictionary result and then set as sensor attributes. Default is an empty list. +{% configuration %} +resource: + description: The resource or endpoint that contains the value. + required: true + type: string + default: string +method: + description: The method of the request. + required: false + type: string + default: GET +name: + description: Name of the REST sensor. + required: false + type: string + default: REST Sensor +value_template: + description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract the value." + required: false + type: template +payload: + description: The payload to send with a POST request. Depends on the service, but usually formed as JSON. + required: false + type: string +verify_ssl: + description: Verify the certification of the endpoint. + required: false + type: boolean + default: True +unit_of_measurement: + description: Defines the units of measurement of the sensor, if any. + required: false + type: string +authentication: + description: Type of the HTTP authentication. `basic` or `digest`. + required: false + type: string +username: + description: The username for accessing the REST endpoint. + required: false + type: string +password: + description: The password for accessing the REST endpoint. + required: false + type: string +headers: + description: The headers for the requests. + required: false + type: list, string +json_attributes: + description: A list of keys to extract values from a JSON dictionary result and then set as sensor attributes. + reqired: false + type: list, string +{% endconfiguration %}Make sure that the URL exactly matches your endpoint or resource. diff --git a/source/_components/switch.rest.markdown b/source/_components/switch.rest.markdown index d9e22107b6e..776882cd54b 100644 --- a/source/_components/switch.rest.markdown +++ b/source/_components/switch.rest.markdown @@ -25,16 +25,50 @@ switch: resource: http://IP_ADDRESS/ENDPOINT ``` -Configuration variables: - -- **resource** (*Required*): The resource or endpoint that contains the value. -- **name** (*Optional*): Name of the REST switch. -- **method** (*Optional*): HTTP method to use (`post` or `put`). Defaults to `post`. -- **username** (*Optional*): The username for accessing the REST endpoint. -- **password** (*Optional*): The password for accessing the REST endpoint. -- **body_on** (*Optional*): The body of the POST request that commands the switch to become enabled. Default is "ON". This value can be a [template](/topics/templating/). -- **body_off** (*Optional*): The body of the POST request that commands the switch to become disabled. Default is "OFF". This value can also be a [template](/topics/templating/). -- **is_on_template** (*Optional*): A [template](/docs/configuration/templating/#processing-incoming-data) that determines the state of the switch from the value returned by the GET request on the resource URL. This template should compute to a boolean (True or False). If the value is valid JSON, it will be available in the template as the variable `value_json`. Default is equivalent to `'{% raw %}{{ value_json == body_on }}{% endraw %}'`. This means that by default, the state of the switch is on if and only if the response to the GET request matches . +{% configuration %} +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 +name: + description: Name of the REST Switch. + required: false + type: string + default: REST Binary Switch +timeout: + description: Timeout for the request. + required: false + type: int + default: 10 +body_on: + description: "The body of the POST request that commands the switch to become enabled. This value can be a [template](/topics/templating/)." + required: false + type: string + default: ON +body_off: + description: "The body of the POST request that commands the switch to become disabled. This value can also be a [template](/topics/templating/)." + required: false + type: string + default: OFF +is_on_template: + description: "A [template](/docs/configuration/templating/#processing-incoming-data) that determines the state of the switch from the value returned by the GET request on the resource URL. This template should compute to a boolean (True or False). If the value is valid JSON, it will be available in the template as the variable `value_json`. Default is equivalent to `'{% raw %}{{ value_json == body_on }}{% endraw %}'`. This means that by default, the state of the switch is on if and only if the response to the GET request matches." + required: false + type: string +username: + description: The username for accessing the REST endpoint. + required: false + type: string +password: + description: The password for accessing the REST endpoint. + required: false + type: string +{% endconfiguration %}
Make sure that the URL matches exactly your endpoint or resource.