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).
custom automation creator and smart lights in the new app can both activate scenes.
The smart lighting app can activate scenes as well
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!
Thank you!
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?
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.
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.
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.
Yup - use the virtual device creator smart app. I don’t know where that app came from - it just showed up one day.