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?

https://docs.smartthings.com/en/latest/smartapp-developers-guide/simple-event-handler-smartapps.html

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

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

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

Worked like a charm. Thanks!

2 Likes