How to execute a scene from a rule?

I found quite a number of examples how to create a JSON rule to run a command on a device which basically looks like that

        "command": {
           "devices": [
              "GUID"
           ],
           "commands": [{
              "component": "main",
              "capability": "switch",
              "command": "off"
           }]
        }

How to execute a scene instead?

Hi, @alex.49.98!
Up to now, it is not possible to execute scenes using the Rules API but remember that “then” is an array so it can include several instructions to execute.

Can you still use the old trick of having the rules API recipe turn on a virtual switch, and then having an automation activate the scene whenever that virtual switch comes on? :thinking:

Obviously it’s more steps, but is it doable?

Yes, it is possible. You can use the Edge device of the Hello World sample to do so

1 Like

Or if you are using the Android app, you could just use the virtual switch creator in smartthings labs to create a virtual switch, yes? That would be quite a bit easier for people who are not using Edge Drivers yet. :sunglasses: but I don’t believe that’s available in the iOS version at this time.

Here’s a good third-party video on that process: