Can we activate a scene in WebCoRE using new ST app?


#1

1) Give a description of the problem
I want to handle a button or a switch in webCoRE, then as my action, activate a SmartThings Scene. I don’t see a way to activate a SmartThings scene, and I’m aware that the API doesn’t expose that feature.

2) What is the expected behavior?
When I activate a button or switch, I want my piston to activate a ST scene.

3) What is happening/not happening?
“Activate scene” isn’t an option for an action.

I’ve read other posts that suggest creating “routines” for each scene, this activate the routine in order to activate the scene. That would be fine, but I’m pretty sure that’s only for the Classic ST app. When I bring up the list of routines in WebCoRE, I only get the built-in routines from the classic app, not the new automations I created in the new app.

Any suggestions?


Scenes as Triggers
#2

You can use the new smarthings REST api. You just need to get a personal token, and then you can send a webrequest from webcore. I just tried it out and it works ok. Instructions are here:


#3

Can I see a piston example of this? (Without showing new your token key of course)


#4

So this is going to be very minimal.

  1. go to https://account.smartthings.com/tokens and generate a token, copy the token value somewhere.

  2. Download and install “Postman”

  3. in Postman
    a) click “New request”
    b) select GET, then enter: https://api.smartthings.com/v1/scenes
    c) click the “Authorization” tab bellow
    d) from the TYPE pull down menu, select “Bearer token” and paste the token value in the Token field
    e) click “Send”
    f) you should now see a list of all your scenes
    g) copy the “sceneId” from the scene you want to activate

  4. in Webcore
    a) create new piston
    b) under execute/location/Do, select “Make a web request”
    1) for “value” enter: https://api.smartthings.com/v1/scenes/{sceneId}/execute
    2) Replace {sceneId} with your “sceneId” from step 3
    3) For “Method”, select POST
    4) for “Authorization header (optional)”, select “Value” and enter: Bearer Your_Token_value_here
    5) save and test, this should activate your scene


#5

An alternative to 3) is to go to the IDE (account.smartthings.com), select your Location, and then ‘List Scenes’ to see the IDs.


#6

Does this still work? I keep getting an error every time. I’ve tried a number of different settings for the web request and get the same response every time. I even generated a new token to make sure the one I had was valid.

Error executing external web request: groovyx.net.http.HttpResponseException: Unauthorized

No motion for 30 minutes then do
#7

This is how I created the web request to execute the scene when I did it:

scenetask

I used two variables. One is the scene ID, which is a UUID/GUID, and is most easily found from the IDE (account.smartthings.com) by using ‘List Scenes’ on your location. The other is the personal access token, again a UUID/GUID, which you get from account.smartthings.com/tokens, choosing the Scenes scope.

A simple alternative way to execute a scene is to create a virtual switch and then build an automation in the new app that executes the scene when that switch is turned on or off. Then you can just toggle the switch in webCoRE.


#8

Thanks! The "Bearer " part in the authorization header is the piece I was missing. Once I added that in it started working!

Any chance scenes will be natively supported in Webcore so I don’t need to jump through these hoops?


#10

Is there a way in WebCore to have an IF XX scene is run THEN YY ?


#11

If you use the virtual switch method that @orangebucket suggested above, then, yes. You can check if a virtual switch that is associated with your scene has been switched. Now, as far as confirming that a scene has been executed, not sure about that one.


#12

Ten hours later, it is also a challenge to determine the current scene as well…
(since they can be activated in various ways)


#13

Great! Thanks!