From 505424e0404cb2a0a6be84ba8a00cf578886487d Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 12 Sep 2015 01:09:21 +0200 Subject: [PATCH] Add an example for with curl --- .../components/switch.command_switch.markdown | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/source/components/switch.command_switch.markdown b/source/components/switch.command_switch.markdown index 70efd603d24..0d4a634c6aa 100644 --- a/source/components/switch.command_switch.markdown +++ b/source/components/switch.command_switch.markdown @@ -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`: -``` +```yaml # Example configuration.yaml entry switch: platform: command_switch @@ -26,7 +26,21 @@ switch: Configuration variables: -- **switches** array (*Required*): Contains all command switches. - - **'entry'** (*Required*): Name of the command switch. Multiple entries are possible. +- **switches** (*Required*): The array that contains all command switches. + - **entry** (*Required*): Name of the command switch. Multiple entries are possible. - **oncmd** (*Required*): The action to take for on. - **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" +``` +