Go to Body Go to Navigation

Quickstart: Integrate an IoT device

In fewer than 30 minutes, you can add an IoT device to a Samsung Connect app. Through the SmartThings SDK, you can quickly:

  • identify your IoT device’s capabilities
  • select the main state and action to show in the Samsung Connect dashboard
  • use simulators to test the interaction between your device plugin in Samsung Connect and a virtual IoT device

This tutorial will show how to add an air conditioner that can be remotely switched on and off from Samsung Connect. In the Samsung Connect dashboard, the device will appear as follows:

Air Conditioner Card

Prerequisites

  • Samsung Account: You use this to authenticate yourself in the SmartThings SDK and Samsung Connect app.
  • SmartThings SDK: Downloaded from the web-based Developer Workspace, this SDK includes the following:
    • IDE: An addon package for the Atom editor, this includes a graphical UI and lets you view the underlying code generated.
    • Plugin Simulator: Use this to preview the appearance of your IoT device within Samsung Connect, and to simulate actions on the app.
    • Virtual Device: Use this to check the effect of Samsung Connect actions on an IoT device.

Log into Samsung Account

Samsung Account provides an authentication token, which is stored by the SmartThings SDK.

  1. Launch the SmartThings SDK.
  2. From the SmartThings menu, select Login.
  3. Log into your Samsung Account.

Create a project

Use a project to manage the code associated with your IoT device.

  1. From the SmartThings menu, select New Project.
  2. Click Cloud-connected Device.
  3. Enter these values:
    • Project Directory: C:\SmartThings Projects.
    • Project Name: My Air Con.
  4. Click Next. This displays the Select a Device Profile page.
  5. Next to Device Profile List, click +.
  6. Enter these values:
    • Device Profile Name: My Air Con Profile
    • Vendor ID: MyCo
  7. Under Main, select these capabilities and click + to add them to the list:
    • switch (x.com.st.powerswitch)
    • temperatureMeasurement (x.com.st.temperature.measured)
  8. In the upper-right corner, click V.
  9. Under Main State, select:
    • Component: main
    • Capability: temperatureMeasurement
  10. Under Main Action, select:
    • Component: main
    • Capability: switch
  11. Click Finish.

Back in the main IDE window, the left pane shows a My Air Con folder with two sub-folders:

  • meta: This contains the UI and voice manifest files for the IoT device.
  • plugin: This contains a web app that can be used for the IoT device. If you simply use default capabilities, you will use a default plugin. You use this folder only if you want to customize a device’s UI and behavior.

Create a virtual device

This builds a plugin package for the IoT device, which installs with Samsung Connect.

  1. From the SmartThings menu, select New Virtual Device.
  2. Enter these values:
    • Device Type: Cloud-connected Device.
    • Select Profile: My Air Con Profile.
    • Device Name: My Air Con.
  3. Click Finish.

Display the log view

Use this to monitor diagnostic messages during testing.

  1. From the SmartThings menu, select Logger > Toggle Logger Tab.

Launch the virtual device

  1. From the icon toolbar along the top, click Virtual Device.
  2. From the list of virtual devices, click My Air Con.

Launch the app simulator

  1. From the icon toolbar along the top, click Simulator.
  2. In the Device Card, click the power button.
  3. Monitor the virtual device to ensure it switches on.

Next Steps

See how to add an IoT device using these tools:

  • Developer Workspace: You can also use the web console, without having to download an SDK.
  • JavaScript API : Use this if you want to fully customize the UI and behavior of the device plugin.