[OBSOLETE] SwitchMania - create 4 different kinds of virtual switches

SwitchMania - get here
Create, Control, and Use virtual switches from a single Parent App. No need to use IDE. Allows you to replace dozens of SmartApps with just 1! And if you decide that you no longer need a virtual switch (and/or the link to a Routine), then SwitchMania App deletes it.

SwitchMania - is the parent app.
It controls 2 types of child apps:
(1) My Virtual Switch Creator - which creates virtual (on/off or momentary) switches and
(2) My Switch Calls Routines App - which links a switch with a Routine (Hello Home) when a switch is turned on or off.

You need to install all 3 apps in the IDE.

To have SwitchMania be able to create Virtual Momentary Button Device, you also need to install SmartThings’ “Momentary Button Tile” in the IDE.

The first page of the parent SwitchMania App is the “Create and/or Edit Virtual Switches” page:

Clicking on the “Create a new virtual switch” section will open the “Create New Virtual Switch” (child) page:

When fill out the info, click “done”, it will return to page 1 of SwitchMania. Here’s an example of that page with a few virtual switches:

Clicking “Next” will take you to the 2nd page of SwitchMania app - the “Link Switches with Routines” page:

Clicking the “Create new link…” section will open the “Create New Link to Routine” (child) page:

When you fill out the info, click “done”, it will return to page 2 of SwitchMania. Here’s an example of that page with a few links between switches and Routines:

Clicking “Next” will take you to the 3rd page of SwitchMania app - the “Options” page - which just allows you to change the name of the SwitchMania app:

Enjoy! And, if you feel like making a donation for these community efforts, it would be greatly appreciated: PayPal.Me . Thanks!



Does this create a virtual switch without the need to log into the IDE and then choose “Add New Device”??
I see that you have included the option of creating a momentary switch . Can we modify it to create a regular toggle switch?

Yes. No need to use IDE.

It will create as many virtual switches as you want. You have the option to create a regular “On / Off Button” or – if you install SmartThings “Momentary Button” device type – a “Momentary Button”.

1 Like

Great minds think alike, apparently. :sunglasses:

1 Like

I’m getting the following error when trying to install the 3rd app:

Validation Error(s) occurred during save(): - Field error in object ‘physicalgraph.app.SmartApp’ on field ‘author’: rejected value [null]; codes [physicalgraph.app.SmartApp.author.nullable.error.physicalgraph.app.SmartApp.author,physicalgraph.app.SmartApp.author.nullable.error.author,physicalgraph.app.SmartApp.author.nullable.error.java.lang.String,physicalgraph.app.SmartApp.author.nullable.error,smartApp.author.nullable.error.physicalgraph.app.SmartApp.author,smartApp.author.nullable.error.author,smartApp.author.nullable.error.java.lang.String,smartApp.author.nullable.error,physicalgraph.app.SmartApp.author.nullable.physicalgraph.app.SmartApp.author,physicalgraph.app.SmartApp.author.nullable.author,physicalgraph.app.SmartApp.author.nullable.java.lang.String,physicalgraph.app.SmartApp.author.nullable,smartApp.author.nullable.physicalgraph.app.SmartApp.author,smartApp.author.nullable.author,smartApp.author.nullable.java.lang.String,smartApp.author.nullable,nullable.physicalgraph.app.SmartApp.author,nullable.author,nullable.java.lang.String,nullable]; arguments [author,class physicalgraph.app.SmartApp]; default message [{0} cannot be null]

@deano12 - Thanks. There was a line missing in the definition section. I’ve updated the app in Github. You can grab it from link above, or you can just add

author: “Anthony Pastor”,

to the definition section (after the namespace line).

I’m now having trouble deleting one of the virtual switches I created? error message:

deleted object would be re-saved by cascade (remove deleted object from associations): [physicalgraph.app.InstalledSmartApp#6674932d-c19e-45b9-885b-a5783dbc6653]; nested exception is org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [physicalgraph.app.InstalledSmartApp#6674932d-c19e-45b9-885b-a5783dbc6653]

Plus I’ve now updated the 3rd app, cant see any additional options however?

Hmmm. I’ve not had any problems deleting any child device / child apps.

Have you used the child virtual switch in any other smartapp / routine? If so, delete the association between the child virtual switch and that smartapp / routine first, then try deleting the child virtual switch. If that doesn’t work / apply, then delete from IDE - go to bottom of “My Locations” tab, click “List SmartApps”. Then on the “Installed Smart Apps” page that opens, click “Edit” and uninstall the problematic virtual switch.

The “3rd app” - “My Switch Calls Routines App” provides the option to call a Routine when a switch (virtual or otherwise) is turned on or off. Look on the 2nd page of the SwitchMania app (the title of page reads “Link Switches with Routines (HH Phrases)”.

I am receiving an “An unexpected error occurred” message when I try to create a momentary switch. I entered the switch label, select momentary button type as type, and assign a name. When I hit next is when I receive the error. I have all 3 apps installed and installed the momentary button tile from the IDE. The momentary button is just a generic set-up in the IDE. Any ideas what I am doing wrong?

I am trying to create a momentary switch to open/close my garage doors. I am pretty new to this and assume that a momentary switch is the correct route to take in trying to achieve this action.

Any help would be appreciated. Thanks.

FYI - the “my switch calls routines” app on github is still missing this line.

@jmhoke23 Install the momentary tile device type and it should fix this. I didn’t do this at first either since I assumed it would use the built-in momentary device type but apparently that’s not the case. Errors went away as soon as I did this.

And for those not familiar, it’s nice to add the github integration into your IDE. First, create a github account and link it in the IDE.

Click on settings in either My Device Types or My SmartApps:

Then add infofiend’s (and anyone else’s) repository:

After that you can easily update the device types and apps using the “Update from Repo” button.

1 Like

@zj4x4…apologies but I am new to this. I changed the device type in IDE to momentary capability, momentary button, and also tried momentary button tile all with no luck. I am assuming that I should be selecting something else under the device type, is that correct? If so could I trouble you for a quick screen of the exact device type?


Open the IDE and go to device types. Click new device type. Click the ‘From Code’ tab.

In another browser tab open infofiend’s device type from: https://raw.githubusercontent.com/infofiend/SwitchMania/master/devicetypes/smartthings/momentary-button-tile.src/momentary-button-tile.groovy (this is the raw code view)

Select all (ctrl+A), copy (ctrl+C) and paste it into the IDE tab where you are creating the new device type. It will take you to the code editing screen. Click Publish > For Me.

Now close the ST app on your phone completely and open it up again. When you run SwitchMania you should no longer receive errors.

1 Like

I just tried to install this because im having trouble with setting a dimmer that steps the level up or down over a certain amount of time. This seems to allow me to try this again with a few workarounds.

Im having an issue installing the app though. This is the error i get when pasting the code to my IDE.

No signature of method: script14528649924281569178833.metadata() is applicable for argument types: (script14528649924281569178833$_run_closure1) values: [script14528649924281569178833$_run_closure1@e4195da] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

There are two different places to paste based on whether you’re adding a device type or a SmartApp. I think you’re in the wrong one. :smile:

1 Like

DOH!!! :flushed: Thank you for the help. I worked, funny how that happens. :relieved:

Unable to install the “My Switch Calls Routines App”. Go to install smart app, copy code from RAW and get the following error.

Validation Error(s) occurred during save(): - Field error in object 'physicalgraph.app.SmartApp' on field 'author': rejected value [null]; codes [physicalgraph.app.SmartApp.author.nullable.error.physicalgraph.app.SmartApp.author,physicalgraph.app.SmartApp.author.nullable.error.author,physicalgraph.app.SmartApp.author.nullable.error.java.lang.String,physicalgraph.app.SmartApp.author.nullable.error,smartApp.author.nullable.error.physicalgraph.app.SmartApp.author,smartApp.author.nullable.error.author,smartApp.author.nullable.error.java.lang.String,smartApp.author.nullable.error,physicalgraph.app.SmartApp.author.nullable.physicalgraph.app.SmartApp.author,physicalgraph.app.SmartApp.author.nullable.author,physicalgraph.app.SmartApp.author.nullable.java.lang.String,physicalgraph.app.SmartApp.author.nullable,smartApp.author.nullable.physicalgraph.app.SmartApp.author,smartApp.author.nullable.author,smartApp.author.nullable.java.lang.String,smartApp.author.nullable,nullable.physicalgraph.app.SmartApp.author,nullable.author,nullable.java.lang.String,nullable]; arguments [author,class physicalgraph.app.SmartApp]; default message [{0} cannot be null]

Just curious if anyone else is having this issue. Would love to try this app and trust the work of @infofiend (pretty much most of the apps I use are by you) :wink:

1 Like

Have you installed the device types as well?

I was getting the same error, then I added this piece of code author: “Anthony Pastor”, under the namspace line and I stopped getting the error.

I am currently having an issue where the switches are not being created and once I define the switch name and button caption, the screen does nothing. The green heading saying that the app is successful and now automating comes up, but nothing else happens.

Fixed that error in the GitHub Repo. Sorry everyone.