Modify Stock Simulated Switch DT?


Hi all, very quick question.

I want to create a virtual switch that cannot be trigged via touch in the app/also want to change the tile colour. Ie - I want to get a copy of the default simulated switch DT and make my own version. Problem is I cannot find the raw code. Its no longer one of the ‘template’ DT’s in the creation tab on graph.

Anyone have a copy of the code I can use?


( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

You can probably start with this:


thanks but I get the following error: Run Locally Permission not allowed for DeviceType: 55634282-4eb0-48b8-85ee-e76f6c68e808

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

You can’t run a custom DTH locally.

Remove the run-local flag. Not sure where it is… under My Devices?


hi, sorry, im not sure - fo you mean in the DT code or via a different page on the graph?

I run many other simulated switches using the default ST handler but just wanted to change a couple of attributes for this switch.


( - Make your home your butler!) #6

He meant to say replace

definition (name: "Virtual Switch", namespace: "smartthings", author: "SmartThings", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true, mnmn: "SmartThings", vid: "generic-switch") {


definition (name: "Virtual Switch", namespace: "smartthings", author: "SmartThings", runLocally: false, minHubCoreVersion: '000.021.00001', executeCommandsLocally: false, mnmn: "SmartThings", vid: "generic-switch") {


thanks that worked. anyone know if its possible to disable app based actuation of a virtual switch? ie - programatic as a result of an automation only?

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #8

Yes. Just remove the method call in the Tile definition.


sorry I’m, new to this - could you be more specific. I’ve had a look at the code and can’t see what you are referring to under definition.

(Simon) #10

He means the bit that says action: “switch.on”

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #11

Yup… Not trying to be unhelpful, but the Community is a place for learning - not for free custom solutions.

It’s valuable for you to take an hour or two and study the code and documentation to try to figure out what it means and then experiment with edits and see what happens.

That way you would have taught yourself to fish and a world of fish suppers are at your fingertips.

See the section on Device Type Handlers / Tiles.



( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #13

Basic idea…

        multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
            tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
                attributeState "on", label:'${name}', action:"doNothing", icon:"st.Home.home30", backgroundColor:"#00A0DC", nextState:"on"
                attributeState "off", label:'${name}', action:"doNothing", icon:"st.Home.home30", backgroundColor:"#FFFFFF", nextState:"off", defaultState: true
/* Delete these lines */
        standardTile("explicitOn", "device.switch", width: 2, height: 2, decoration: "flat") {
            state "default", label: "On", action: "switch.on", icon: "st.Home.home30", backgroundColor: "#ffffff"
        standardTile("explicitOff", "device.switch", width: 2, height: 2, decoration: "flat") {
            state "default", label: "Off", action: "", icon: "st.Home.home30", backgroundColor: "#ffffff"
/* End Delete */

/* Before or After the def on() and def off() methods, add this method... */
def doNothing() {