We have moved at community.getvera.com

Author Topic: New Plugin: Switchboard -- Virtual Switches Re-imagined  (Read 2755 times)

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
New Plugin: Switchboard -- Virtual Switches Re-imagined
« on: January 28, 2019, 09:28:39 pm »
One of the problems with the old Virtual Switch plugin is that it creates devices with its own device type, rather than a Vera-native device type for a binary switch. As a result, its virtual switches aren't recognized as equivalent in many places (notably the Android mobile app, where the switches are listed but not controllable).

Virtual Switch has other problems, so I've just created a re-imagined 2019 implementation of virtual switches in a new plugin I call Switchboard. It's not published in the Vera store yet, but you can get it here: https://github.com/toggledbits/Switchboard-Vera

Please see the README file at the link above for more details.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 999
  • Karma: +47/-9
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #1 on: January 28, 2019, 11:09:10 pm »
Awesome,  I will definitely check out.
One thing that would be great to add, is a tri-state switch (see this thread:  http://forum.micasaverde.com/index.php/topic,47377.msg332388.html#msg332388 )
Like the pulse feature you added except it returns the switch to an unknown state which is really helpful for when you don't know if the v-switch is actually in sync with reality, and want to retrigger the on or off commend.


Offline sebby

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +15/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #2 on: January 29, 2019, 05:16:37 pm »
flipping fantastic!!!  Keep knocking these out!  just replaced all my virtual switches with these.

Offline sebby

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +15/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #3 on: January 29, 2019, 05:27:04 pm »
One quick question, is there a way to uniquely identify these devices vs. a binary light?  I have some startup code that defines some watches so i can kick off some actions (that i have not migrated to Reactor yet).  When these switches were VirtualSwitches, i could use the device_type field to differentiate them, but on these they look and feel like standard Lights.  i guess could use id_parent, but just wanted to check with you. 

Code: [Select]
id 127
name "Virtual Switch 1"
device_type "urn:schemas-upnp-org:device:BinaryLight:1"
room "0"
id_parent 126
embedded 0
disabled 0
device_file "D_BinaryLight1.xml"
impl_file ""
manufacturer ""
model ""
altid "1"
ip ""
mac ""
time_created "1548769771"
states [?]
ControlURLs {?}
device_json "D_BinaryLight1.json"
category_num "3"
subcategory_num "0"
invisible "0"
local_udn "uuid:4d494342-5342-5645-007f-000002167db2"

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #4 on: January 29, 2019, 06:11:44 pm »
One quick question, is there a way to uniquely identify these devices vs. a binary light?  I have some startup code that defines some watches so i can kick off some actions (that i have not migrated to Reactor yet).  When these switches were VirtualSwitches, i could use the device_type field to differentiate them, but on these they look and feel like standard Lights.  i guess could use id_parent, but just wanted to check with you.

If you pull the latest (right-click this link, Save Link As...) L_Switchboard1.lua and upload it to your Vera, it will immediately brand the "manufacturer" attribute == "rigpapa" and the "model" attribute == "Switchboard Virtual Binary Switch". Other switch types are coming, so if you're concerned specifically about the virtual binary switches, test the model attribute.

I will make sure those strings remain stable.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 872
  • Karma: +66/-8
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #5 on: January 29, 2019, 06:42:33 pm »
Can we please see this made available in the AltAppStore?

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #6 on: January 29, 2019, 07:52:10 pm »
Can we please see this made available in the AltAppStore?

I can, but it will be for Vera only at this time. Does that work for you?
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline sebby

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +15/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #7 on: January 29, 2019, 08:54:50 pm »
If you pull the latest (right-click this link, Save Link As...) L_Switchboard1.lua and upload it to your Vera, it will immediately brand the "manufacturer" attribute == "rigpapa" and the "model" attribute == "Switchboard Virtual Binary Switch". Other switch types are coming, so if you're concerned specifically about the virtual binary switches, test the model attribute.

I will make sure those strings remain stable.

Thank you!!!!

Offline sm2117

  • Jr. Member
  • **
  • Posts: 83
  • Karma: +0/-1
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #8 on: January 29, 2019, 09:26:45 pm »
Love your work! Thanks rigpapa!!!

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 872
  • Karma: +66/-8
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #9 on: January 29, 2019, 10:20:33 pm »
Quote
I can, but it will be for Vera only at this time. Does that work for you?

Does that mean it will not work with openLuup and / or AltUI?

Also GitHub changed a few things with their own security so some of the older Veras now can't engage with the Alt Store, so that's a separate problem in itself.

All up, no big deal.

Offline Quixote

  • Sr. Member
  • ****
  • Posts: 350
  • Karma: +18/-35
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #10 on: January 30, 2019, 06:17:25 pm »
Hi,
I've been experimenting with a Aeotec Wallmote Quad and Multi-Channel Associations. I doubt it, but would it be possible to have a virtual switch that pretends it's a Zwave switch or dimmer that could be associated to the device in order to somehow use the swiping features of the Wallmote on non-Zwave devices?
Thanks
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person. (I guess I'm "Chaotic Neutral").

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #11 on: January 30, 2019, 08:38:45 pm »
Quote
I can, but it will be for Vera only at this time. Does that work for you?

Does that mean it will not work with openLuup and / or AltUI?

Also GitHub changed a few things with their own security so some of the older Veras now can't engage with the Alt Store, so that's a separate problem in itself.

All up, no big deal.

The code works fine. The problem is that openLuup does not have its own set of default device files like those that Vera ships with (specifically device file D_BinaryLight1.xml and static JSON D_BinaryLight1.json to create the UI). So while using Vera's canned device and service files fixes many of the problems with virtual devices on Vera, it creates new problems on openLuup. The device file is easily derived from the UPnP standards (Vera's are almost identical, and the differences are not meaningful). I need to recreate the static JSON file, and get the deployment squared away so it's clear that those files should not be installed on Veras, but must be installed on openLuup.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #12 on: January 30, 2019, 08:39:39 pm »
Hi,
I've been experimenting with a Aeotec Wallmote Quad and Multi-Channel Associations. I doubt it, but would it be possible to have a virtual switch that pretends it's a Zwave switch or dimmer that could be associated to the device in order to somehow use the swiping features of the Wallmote on non-Zwave devices?
Thanks

What state does the Wallmote change when you do things with it?
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline Quixote

  • Sr. Member
  • ****
  • Posts: 350
  • Karma: +18/-35
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #13 on: January 30, 2019, 09:49:27 pm »
There are several settings you can apply, but the one I'm interested in is tapping a button to toggle a light on/off, and tap, hold and swipe up or down to brighten or dim the light. I can set any of the other 4 buttons to trigger scenes.
I think this may be impossible though since it seems the multi-channel association is looking for direct communication with a Zwave device.
My "Karma" has been modified by 2 or 3 douchebags that didn't like that I criticized the plugin that they worship. I'm not actually a bad person. (I guess I'm "Chaotic Neutral").

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: New Plugin: Switchboard -- Virtual Switches Re-imagined
« Reply #14 on: January 31, 2019, 01:27:56 pm »
Quote
I can, but it will be for Vera only at this time. Does that work for you?

Does that mean it will not work with openLuup and / or AltUI?

OK. I think I've got everything sorted. It's in the AltAppStore. Additional files are installed for openLuup.

The current Github master release also has my effort at support for tri-state switches, but there's no UI yet to create one. So, to create a tri-state switch, you do this:
  • Add a new virtual switch on the Switchboard control panel; it will be created as a binary switch;
  • Go into the control panel for the new switch, Advanced tab to get to its attributes;
  • Convert the switch by setting its "device_json" attribute to D_TriStateSwitch1.json and its "model" attribute to Switchboard Virtual Tri-state Switch. I recommend copy-paste, as the particular/peculiar capitalization is important.
  • Reload Luup and hard-refresh your browser.

The new switch should then have a three-button UI, and clicking on the switch icon in the Switchboard control/status panel should roll it through off-on-void states. The values and actions are the same as those used for the old Virtual Switch plugin (specifically target/status "2" is the void/third state).

There is a bug in current ALTUI that affects the UI for the tri-state switch type, so void state is not accessible here on ALTUI. I've made amg0 aware and he'll get to it when he's able; it's not critical.

Also note that both UI7 and ALTUI require page refreshes when you change visibility to get a display consistent with settings. It's just a thing you need to do.

Edit: fix filename (2019-02-18)
« Last Edit: February 18, 2019, 06:16:08 pm by rigpapa »
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.