SmartThings Community

Can a Routine run a Smartapp?

I have a TCL Roku TV that often needs to be rebooted. I have a custom Smartapp that accomplishes the task. I need a Routine that could be executed by Alexa that would run the Smartapp. Is is possible to use a Routine to accomplish this?

Sure, just have the routine turn on a virtual switch and have the smart app subscribe to the switch coming on. :sunglasses:

1 Like

Thank you! I set up the virtual switch. How do I have the smartapp subscribe to it coming on?

preferences {
    section {
        input "theSwitch", "capability.switch"

def install() {
    subscribe(theSwitch, "switch.on", switchOnHandler)

def switchOnHandler(evt) {
    log.debug "switch turned on!"

Worked like a charm. Thanks!