How to create a virtual switch for Smartthings and triggercmd?
-
I have raised this question in smrtthings but have gotten no result so i thought I would try here.
I have a bunch of triggercmd commands containing bat files which controls my x10 lights. For each light switch/dimmer, a have a command for on and separate command for off. They work great in Smartthings except, how do i create a virtual switch in ST that will allow it to function like a normal light switch (1 switch).
For example, let's say I have created 2 triggercmd commands. one is Bedroom light On and the other is Bedroom Light Off. i would want a virtual switch to be able to toggle on and off. More importantly I would want the switch to have discrete on and off buttons. When i press on it would call up the Bedroom Light On command of triggercmd and when I press off it would call on Bedroom Light Off command in triggercmd. -
@superhuynh, generally, you'd want to make one triggercmd entry with parameters enabled that runs a batch file like this:
if "%1"=="on" curl http://.....%%22A6%%20on%%22 if "%1"=="off" curl http://.....%%22A6%%20off%%22
It takes a single parameter of ether on or off and runs the respective command. %1 gets replaced by the on or off parameter SmartThings will send if you enable parameters on that command.
That will give you this:
"i would want a virtual switch to be able to toggle on and off."But it won't give you this:
"More importantly I would want the switch to have discrete on and off buttons."Those two seem to be in conflict. If you really want the discrete on and off buttons, then you could make an on command and an off command (with parameters disabled), and have two separate ST switches. By default those switches will look like they're toggling on and off when you press them. If you want the switches to always show as "off", then you could use this solution.