Go to Body Go to Navigation

Quickstart: Create a light bulb plugin for the Samsung Connect app

This tutorial demonstrates how to create a light bulb plugin controlled by the Samsung Connect app. With this plugin, you can control various capability properties, such as dimming the bulb or turning it on and off.

In the Samsung Connect dashboard, the plugin will look similar to the image below:

Light bulb Card

With this tutorial and the SmartThings SDK, you will:

  • Identify your light bulb capabilities.
  • Choose the light bulb’s main state and action. These are displayed the Samsung Connect app dashboard.
    • Main state: the information a device can provide, for example if a device is on or off.
    • Main action: what control command(s) are available, for example, to turn a device on or off.
  • Use a simulator to test your light bulb. This emulates the relationship between the Samsung Connect app and a virtual IoT device.

Prerequisites

  • Samsung Account: Required to access the SmartThings Developer Portal, to use Samsung Connect, and to manage SmartThings plugin projects.
  • SmartThings SDK: Downloaded from the web-based Developer Workspace, this SDK includes the following:
    • IDE: An add-on 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: This is software version of an actual IoT device that is used to receive commands from the Samsung Connect app. Use it to check the effect of Samsung Connect actions on an IoT device.
  • SmartThings Certificate You may need to sign your plugin with a SmartThings certificate before you can test or publish it on a device. See About Common Tools for more information.

Log into Samsung Account

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

  1. Run Atom. The SmartThings IDE features are then available for use.
  2. From the SmartThings ribbon menu, select Samsung Account Login. This option can also be found under Packages > SmartThings > Log in.

    Samsung Account
  3. Log into your Samsung Account.

Create a project

Use a project to manage the code associated with your light bulb plugin.

  1. From the SmartThings ribbon menu, select New Project.

    New Project
  2. Click Cloud-connected Device.
  3. Enter these values:
    • Project Directory: C:\SmartThings Projects.
    • Project Name: My LightBulb.

      Create Project
  4. Click Next.
  5. Next to Device Profile List, click +.
  6. Enter these values:
    • Device Profile Name: My Lightbulb Profile
    • Vendor ID: MyBulb
  7. To add a switch, use the Capabilities menu: Select switch > main > x.com.st.powerswitch then click +.
  8. In the upper-right corner, click Add.
  9. Select your new profile in the Device Profile List and click Next.

    Create Project
  10. In the Select a Generation Type window, under Dashboard Main State, select:
    • Capability: switch
    • Component: main
  11. Under Dashboard Main Action, select:
    • Capability: switch
    • Component: main
  12. For Custom Plugin Package, enter LightBulb.

    Create Project
  13. Click Finish. You have created a Device profile.

Your finished project page will look something like below:

Create Project

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

  • Manifest: This contains the UI and voice manifest files for the light bulb IoT device.
  • Plugin: This contains a web app that can be used for the light bulb. 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 Project

Test your light bulb

You can test your light bulb by creating a virtual device and simulator with the SmartThings SDK.

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 Light Bulb Profile.
    • Device Name: My Light Bulb.
    • Manufacturer ID Value is auto filled
  3. Click OK.

Launch the virtual device

  1. From the icon toolbar along the top, click Virtual Device.
  2. From the list of virtual devices, click LAUNCH under My Light Bulb.
  3. In the launched virtual device, next to Power Switch, click v to display its power state and action.

Launch the device plugin 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 > power to ensure it switches on.

plugin simulator

Display the log view

Use this to monitor diagnostic messages during testing.

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

See our section on the Logging tool for more information.

More tools

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.