Accessing the code for "built-in" SmartApps


(Tim Steele) #1

Forgive me if this is already common knowledge - but I did look and didn’t find anything in the documentation nor anywhere here on the community pages that tells this…

I realized that, I’m about 85-90% happy with SmartThings “as is.” I imagine that’ll change as I come up with more ideas - so one day I may want to write SmartApps from scratch. But, in the meantime, I just want to change some of the “native” SmartApps to suit my needs.

For instance, I have lights set up to go on/off when motion is detected/or not during specific hours. I want to change that to sunset/sunrise hours instead - and there’s no option for that from the “Light Turn On Motion” app that’s available in the SmartThings app. I’d love to modify that code in the IDE.

But I don’t know how to access that SmartApp so I can modify it (and “save as” I suppose).

Any suggestions? Thanks everyone.


(Paul) #2

Have you looked at the “Change mode and control lights based on local sunrise and sunset times” under Other>Convenience. The source code for this SmartApp is also available in the IDE.


(Tim Steele) #3

Thanks - I’ll check that one out. Still, I’ll want to modify others. So, my question stands.


(Paul) #4

I have been unable to locate the source for “Light Turn On Motion”


#5

Same here… I’ve had SmartThings for almost a year now and I’ve been able to accomplish what’s missing in the built in SmartApps with IFTTT, but now that’s not going to work.

I just want to take the existing “Light Turn On Open/Close” and reverse it.
As in when a door opens during specific hours turn a light off, when it closes, turn it back on.
Don’t think I should have to re-engineer a new SmartApp. More or less do two find/replaces on replace with off, Open replaced with closed, you know what I mean.

How do you find source code, “also available in the IDE” exactly?


(Aaron) #6

Kinda goofy, but what you have to do is go into the developer site, initiate a new SmartApp, then, you will see a pull-down on the right, “Browse SmartApp Templates”. Click here and you should be able to find the existing ‘stock’ apps and review and/or use the code as a basis for a new app. I have a dummy app set up permanently to use for accessing existing code so I can avoid having to go through the process of initiating an app every time I just want to review some existing code.


#7

Thanks Aaron… I did eventually figure it out last night. I wrote/edited my first SmartApp and it actually worked to my susprise. :slight_smile:


(Larry) #8

that works. but as a side note how to I copy a device template to modify for instance my door locks are not returning battery status neither is the siren… I have code that was added to a leak sensor device template to do this and I want to add it to the other 2 classes… thanks


(Carter) #9

Is this what you guys are looking for? https://github.com/SmartThingsCommunity/SmartThingsPublic/tree/master/smartapps