Force turn on/off virtual switch

I am using virtual switch for triggering scences for example:
A virtual switch that represent the TV.
When I turn off the switch the tv will turned off by a scene and the same for turn on.
The problem is when the tv was turned off manually but the switch is in on mode. Now I cant turn on the switch because its already in turn on mode so I need to do it manualy or to turn off then turn on the switch.
Hope you understand ???
How do I force turn off the virtual switch even if the switch is in off mode?

If any one will also face with this problem:
I added a new state to the virtual switch called “nothing”
then, in any mode switch (on/off) I am changing the switch to “nothing” and then I can switch it to ON or Off over and over again :slight_smile:
Attached the new virtual switch files

Hi,
this would be a great feature. but i got a problem to install it. i opened the json, copy the code, go to develop apps/ device simulator json, and paste the code. then i get invalid json error. do i have to add something to the code, or do something else?

Thank you

This works great!!! Thanks for writing this.

ok, im really new with vera and im just a user without any knowledge in writing pc things, and it is not helpful that my mother tongue is another. could anyone tell me what to do please? i opened the code on my mac, this happens with text edit, ive copied that and paste it into apps/ develop apps/ device simulator.
i get an error??? what am i doing wrong?
i would be very thankfully if anyone would take 2 minutes to explain me how to…

thank you for your time and best regards
martin

Download those 2 files and then upload them onto your Vera here:

Apps>Develop Apps>Luup Files> check “Restart Luup after upload”> then upload the two files

this is working :slight_smile:
thank you very very much

Thanks for posting this. This has come in handy as a workaround for Alexa’s use of scenes, where you are forced to say “Alexa, turn on {scene_name}” even when you actually want to turn “off” something, ie. “Alexa, turn on Downstairs off”. I didn’t like saying that.

By using this 3-state Virtual Switch I’m able to say “Alexa, turn [on|off] Downstairs” and it will always run those scenes in the background, regardless of what state the lights are in. I can control the individual lights separately (“turn off Kitchen”), and then go back to using the Virtual Device to turn all of Downstairs on or off.

Hmm, I’ve uploaded both files and I still only have on/off state? Any ideas on steps to try and resolve this? Would really like this functionality.

[quote=“Broncswon, post:10, topic:195469”]Hmm, I’ve uploaded both files and I still only have on/off state? Any ideas on steps to try and resolve this? Would really like this functionality.[/quote]Note that these 2 files don’t have the same name as the original implementation files. You either need to rename them (overwriting the originals - removing the “_2” in them), or you need to go to the particular virtual switch you want to change and go to the advanced tab and change the implementation and device files to match these files. Apologies if you’ve already done this - just wanted to point it out in case you overlooked this.

This is the process I use:

[ol][li]Install the Virtual ON/OFF Switches plugin (one-time setup)[/li]
[li]Upload the two files in this thread: (one-time setup) [list]
[li]Navigate to: Apps > Develop Apps > Luup Files[/li]
[li]Check “Restart Luup after upload”[/li]
[li]Upload the files named: “I_VSwitch_2.xml” and “D_VSwitch_UI7_2.json”[/li]
[/list][/li]
[li]Manually create a device: [list]
[li]Navigate to: Apps > Develop Apps > Create Device[/li]
[li]Fill in just these fields:[list]
[li]Device type: [font=andale mono]“urn:schemas-upnp-org:device:VSwitch:1”[/font][/li]
[li]Description: [font=andale mono]“The Device Name”[/font][/li]
[li]Upnp Device Filename: [font=andale mono]“D_VSwitch.xml”[/font] (original VSwitch file)[/li]
[li]Upnp Implementation Filename: [font=andale mono]“I_VSwitch_2.xml”[/font] (new uploaded file)[/li]
[li]Room: (this is optional)[/li]
[/list][/li]
[li]Press “Create Device” button[/li]
[li]Reload the Lua Engine: http://{your_ip}:{port}/data_request?id=reload [/li]
[li]Reload your browser: https://www.getfilecloud.com/blog/2015/03/tech-tip-how-to-do-hard-refresh-in-browsers/[/li]
[/list][/li]
[li]The virtual switch device should now show up in your device list, but with only Off/On states[/li]
[li]Edit the device JSON:[list]
[li]Navigate to: Devices > {The Virtual Switch Device} > Advanced > Params (tab)[/li]
[li]Edit the [font=andale mono]device_json[/font] param: [font=andale mono]“D_VSwitch_UI7_2.json”[/font] (new uploaded file)[/li]
[/list][/li]
[li]Return to the Devices page, give the system a moment to refresh, and the virtual switch device should show the Off/On/Nothing states[/li][/ol]

[quote=“gabayarden, post:2, topic:195469”]If any one will also face with this problem:
I added a new state to the virtual switch called “nothing”
then, in any mode switch (on/off) I am changing the switch to “nothing” and then I can switch it to ON or Off over and over again :slight_smile:
Attached the new virtual switch files[/quote]

GABAYARDEN - tqtqtqtq!!!

I cant thank you enough for this!

I’m missing something.
Uploaded the files, have the VS with OFF-ON-NOTHING

If I turn the VS OFF, should it then after a period go to the NOTHING State?
Same with turning the VS ON, should it then go to NOTHING?

Edit:
Think I have a corrupted file(s) have asked Support to delete all VS files and I’ll start over.

Bumping since I keep losing this thread

Not working for me, Have done everything correct, re-downloaded the files, re-uploaded to Vera, restarted etc.
The switch doesn’t return to NOTHING state after a command.
See pic below…

I had support remove all the VS files. Reinstalled VS and checked functionality before over writing the files with this version.
I now have the same problem with the VS not returning to Nothing.
Any ideas?

It’s not designed to return to nothing.

Set up a scene so that whenever it changes state you return it to nothing in the scene with a delayed action.

Works good with the broadlink autovera/tasker plugin. Just remember to delay the nothing so that the tasker IR command can complete

Oh, thanks for that info, that explains it :wink:

Wish I had thought of that before, thanks for the explanation.