SmartThings Automation

Integrating SmartThing's automation requires an understanding of the SmartApp lifecycles and implementing its protocol. The SmartThings nodes provided in the Automation Studio allows you to wire installed devices to implement autorun rules without any code. Or simply deploying an Automation node that implements the SmartApp lifecycle without coding. Event nodes for device subscriptions, Status nodes for device status checks, and Command nodes for device commands are provided.

In general, the SmartThings Automation is designed in the following order.

  • Place the Device Profile node and determine the required capability.
  • Enter the web-hook URL through the Automation node.
  • After that, implement the logic that corresponds to the autorun rule.
    • You can read the state of the device through the Status node.
    • You can command the Device by placing an Command node.
    • You can extend the experience using external APIs.

Device Profile Node

This node represents an installed device. In this flow, You need to choose a device for automation. Event, Condition and Action nodes need to know which devices will subscribe to the SmartThings Cloud or commands. This node has a capability that represents a device feature. Find more information about the Capabilities of SmartThings.

Properties

- Name (Required)

A label of the Name assigned by the user. It is a unique name in the flow.

- Capability (Required)

The List of Capabilities provided by this Device. Determines if this Device supports the specified capability name.

Automation Node

This node represents the WebHook Endpoint of SmartApp. The Automation node handles lifecycles of SmartApp. A WebHook endpoint in this context is a web services application which can receive incoming HTTP POST requests.

Properties

- Name (Required)

A Name for the WebHook endpoint.

- Endpoint (Required)

An Endpoint that should be invoked during execution.

- Output

lifecyle Event Next node is the Event node only.

Event Node

This node is registered as a subscriber through the Automation Node. Must be used with Automation Node.

This node represents a change of device. Whenever a user installs a SmartApp, they typically will select the devices to be used on the SmartApp. The installed device interacts with this event node. When the device changes and an event occurs, the event node can receive the event as a subscriber.

Properties

- Name (Required)

The label of the Device assigned by the user.

- Device

The unique system identifier for this Device.

- Capability (Required)

The List of Capabilities provided by this Device. Determines if this Device supports the specified capability name.

- Attribute

The list of Attributes for this Device. Determines if this Device has the specified attribute.

Status Node

This node checks the status of the device. When a user installs a SmartApp, they typically will select the devices to be used by the SmartApp. This condition node interacts with the installed device. This node allows you to branch the flows based on the state of the device.

Properties

- Name (Required)

The label of the Device assigned by the user.

- Device

The unique system identifier for this Device.

- Capability (Required)

The List of Capabilities provided by this Device. Determines if this Device supports the specified capability name.

- Attribute

The list of Attribute s for this Device. Determine if this Device has the specified attribute.

Command Node

This node can commands to the device. When a user installs a SmartApp, they typically will select the devices to be used by the SmartApp. This action node interact with the installed device. The commands in this action node can change the state of the installed device.

Properties

- Name (Required)

The label of the Device assigned by the user.

- Device

The unique system identifier for this Device.

- Capability (Required)

The List of Capabilities provided by this Device. Determine if this Device supports the specified capability name.

- Attribute

The list of Attribute s for this Device. Determines if this Device has the specified attribute.

Properties

- Name (Required)

The label of the Device assigned by the user.

- Device

The unique system identifier for this Device.

- Capability (Required)

The List of Capabilities provided by this Device. Determines if this Device supports the specified capability name.

- Attribute

The list of Attributes for this Device. Determines if this Device has the specified attribute.

Example

It's a SmartThings Automation using ContactSensor and LIFX Bulb

Create a WebHook with Device Profile and Automation Nodes

  1. Add a device profile node for the ContactSensor with contactSensor capability.
  2. Add a device profile node for the Bulb with a switch capability.
  3. Add a node for the SmartThings Automation (webhook).
  4. Add an event node to subscribe to the ContactSensor change.
  5. Add status nodes to check the Switch is "Off".
  6. Add command nodes to change the Bulb to "On".
  7. Add command nodes to change the Bulb "Off".
  8. Save and Deploy

Register in SmartThings Developer Workspace

In order for SmartThings Automation to work, app-registration is required.

  1. Visit the SmartThings Developer Workspace.
  2. Create a new automation project.
  3. Register the SmartApp (WebHook Endpoint).
  4. Copy the WebHook Endpoint on the automation node.
  5. Complete the registration process.
  6. Next is to "Deploy to Test".

Install SmartApp in SmartThings App

Deploying your SmartApp to test does not mean your Service is published. When you deploy your Service to test, only the Samsung developer account used to deploy to test will be able to install the Service from the SmartThings app, and only after enabling developer mode in the SmartThings app.

test-your-device

After this, you can install the SmartApp that "Deploy to Test" above.