home-assistant.github.io/source/_components/switch.rest.markdown
Paulus Schoutsen 04f48395d6 Merge branch 'pr/101'
Conflicts:
	source/components/index.markdown
2015-10-24 21:54:58 -07:00

1.2 KiB

layout title description date sidebar comments sharing footer ha_category
page RESTful switch support Instructions how to integrate REST switches into Home Assistant. 2015-09-14 19:10 false false true true Switch
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:

# Example configuration.yaml entry
switch:
  platform: rest
  resource: http://IP_ADDRESS/ENDPOINT
  name: "Bedroom Switch"
  body_on: "ON"
  body_off: "OFF"

Configuration variables:

  • resource (Required): The resource or endpoint that contains the value.
  • name (Optional): Name of the REST switch.
  • body_on (Optional): The body that represents enabled state. Default is "ON".
  • body_off (Optional):The body that represents disabled state. Default is "OFF".

Make sure that the URL matches exactly your endpoint or resource.