mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-21 16:27:19 +00:00
Add an example for with curl
This commit is contained in:
parent
8d99ae4091
commit
505424e040
@ -14,7 +14,7 @@ A switch platform that issues specific commands when it is turned on and off. Th
|
|||||||
|
|
||||||
To enable it, add the following lines to your `configuration.yaml`:
|
To enable it, add the following lines to your `configuration.yaml`:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
switch:
|
switch:
|
||||||
platform: command_switch
|
platform: command_switch
|
||||||
@ -26,7 +26,21 @@ switch:
|
|||||||
|
|
||||||
Configuration variables:
|
Configuration variables:
|
||||||
|
|
||||||
- **switches** array (*Required*): Contains all command switches.
|
- **switches** (*Required*): The array that contains all command switches.
|
||||||
- **'entry'** (*Required*): Name of the command switch. Multiple entries are possible.
|
- **entry** (*Required*): Name of the command switch. Multiple entries are possible.
|
||||||
- **oncmd** (*Required*): The action to take for on.
|
- **oncmd** (*Required*): The action to take for on.
|
||||||
- **offcmd** (*Required*): The action to take for off.
|
- **offcmd** (*Required*): The action to take for off.
|
||||||
|
|
||||||
|
|
||||||
|
The example below is doing the same as the [aREST switch](/components/switch.arest.html). The commandline tool `[curl](http://curl.haxx.se/)` is used to toogle a pin which is controllable through REST.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example configuration.yaml entry
|
||||||
|
switch:
|
||||||
|
platform: command_switch
|
||||||
|
switches:
|
||||||
|
arest_pin4:
|
||||||
|
oncmd: "/usr/bin/curl -X GET http://192.168.1.10/digital/4/1"
|
||||||
|
offcmd: "/usr/bin/curl -X GET http://192.168.1.10/digital/4/0"
|
||||||
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user