Working with Scenes
With Scenes you can simultaneously set a group of devices to a particular state.
Scenes are different from Automations. For example, an Automation can be configured to "Notify me if a door opens when I'm not home." This Automation, when activated, will wait for the door to open when you are not home to notify you.
On the other hand a Scene can be configured as "Turn on my living room light, turn off my bedroom light, turn on my kitchen light, and set the brightness level and pick this color," and this Scene will set these devices instantly as soon as the Scene is activated.
Scenes do not have triggers; Automations do. Moreover, a Scene can be used as a part of an Automation. See Scenes in the SmartThings app.
Interaction with SmartThings Cloud
Use the Scenes API to work with Scenes.
Personal access tokens require Scenes scopes. See Authorization and Permissions.
Rate limits and guardrails apply for Scenes. See Rate limits.
Example with Postman
Make sure you have at least two bulbs paired to the SmartThings Hub in your account.
In this example we will create two Scenes using the SmartThings mobile app. Using Postman, we will list and execute these two Scenes with the Scenes API.
Using this guide, Scenes in the SmartThings app create two Scenes: one for turning ON both the bulbs at once, and the second Scene for turning OFF both the bulbs at once.
Install the Postman app and create a Postman account for yourself (a free account is sufficient for this example).
Obtain SmartThings personal access token
If you don't have it already, open your Samsung account.
Next, get a personal access token for calling the SmartThings API. You will use this as a bearer token in the Postman app. Go to the personal access tokens page and click on the Generate new token on top-right.
Make sure that you select Scenes > Read all scenes and Scenes > Execute all scenes for Authorized Scopes.
Get a list of Scenes
To get a list of Scenes you created, send a GET request to the
Start Postman. In the Authorization section of the Postman window, for the TYPE field, select Bearer Token from the drop-down menu list. This will display the Token form field on the right. Copy and paste here the personal access token that you generated above.
In the Postman window, select GET and type in the SmartThings API
In the response window of Postman you will see the two Scenes you created above. Make a note of the
sceneId fields of the two Scenes, as you will need them to execute these Scenes next.
Execute a Scene
To execute a Scene, send a POST request to the
- In the Postman window, select POST and using the
sceneIdof the Scene that turns ON both the bulbs instantly, type in the SmartThings API
You will see that the two bulbs are turned on.
Next, turn OFF the bulbs using the
sceneId of the Scene that turns OFF the bulbs.