[Feature Request] Routines and Custom Smart Apps

In SmartThings V2, Routines have become a primary method for changing system state. However, Routines themselves (formerly known as “Hello Home” actions) have not changed much, other than adding capability to arm/disarm SHM. For example, there’s still no way to change colors or set dim level individually for multiple lights.

Since we cannot modify Routine’s behavior, it would be helpful if we could extend them via custom apps. All we need is for the Routines to broadcast a location event that contains the Routine’s name as its value. The apps then could subscribe to the Location events and perform whatever actions are necessary when the Routine is executed. This is the same mechanism that Routines use to control HSM, so the change should be pretty minor.

Feel free to comment.

14 Likes

Great idea!!

That would allow us to blow off lots of virtual switches and buttons.

3 Likes

Great idea!

I think this is in the works. I’ll follow up when I get verification.

3 Likes

This certainly seems like an oversight – given the mode change events for example. Any word on whether it’s coming?

Yes it is coming soon. I will follow up here when it’s released.

Ask and you shall receive.*

http://docs.smartthings.com/en/latest/smartapp-developers-guide/routines.html#routine-events

* in a “few weeks” :slight_smile:

9 Likes

Awesome! x 1000 :smile:

Groovy newb here, and trying to take advantage of this. Initially just toying around with the sample code in the Routines chapter. So I subscribe to routine executions, and run through the simulator (while executing the routines in the SmartThings app) and it works fine. I publish the SmartApp to my hub and do the same thing and… nothing. So just to make sure I’m doing this right, I also subscribe to location changes. Then publish the SmartApp to my hub, execute “Goodbye!” and “I’m Back!” a few times in succession, and get log entries for the location change, but again, not the routine executing. Try it in the simulator again and get log entries for both. Seems like the routine execution events aren’t working yet outside of the simulator? Am I missing something?

Note that I don’t want to be “that guy” but I’m pretty sure I’m “doing it right” and it is working properly in the simulator.

I’m not certain, but it sounds as though this has been documented, but not fully deployed.

That would be a first… Docs out before a feature. :smile:

It shouldn’t matter if it’s in the IDE simulator or not. I’ll look on Monday to see if there’s something else going on.

Can you post your code example? Are you using logging to see if the routine event handler is being called?

I’m not able to reproduce this (my event handler gets called both when simulated and in the mobile app), so maybe seeing/trying your example will help diagnose…

Thanks!

Jim,

It appears I’m “that guy” after all. I had done this with no preferences page, and some things were working and some weren’t. As to WHY that is the case with no errors, or why it worked differently in the simulator vs. the real hub, I couldn’t tell you, but… Once I coded the preferences page properly, I suddenly started getting the routine executions firing as well. Thanks so much!

@Jim a bit of a bug here:
According to the docs

// descriptionText will be the name of the routine
// e.g., “I’m Back!” or "Goodbye!"
log.debug "evt descriptionText: ${evt.descriptionText}

However in reality what I see is:

Disarm Security And Turn Off Alarm was executed

It is adding a “was executed” to the end of the name which is throwing the app off while comparing what routine was executed against the user selected routine.

@Jim however using

evt.displayName

works perfectly and it returns the name of the routine that was executed. I think the docs may need to be updated or the functionality corrected. Please let me know which one you decide on so I can update the app accordingly thereafter.

Thanks @RBoy! The docs have been updated.

1 Like