# Trigerring a Scene from SmartApp

**URL:** <https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930>\
**Category:** SmartApps & Automations\
**Tags:** scenes\
**Created:** [February 27, 2019, 11:02pm UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930 "2019-02-27T23:02:37Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![crimson](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@crimson](https://community.smartthings.com/u/crimson)\
**Post date:** [February 27, 2019, 11:02pm UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/1 "2019-02-27T23:02:38Z")

</div>

Is it possible to trigger a Scene from SmartApp code and if yes how?

---

<div class="post-metadata">

**Author:** ![tgauchat](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/tgauchat/32/49516_2.png) [@tgauchat](https://community.smartthings.com/u/tgauchat)\
**Post date:** [February 27, 2019, 11:09pm UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/2 "2019-02-27T23:09:14Z")

</div>

> [@crimson](#):
>
> Is it possible to trigger a Scene from SmartApp code and if yes how?

In the Classic API / Groovy API, you can’t activate a Scene directly, but you can execute a Routine. The user can create a very simple Routine that just activates a Scene (i.e., create one Routine for each Scene). It works fine.

In the new API there will (is?) be a way to activate Scenes directly. See the new developer documentation on the Samsung website (don’t ask me how to find it … use the search button).

---

<div class="post-metadata">

**Author:** ![Automated\_House](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/automated_house/32/99641_2.png) [@Automated\_House](https://community.smartthings.com/u/Automated_House)\
**Post date:** [February 27, 2019, 11:11pm UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/3 "2019-02-27T23:11:24Z")

</div>

custom automation creator and smart lights in the new app can both activate scenes.

---

<div class="post-metadata">

**Author:** ![sidjohn1](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/sidjohn1/32/16652_2.png) [@sidjohn1](https://community.smartthings.com/u/sidjohn1)\
**Post date:** [February 28, 2019, 12:08am UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/4 "2019-02-28T00:08:49Z")

</div>

The smart lighting app can activate scenes as well

> **[Scenes in the SmartThings Classic app](https://support.smartthings.com/hc/en-us/articles/115004258063-Scenes-in-the-SmartThings-Classic-app)**
>
> Scenes in the SmartThings Classic app lets you set the mood in your home by instantly activating customizable lighting actions for multiple lights at once. Use Routines to activate a Scene when the...

---

<div class="post-metadata">

**Author:** ![crimson](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@crimson](https://community.smartthings.com/u/crimson)\
**Post date:** [February 28, 2019, 1:20am UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/5 "2019-02-28T01:20:02Z")

</div>

> [@tgauchat](#):
>
> but you can execute a Routine. The user can create a very simple Routine that just activates a Scene

That’s perfect. I can setup in the Routine everything I need; don’t need the Scene there. I only need to figure now how to execute a Routine.  
Thank you!

---

<div class="post-metadata">

**Author:** ![tgauchat](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/tgauchat/32/49516_2.png) [@tgauchat](https://community.smartthings.com/u/tgauchat)\
**Post date:** [February 28, 2019, 5:02am UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/6 "2019-02-28T05:02:39Z")

</div>

> [@crimson](#):
>
> I only need to figure now how to execute a Routine.

[https://docs.smartthings.com/en/latest/smartapp-developers-guide/routines.html#execute-routines](https://docs.smartthings.com/en/latest/smartapp-developers-guide/routines.html#execute-routines)

---

<div class="post-metadata">

**Author:** ![crimson](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@crimson](https://community.smartthings.com/u/crimson)\
**Post date:** [March 1, 2019, 3:24am UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/7 "2019-03-01T03:24:00Z")

</div>

Thank you! 🙏

---

<div class="post-metadata">

**Author:** ![kewashi](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/kewashi/32/77017_2.png) [@kewashi](https://community.smartthings.com/u/kewashi)\
**Post date:** [July 30, 2020, 10:22am UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/8 "2020-07-30T10:22:05Z")

</div>

I’m re-opening this old thread because once an account is migrated the ability to create routines is lost so new scenes can’t be run. God rest Terry’s soul…

So a workaround is to use a virtual momentary switch that triggers a scene using the new app. Haven’t tried it but pretty sure it will work. Has anyone else tried any different and perhaps more elegant workaround?

---

<div class="post-metadata">

**Author:** ![orangebucket](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/orangebucket/32/81590_2.png) [@orangebucket](https://community.smartthings.com/u/orangebucket)\
**Post date:** [July 30, 2020, 11:02am UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/9 "2020-07-30T11:02:10Z")

</div>

> [@kewashi](#):
>
> So a workaround is to use a virtual momentary switch that triggers a scene using the new app. Haven’t tried it but pretty sure it will work. Has anyone else tried any different and perhaps more elegant workaround?

A variation on that is a virtual switch and an Automation that triggers on changes to either on or off. A completely different alternative is to just activate a scene using the REST API, but for legacy SmartApps that could be considered as more trouble than it is worth.

---

<div class="post-metadata">

**Author:** ![kewashi](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/kewashi/32/77017_2.png) [@kewashi](https://community.smartthings.com/u/kewashi)\
**Post date:** [July 30, 2020, 4:58pm UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/10 "2020-07-30T16:58:31Z")

</div>

Thanks… I ended up doing this using virtual switch devices and automations. In the automation I trigger the scene and then with a 10 second delay I turn the virtual switch back off - effectively making it act like a momentary button. I went this route because virtual switches use the new native handlers instead of the legacy groovy DTH and I’m slowly working my way to wean my ecosystem off the groovy platform. This approach works beautifully.

---

<div class="post-metadata">

**Author:** ![JDRoberts](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/jdroberts/32/56577_2.png) [@JDRoberts](https://community.smartthings.com/u/JDRoberts)\
**Post date:** [July 30, 2020, 5:24pm UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/11 "2020-07-30T17:24:14Z")

</div>

> [@kewashi](#):
>
> because virtual switches use the new native handlers

Which virtual switches are these? Do you just create them from the IDE like on the old platform? I’m still getting used to all of this. 🕶

---

<div class="post-metadata">

**Author:** ![kewashi](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/kewashi/32/77017_2.png) [@kewashi](https://community.smartthings.com/u/kewashi)\
**Post date:** [July 30, 2020, 8:55pm UTC](https://community.smartthings.com/t/trigerring-a-scene-from-smartapp/155930/12 "2020-07-30T20:55:09Z")

</div>

Yup - use the virtual device creator smart app. I don’t know where that app came from - it just showed up one day.
