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.
Let's get started!
Creating a new device type
Follow the steps given below to create a new device type via the console:
- Sign in to the WSO2 Device Management Console.
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.xmlfile, you will only have the Android, Android Sense, and Windows device type by default.
Enter the details to add a new device type and click Add Device Type.
Name The name of the device type you are creating. Description A small introduction on your device type. It should not be very long. Push Notification Transport The 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.
Features Feathure 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 name Provide 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 code Provide the code to trigger the device operation. For example, ring is used as the code to trigger the fire-alert operation. Feature description Provide a description of the device operation.
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.
Create the event stream to gather the sensor readings or data from the device and click Add.
Transport The transport that needs be used by the server to communicate with the device. Event attributes Define 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 name The name of the event stream that needs to be created. Event data type The type of the data that is gathered by the event stream.
- 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:
- On the Enroll Device page, click on your device type.
- Click + Create Device.
- 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.
- 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.