mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-08 20:18:59 +00:00
1.6 KiB
1.6 KiB
layout, title, description, date, sidebar, comments, sharing, footer
layout | title | description | date | sidebar | comments | sharing | footer |
---|---|---|---|---|---|---|---|
page | Command line switches support | Instructions how to have a switch call command line commands. | 2015-06-10 22:41 | false | false | true | true |

To enable it, add the following lines to your configuration.yaml
:
# Example configuration.yaml entry
switch:
platform: command_switch
switches:
kitchen_light:
oncmd: switch_command on kitchen
offcmd: switch_command off kitchen
Configuration variables:
- 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.
- entry (Required): Name of the command switch. Multiple entries are possible.
The example below is doing the same as the aREST switch. The commandline tool [curl](http://curl.haxx.se/)
is used to toogle a pin which is controllable through REST.
# 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"