New Plugin: Switchboard -- Virtual Switches Re-imagined

[quote=“sebby, post:20, topic:200515”][quote=“dJOS, post:19, topic:200515”][quote=“dJOS, post:18, topic:200515”]Hi patrick, I didnt realise this needed openLuup to run and as a result It doesnt work and throws this error at statup

System error : Device: 197. Fail to load implementation file D_Switchboard1.xml

How do I remove it?[/quote]

nevermind, I found the answers via google. 8)

PS, it’d be great if this worked natively on Vera.[/quote]

This is working on my Vera without any issues… maybe try to re-install it?[/quote]

Hmm ok ill do that.

Lol, I installed the files from the OpenLuup folder by mistake - installing the files from SRC works just fine. 8)

[quote=“a-lurker, post:10, topic:200515”]

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.[/quote]

This may be what is happening to me, although, I hardly think of my VeraPlus as an ‘older device’. When I click on the ‘Alt’ button on the Alt Store, it just turns red and changes to ‘Failure’ Same on my VeraLite. I installed it manually OK but would really like to install it from the Alt Store instead. Any idea how to fix this??

While I’m on the subject…
It would be nice if there were a checkbox I could click that would make a switch be ‘state agnostic’. By that I mean if the switch is off and you turn if off again it will still fire it’s off trigger anyway.
If I have a switch that triggers an ‘All Lights On’ scene when turned on and an ‘All Lights Off’ scene when turned off I might want to turn the switch/trigger off and a few hours later turn it off again to turn off any lights that have been turned on in the interim.
Sound interesting? Do-able?
And BTW, thanks for the plugin. I’m finding it very useful.

[quote=“Jim McGhee, post:23, topic:200515”][quote=“a-lurker, post:10, topic:200515”]

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.[/quote]

This may be what is happening to me, although, I hardly think of my VeraPlus as an ‘older device’. When I click on the ‘Alt’ button on the Alt Store, it just turns red and changes to ‘Failure’ Same on my VeraLite. I installed it manually OK but would really like to install it from the Alt Store instead. Any idea how to fix this??[/quote]

No idea, and I’m not in a position to troubleshoot it; I don’t use ALTUI/AltAppStore on any of my Vera systems. It works under openLuup, so I’m assuming it’s a platform-specific issue.

Edit: let me add to this. IMPORTANT INFO FOR ALTUI/ALTAPPSTORE USERS ON GENUINE VERA SYSTEMS (this info does not apply to openLuup ALTUI/AltAppStore users). Installing this particular plugin using the AltAppStore to a Vera system is actually something you should not do–again, with this particular plugin. There are certain device and service files that exist on Vera that the plugin requires, that do not exist on openLuup. For this reason, the Vera install (via Vera Plugin Marketplace) and openLuup install (via AltAppStore) are different–the openLuup install has to include those missing files as extra installed resources. There is no way that I’m aware of in the AltAppStore to set different file/resource sets for Vera targets vs openLuup targets, so any install using the AltAppStore is assumed to be an openLuup target and will install those extra files. So if you use the AltAppStore on Vera to install this plugin, you will get the additional files intended only for openLuup that will thus duplicate existing Vera system files and may override the Vera versions of those files. That might be bad. It might change all of your binary switch UI behaviors system-wide. It might mask future changes Vera makes to their files. You don’t want any of that, so don’t do that.

If you are installing this plugin to Vera, use only the Vera Plugin Marketplace, or a manual install (and omit the files in the openLuup subdirectory). If you are installing to openLuup, use the AltAppStore, or manual install (and in this case include the files in the openLuup subdirectory). Don’t cross the streams.

While I'm on the subject.. It would be nice if there were a checkbox I could click that would make a switch be 'state agnostic'. By that I mean if the switch is off and you turn if off again it will still fire it's off trigger anyway. If I have a switch that triggers an 'All Lights On' scene when turned on and an 'All Lights Off' scene when turned off I might want to turn the switch/trigger off and a few hours later turn it off again to turn off any lights that have been turned on in the interim. Sound interesting? Do-able? And BTW, thanks for the plugin. I'm finding it very useful.

Done. Install the stable branch version, direct link to it here: GitHub - toggledbits/Switchboard-Vera at stable

I know you already installed yours manually (so you know how), but for the benefit of others reading: to update an existing install, click the green “Clone or download” button at the above-linked page, and choose “Download ZIP”. Then unzip the contents of the file, and upload the files to Vera using the uploader at Apps > Develop apps > Luup files (better to turn off the “Restart Luup after upload” checkbox until you get to the last file). Do a full browser refresh with cache flush as well.

[quote=“rigpapa, post:24, topic:200515”]If you are installing this plugin to Vera, use only the Vera Plugin Marketplace, or a manual install (and omit the files in the openLuup subdirectory). If you are installing to openLuup, use the AltAppStore, or manual install (and in this case include the files in the openLuup subdirectory). Don’t cross the streams.

While I'm on the subject.. It would be nice if there were a checkbox I could click that would make a switch be 'state agnostic'.

Done. Install the stable branch version, direct link to it here: https://github.com/toggledbits/Switchboard-Vera/tree/stable[/quote]
Wow, that was a quick turnaround! The State Agnostic switch works great!!

But on the install, I searched for ‘Switchboard’ in ‘Apps’/‘Install Apps’ and in ‘Settings’/‘Customer Care’/‘faq’/‘Apps’/‘Vera Plugins’/‘Mios Marketplace’ and couldn’t find it. Am I looking in the wrong place? Should I be searching for something else? I am obviously missing something.
I would like to use the Vera install on my VeraPlus and I’m not using openLuup.

[quote=“rigpapa, post:24, topic:200515”][quote=“Jim McGhee, post:23, topic:200515”]

While I’m on the subject…
It would be nice if there were a checkbox I could click that would make a switch be ‘state agnostic’. By that I mean if the switch is off and you turn if off again it will still fire it’s off trigger anyway.
If I have a switch that triggers an ‘All Lights On’ scene when turned on and an ‘All Lights Off’ scene when turned off I might want to turn the switch/trigger off and a few hours later turn it off again to turn off any lights that have been turned on in the interim.
Sound interesting? Do-able?
And BTW, thanks for the plugin. I’m finding it very useful.

Done. Install the stable branch version, direct link to it here: [url=https://github.com/toggledbits/Switchboard-Vera/tree/stable]https://github.com/toggledbits/Switchboard-Vera/tree/stable[/url][/quote]

Brilliant, this was what was missing from making a “nothing” virtual switch, not I can replace the 2 memeory consuming ones I have.[/quote]

[quote=“rigpapa, post:24, topic:200515”][quote=“Jim McGhee, post:23, topic:200515”]While I’m on the subject…
It would be nice if there were a checkbox I could click that would make a switch be ‘state agnostic’. By that I mean if the switch is off and you turn if off again it will still fire it’s off trigger anyway.[/quote]

Done. Install the stable branch version, direct link to it here: https://github.com/toggledbits/Switchboard-Vera/tree/stable[/quote]

Ok, I’m POSITIVE this was working yesterday but today I reinstalled the stable version and every thing works except the ‘state agnostic’ part. No matter which way I set the new box under ‘options’, it doesn’t trigger a scene unless the state changes.
I’m sure this was working before I re-uploaded the plugin.
Not sure if this is connected, but is it ok that the created switches have two variables named trigger and two variables named status?

Not sure what to expect here.
I installed the updated version and was expecting to see 3 switch positions similar to the “nothing virtual switch”
Maybe I’m expecting that this version is like this.

[quote=“zedrally, post:28, topic:200515”]Not sure what to expect here.
I installed the updated version and was expecting to see 3 switch positions similar to the “nothing virtual switch”
Maybe I’m expecting that this version is like this.[/quote]

There’s no UI for creating a tri-state switch yet. I still consider it an experimental feature. Steps for creating a tri-state switch are in this post: http://forum.micasaverde.com/index.php/topic,120149.msg441404.html#msg441404

[quote=“rigpapa, post:15, topic:200515”][quote=“a-lurker, post:10, topic:200515”]

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?[/quote]

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:

EDIT: Users of Switchboard v1.2 and up–there is now a UI on the Switchboard control panel for creating tri-state and other switch types. DO NOT use this procedure! This only applied to an older version of Switchboard and no longer applies.

[ul][li]Add a new virtual switch on the Switchboard control panel; it will be created as a binary switch;[/li]
[li]Go into the control panel for the new switch, Advanced tab to get to its attributes;[/li]
[li]Convert the switch by setting its “device_json” attribute to [tt]D_TriStateSwitch1.xml[/tt] and its “model” attribute to [tt]Switchboard Virtual Tri-state Switch[/tt]. I recommend copy-paste, as the particular/peculiar capitalization is important.[/li]
[li]Reload Luup and hard-refresh your browser.[/li][/ul]

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.[/quote]

I’m not finding tristate.xml file on github, the .json is there but not the .xml or am I looking in the wrong place?

Well, that’s a typo! It should be a “.json” suffix. I went back and fixed that in the prior instructions linked, but you should see the JSON file, and that’s the one you want to use. Thanks for pointing this out. I’ve missed that on no less than two re-reads of those instructions today.

Patrick, I’m still not having much luck with the tri-state switch.
I added the .json file, this took out the parent, so I’m left with only a tri-state child.
Is this what is expected?

[quote=“zedrally, post:32, topic:200515”]Patrick, I’m still not having much luck with the tri-state switch.
I added the .json file, this took out the parent, so I’m left with only a tri-state child.
Is this what is expected?[/quote]

Nope. Kinda sounds like you changed the device_json attribute on the parent rather than the child…?

OK, got it now.
Can a timer be added to set the status to void from either the ON or OFF?
Presently I’m using a scene to do this on the “Nothing Virtual Switch” or will it complicate it to much?

[quote=“zedrally, post:34, topic:200515”]OK, got it now.
Can a timer be added to set the status to void from either the ON or OFF?
Presently I’m using a scene to do this on the “Nothing Virtual Switch” or will it complicate it to much?[/quote]

As it happens right now, it only sets the timer auto-reset (impulse switch) timer when you set the switch to “on”. I can’t see any reason not to reverse the sense of this test and have it set the timer when you set the switch to anything other than “off.” It would not change the behavior for binary switches, and I can see the utility for tri-state switches (and you have the option of not using the internal timer and/or using other facilities if you need different behavior).

If you want to hack this into your running code, the change will be to this line around 348 in L_Switchboard1.lua:

    if status == "0" or status == "2" then

just change it to…

    if state == "0" then

And I’ll have this posted to stable by morning, and in the next release, unless there’s great gnashing of teeth and wailing outcry from others that this shouldn’t happen for some reason. :slight_smile:

[quote=“Jim McGhee, post:27, topic:200515”]Ok, I’m POSITIVE this was working yesterday but today I reinstalled the stable version and every thing works except the ‘state agnostic’ part. No matter which way I set the new box under ‘options’, it doesn’t trigger a scene unless the state changes.
I’m sure this was working before I re-uploaded the plugin.[/quote]

Am I the only one having a problem with the State Agnostic Switch setting on this plugin? Is it working for anyone else?
TIA, Jim

[quote=“Jim McGhee, post:36, topic:200515”][quote=“Jim McGhee, post:27, topic:200515”]Ok, I’m POSITIVE this was working yesterday but today I reinstalled the stable version and every thing works except the ‘state agnostic’ part. No matter which way I set the new box under ‘options’, it doesn’t trigger a scene unless the state changes.
I’m sure this was working before I re-uploaded the plugin.[/quote]

Am I the only one having a problem with the State Agnostic Switch setting on this plugin? Is it working for anyone else?
TIA, Jim[/quote]

What version number is showing on the control panel?

[quote=“rigpapa, post:37, topic:200515”][quote=“Jim McGhee, post:36, topic:200515”]Am I the only one having a problem with the State Agnostic Switch setting on this plugin? Is it working for anyone else?
TIA, Jim[/quote]

What version number is showing on the control panel?[/quote]

Sorry, I should have lead with that. :-[

Switchboard ver 1.2 ? 2018,2019 Patrick H. Rigney, All Rights Reserved

It might be that I’m using it wrong.

[quote=“Jim McGhee, post:38, topic:200515”][quote=“rigpapa, post:37, topic:200515”][quote=“Jim McGhee, post:36, topic:200515”]Am I the only one having a problem with the State Agnostic Switch setting on this plugin? Is it working for anyone else?
TIA, Jim[/quote]

What version number is showing on the control panel?[/quote]

Sorry, I should have lead with that. :-[

Switchboard ver 1.2 ? 2018,2019 Patrick H. Rigney, All Rights Reserved

It might be that I’m using it wrong.[/quote]

Seems right. Vera or openLuup? I should have asked that in my lead-in, too… :slight_smile:

I’m on a VeraPlus which does have openLuup installed but I manually installed Switchboard on the actual VeraPlus. And I am testing there too.
I also have a VeraLite testbed that does NOT have openLuup installed and I have the same problem.

I’ve set up the test with both Vera and AltUI. Same story on both.

I took the liberty of adding a couple of calls to luup.log in SetVar and can see that it does, in fact set the Status even when the value hasn’t changed but for some reason this does not trigger the scene. ??
Do I need to set up the scene trigger special??

And, thanks for the quick reply.