Activating a scene from code?

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.

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.

1 Like

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

1 Like

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.

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.

thank you.

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

1 Like