SmartThings Community

Activating a scene from code?


#1

I apologize if this is somehow obvious but I cant find any code examples for running SmartThings Scenes. I keep finding older posts about Scene Machine but nothing about running SmartThing defined scenes.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #3

You can’t call a Classic Scene directly (there is, but you can no published API), but you can call a Routine; so you just need a Routine (which can activate a Scene) for each Scene.


#4

Scenes API is released and you can add it in your smartapp.


(the rooms manager guy) #5

so only way to get scenes list and execute a scene is thru POST … there is no groovy method like location.getScene(…) or location.executeScene(…)?

thank you.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #6

Only for Classic Routines (aka “Phrases”), not Scenes.

Routines are deprecated in the new App (and new API, I presume). But you’re using the classic Groovy API…

Since many customers still use the Classic App, my advice to you is to make your SmartApp compatible with Routines, since the customer can trivially have a Routine call a Scene.


(the rooms manager guy) #7

thank you.

yes my rooms app already supports executing routines … just checking to make sure i wasnt missing anything in invoking scenes directly.