FAQ: Getting Started with the new Rules API

is anyone know if it would be possible to install webcore elsewhere (rasberry pi or something) and then link it to devices ?

The easiest way I think would be to run webcore on Hubitat and then use something, maybe MQTT, to connect back to smartthings if that’s what you want.

Webcore has its own forum, you can check there to see what people are planning to do.

And here’s a new project which will provide MQTT integration with the new smartthings architecture.

Integration Solutions using MQTT

I know where to make the WebCore pistons but I have no idea where the rules api code goes. Where is a simple explanation for how to put a rules api function into my hub.

I cannot believe that I cannot find this. Why?

Please post the links.

Introduction to RulesAPI
Create Automations via computer - Apps & Clients / Features & Feedback - SmartThings Community

Thanks for pointing me to something that will work. But yikes, there is no GUI like we have now to review our code and update it? And it looks like that is a community built CLI. What?

This was announced very close to THREE years ago and there is not a better implementation? Wow. Is this why Adrian (WebCore guy) left?

Thanks again TapioX.

1 Like

There is. Routines in the mobile app is a GUI for the Rules API. Limited? Yes, but still a GUI. What we haven’t seen is a complex rule building GUI for Rules API.

In the Community forum Developer Programs > Tutorials you can find step-by-step guides to create several things, for example, an Edge driver, ST Schema, Rules and others:

Edge Drivers (Zigbee)

I’ll create a report so those links are included in the developer documentation.


I think that is ok and please do it. What would be more helpful is a dedicated page that says, “You used to use WebCore, this is how you use the Rules API”. This page would have all the basics to get going. A short tutorial on setting up the environment (e.g. community (very weird) CLI and VS Code and etc) and how to get your code to work in a similar manner. For example, 1_ This is how to turn on a light when a switch is turned on. 2_ This is how to make something happen when it is 22 minutes before sunset. ← maybe these would be links to examples that exist.

I have code that goes out to a URL and parses the return to then call VoiceMonkey (another external site). If you could do a sample like that; bonus.

I do not see many people that haven’t used WebCore now deciding they are going to ramp up on Lua. Maybe later.

The thing I was missing in a big way was how do I get the code into the hub but I am sure I will find other obstacles that have already been figured out but are all over the place.


1 Like

There’s also a repository where there are several Rule examples just for you to copy, replace the corresponding IDs and save them.

Where there’s another tutorial using Postman (which avoids the usage of a text editor), the CLI is a tool that helps you interact with the ST API from the console, but, you can send direct commands to the API, this means you can create them from other integrations that you develop, you would only need to make the corresponding HTTP requests.

Creating an app to consume the ST API directly would help you solve your issue with the requests to the URL because currently, the Rules API doesn’t support requests to URLs.
Or, as WebCore already lets you make calls to external URLs, depending on your automation, you could send the corresponding commands to your ST devices, but, that integration would be hosted in the Cloud. For this you would only need:

  1. A Personal Access Token that you’ll need to use in the authorization header of the HTTP request
  2. Point to the correct ST API endpoint. For example, this is the URL to send a command:


    "commands": [
            "component": "main",
            "capability": "switch",
            "command": "on",
            "arguments": []

Lua (Edge drivers) is for device integrations, not automations. If you create a device using the driver, you can set up certain schedules, actions that help you automate its behavior but it won’t allow you to modify the one of external devices.

As you can see, I have not been keeping up with this change as it didn’t seem to be coming soon.

Thanks for the information you have provided so far and please make a page for the many people that will be coming from WebCore to Rules API and ST API soon.

1 Like

I think it would benefit non developers to have a more straight forward step by step tutorial with more basic instructions than having to click link after link and getting confused. I’m sure the documentation is easy enough for people who know what all the terminology means but for those who want more powerful rules but are not developers it is just overwhelming confusing!


I’ve always preferred to use automated APIs because they are simpler and more understandable. Maybe it is not really professional, but that makes my work easier and helps me solve the tasks I was assigned faster.

Does anybody have a quick solution for doing a rules api condition of between two times? For example, I want to have the IF use BETWEEN for 5am to 30 minutes after Sunrise. I know that BETWEEN uses “VALUE”, “START” and “END” but i’m not sure how to put the TIME object in that sequence. Normally you would specify the value you want in the END and then just use a string or integer in the other two, but i’m not sure how that would work when dealing with time objects. Thoughts?

In YAML it would look like:

        - between:
                reference: Now
                reference: Noon
                    integer: -7
                  unit: Hour
                reference: Sunrise
                    integer: 30
                  unit: Minute
1 Like

Interesting. Why the NOW reference in the between section?

A between is testing if value is between start and end. In this case we are dealing with times and in Rules times are defined in terms of a reference and an offset. As we are interested in comparing the current time at the moment the Rule is executed the appropriate reference is Now. As an aside you could apply an offset so you could effectively say ‘ten minutes ago it was between …’ or ‘in thirty seconds time it will be between …’. It probably doesn’t gain you anything but it is fun.

You might like to keep an eye on the sunrise time if your rule runs in the cloud. For the last year I’ve had a bug with sunrise and sunset not updating daily in cloud based rules.

Got ya. Simple answer- comparing current time to beginning and start times of condition. Thanks!!

Indeed, so I thought I’d dress it up a bit for those who haven’t encountered the Rules way of handling times.


Very much appreciated!

I would like to know if someone could tell us what is needed to be done to brings webcore on the new api? Could it be store locally? is it just to translate the smart apps in lua? I mean we see that the cummunity should do the conversion but we just dont know what to do and where to start… If it could be possible to have a kind of explannation list or something, so we could check the duty…

1 Like