FAQ: Getting Started with the new Rules API

Does anyone know where to find the appropriate instructions for installing node red and studio automation? I found them two months ago, and installed everything but did not have the time to really play with it. I had it working but I rebuilt my rpi for a temp project and now trying to set it up again but can not get it working. Half the links are no longer valid in this thread and the Samsung developers documentation site just loops to an invalid page so now I am stuck. I have the correct version of node red but I seem to remember there might have been a specific version for nodejs. Installing studio automation just errors out but again, I am stuck. Nothing on the GitHub page that offers any help.


A post was split to a new topic: [Rules API] Issue executing a Rule

As function ideas, just all those function in webcore. Been able to run automation from outside with url (like we can do with pistons), have some variable that we could manage and use (local inside rules and global that each rules would access), been able to make web request (outside lan) and all other $twc weather channel and so… Also those expressions that can evaluate a lot of things (words in sentence, replacing character…etc).
Webcore is able to run locally so why dont just find a way to turn pistons into json directly? So you get all webcore functions and you can devellop new one with the api…

WebCore is a third-party app, so, there’s no “translation” tool for this.

We appreciate your comments to improve the Rules API features. I’ll open a report for this so the team is aware of the requirement (Just a heads up, having a feature request doesn’t guarantee it will be approved).

In the meantime, we can create our own integrations which would consume the Rules API or the ST API in general.
For example, a NodeJS express app would allow us to make HTTP requests and use functions to compare if a string contains a specific text, replace characters, etc.

Thanks for that! I hope that they could do something because webcore have a great and easy interface and each pistons can be called from url… If similar tool is supplied it would be nice.

I know its a 3rd party app but I saw a demo video where they got a json file directly while building piston in webcore… that mean the integration is not so far. As hubitat use webcore locally is it possible to install it locally on ST hub or to turn it into a driver or something? If we look at those 2 things: 1- install it locally 2- get json output
Its very close to something. For my part, I appreciate that everything goes locally but if some things cannot I better like to have those possibility on a cloud or directly inside a phone (apps) or computer even if its little slower. With a driver it could send http get to run the piston and get a state list to be apply to devices so at least we could run webcore on the side.
For now, can you give us a cue on where they are with this api and other tools? Is it simple automation or if they are close to the top? Its hard to see what ll happened at the end of the next month!
Thanks again! (sorry if I m on the field with some understanding but I try to understand and figured out things for personnal knowledge and to be able to find solutions…)

1 Like

It you extended Routines to support a sequence of nested if-then-else groups, each with nested and-or condition, plus a sleep action, you’d pretty much have the current functionality of the Rules API. Actually you’d have more because Routines have access to as yet undocumented Rules.

No loops, no variables, no functions and none of the TCP/TSP/TEP cleverness.

WebCoRE pistons are effectively event handling scripts. Indeed I think webCoRE functionality would best be reproduced by writing SmartApps in a general purpose programming language, though you wouldn’t get the local execution (but you don’t have it now).

To me Rules feel more like a mesh of binary operations that are constantly being updated with the result bubbling up to the top and a ‘trigger’ just meaning that the conditional actions are activated at that point. Something like Smart Lighting on steroids. If you have ever watched the live logs for that you can see the restrictions are constantly being updated even though there haven’t been any trigger events.

That’s just how it feels to me. It is likely drivel.

Rules can be activated by an HTTP request.

So I think that I ll wait to see because I like ST but I I think that I wont be able to do nothing after the lost of groovy and the chance are that I leave to hubitat… Pretty frustrating that something that works flawlessly is being updated with something that offer no flexibility… I was thinking of a both local and cloud system where all functionallity would be there and you try to transfer all of that local through time to be able to stop the cloud… kind of desapointing!

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?