nayelyz
(SmartThings Developer Support)
August 30, 2022, 8:26pm
75
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)
Overview
For this tutorial, we will create an Automation using the Rules API to change a device’s color-based on the time of the day. This example Rule will use the Color Control Capability, which allows us to manipulate a color-changing device (e.g. a light bulb) by setting its hue, saturation, and other color attributes. A complete sample of this Rule is available in the SmartThings Developers Github repository .
Prerequisites
REST API client (such as Postman )
Personal Access Token (PAT)
Crafting Your Rule
Rule Conditions
For this example, we will change the light color when the device is turned ON between sunrise (start) and one hour after sunrise (end).
We will build the Conditions using an If action block starting with the logical operator and to include operations between and equa…
Advanced Rules API Tutorial
We will use the rules API to create a trigger that will evaluate a condition then schedule to evaluate that condition again after a defined period of time. This rule could replace SmartApps like “Notify Me When” that were previously complex groovy apps.
Requirements:
Postman
PAT Token
Getting Started
Open Postman and add your PAT token to the header
[image]
Refresher
If you are new to the Rules API, you will need to supply the locationId you want to work with for most requests
GET https://api.smartthings.com/v1/rules?locationId=yourID
Will return a list of your existing rules
Let’s Go
Use Postman in a new tab to GET some device IDs. You will need to get a contact sensor and a light bulb.
Once you have these, we are going to be sending a POST comman…
I’ll create a report so those links are included in the developer documentation.
2 Likes