RESTful Binary Sensor
The rest
binary sensor platform is consuming a given endpoint which is exposed by a RESTful API of a device, an application, or a web service. The binary sensor has support for GET and POST requests.
To enable this sensor, add the following lines to your configuration.yaml
file for a GET request:
# Example configuration.yaml entry sensor: platform: rest resource: http://IP_ADDRESS/ENDPOINT method: GET name: REST GET binary sensor value_template: '{{ value_json.state }}'
or for a POST request:
# Example configuration.yaml entry sensor: platform: rest resource: http://IP_ADDRESS/ENDPOINT method: POST value_template: '{{ value_json.state }}' payload: '{ "device" : "door" }' name: REST POST binary sensor
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 to extract the value.
- payload (Optional): The payload to send with a POST request. Usualy formed as a dictionary.
- name (Optional): Name of the REST binary sensor.
Make sure that the URL matches exactly your endpoint or resource.