This documentation is for WSO2 IoT Server 3.1.0. View the documentation for the latest release.
Creating a New Device Type via the Device Management Console - IoT Server 3.1.0 - WSO2 Documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                   
||
Skip to end of metadata
Go to start of metadata

In this tutorial, you are going to create a new device type, enroll a new device using the device management console and start using the device.

 

Before you begin

You need to start the WSO2 IoT Server core and analytics profiles.

cd <IOTS_HOME>/bin  
------Linux/Mac OS/Solaris ----------
./iot-server.sh
./analytics.sh
  
-----Windows-----------
iot-server.bat
analytics.bat

Let's get started!

Creating a new device type

Follow the steps given below to create a new device type via the console:

  1. Sign in to the WSO2 Device Management Console.
  2. Click Add under DEVICE TYPES.

    WSO2 IoT Server has the Android, Windows, Raspberry Pi, Arduino, Android Sense and iOS sample device types by default. If you have not run the <IOTS_HOME>/samples/device-plugins-deployer.xml file, you will only have the Android, Android Sense, and Windows device type by default.

  3. Enter the details to add a new device type and click Add Device Type.

    NameThe name of the device type you are creating.
    DescriptionA small introduction on your device type. It should not be very long.
    Push Notification TransportThe communication method the server needs to use to send messages to the device.
    • If you select NONE, there will be no transport method implemented for the server to communicate with the device.
    • If you select MQTT, the MQTT transport is extended for the server to communicate with your device.
    FeaturesFeathure refers to the operations or functions your device can perform. For example, if your device is a fire alarm, it needs to ring when the temperature rises too high. You can add more than one feature by clicking the + button.
    Feature nameProvide a name for the device operation.This name is used to identify the device operation.
    As per the above example, the feature name would be fire-alert.
    Feature codeProvide the code to trigger the device operation. For example, ring is used as the code to trigger the fire-alert operation.
    Feature descriptionProvide a description of the device operation.

    Attributes

    The attributes unique to the device. You can add more than one attribute by clicking the + button. For example, a fire alarm will be placed in a specific building and a specific floor. Then the building_ID and the floor_ID will become it's attribute.

    Let's look at another example. If your device type is a car, the make and the year of manufacture will be the device's attributes.

  4. Create the event stream to gather the sensor readings or data from the device and click Add.

    TransportThe transport that needs be used by the server to communicate with the device.
    Event attributesDefine the attributed of the event stream that needs to be created to gather the data from the device.
    You can add more than one attribute by clicking the + button.
    Event nameThe name of the event stream that needs to be created.
    Event data typeThe type of the data that is gathered by the event stream.

  5. Your device type is successfully created. Click Go To Enrollment Page to start enrolling a new device for the device type you created.

Enrolling a new device

Follow the steps given below to enroll a new device for the device type you just created:

  1. On the Enroll Device page, click on your device type.
  2. Click + Create Device.
  3. Enter the details to create the device and click Create Device. The details that need to be entered varies based on the attribute values you defined when creating the device type
    For example, when creating the fire alarm, the Building_ID and Floor_ID were added as attributes. Therefore, you need to enter the values when creating the new device.

    A JSON file containing the client_ID and client_secret key downloads. You can carry out various operations on the device via APIs. For more information, see Try out more operations.
    Or go to the devices page and carry out operations on the device. The operations that are there are the features you defined when creating the new device type.

What's next?

  • Want to see other ways you can write your device plugin? See Writing Device Plugins.
  • Haven't written APIs yet for your device? See Writing Device APIs.
  • Have you tried adding a UI for your device type? See Writing UI Extensions.
  • For the device type you created to work, you need to have a physical device and an agent running on it. You can configure it to meet your requirements or take a look at sample implementations that is explained under Writing Device Agents.
  • Write the analytics extensions for your device type. For more information, see Writing Analytics.
  • No labels