mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-01 16:57:34 +00:00
1.5 KiB
1.5 KiB
layout | title | description | date | sidebar | comments | sharing | footer | logo | ha_category | ha_release | ha_iot_class |
---|---|---|---|---|---|---|---|---|---|---|---|
page | RESTful Command | Instructions how to integrate REST commands into Home Assistant. | 2018-02-24 00:00 | true | false | true | true | restful.png | Automation | 0.36 | Local Push |
This component can expose regular REST commands as services. Services can be called from a script or in automation.
To enable this switch, add the following lines to your configuration.yaml
file:
# Example configuration.yaml entry
rest_command:
example_request:
url: 'http://example.com/'
Configuration variables:
- [service_name] (Required): The name used to expose the service. E.g., in the above example, it would be
rest_command.example_request
.- url (Required): The URL (support template) for sending request.
- method (Optional): HTTP method to use (
get
,post
,put
, ordelete
). Defaults toget
. - headers (Optional): The headers for the requests.
- payload (Optional): A string/template to send with request.
- username (Optional): The username for HTTP authentication.
- password (Optional): The password for HTTP authentication.
- timeout (Optional): Timeout for requests. Defaults to 10 seconds.
- content_type (Optional): Content type for the request.
The commands can be dynamic, using templates to insert values of other entities. Service call support variables for template stuff.