Creating a Device Class

This guide will help you introduce new device types to your project, unleashing greater potential for customization. The dashboard will help guide you as you create your new device class, and from-scratch configuration files will enable you to define your device class to your exact specifications.

Starting on the dashboard’s project homepage, click the Manage Device Classes “manage” button, and enter a name and device-type in the pop-up to begin setting up your new device class.

After you have clicked “submit,” you can find your new class in the “Class management” drop-down list, shown here:

../_images/ClassManagement.png

At this point, you will have created a device class. But the class you have defined is simply a shell, and without proper configuration files it will not be useful for you. Read on to learn how to develop device class configuration files and finish defining your device class.


Pairing the First Device of a Class

Plug your ULE dongle into your computer, and enter your Hub Client in the Terminal. Begin the registration mode in Terminal and then set your device to pairing mode, which will cause the device to pair with the Terminal, returning a “Device Registered” message. At this point you have paired your first device of this class, and have access to the information from your device. Now it is time to merge and complete the class you have made on the dashboard with the actual device you have paired with your dongle.

Configuring Your Device Class

To get started, you will need a templated device class configuration file in the .json format as an example to follow. You can find one on the bottom of this guide. On the page for your new class on the dashboard, scroll down and click “Add New Device Property” to create a new configuration file.

See also

If you want to manage the device classes that you already have, visit the “Device Management” guide in the Operational Guides section.

Below is a sample configuration file to help you develop your own device class configuration files.

Note

{

“mqtt”: {

“streams”: [{% for stream in streams %}
{“name”: “{{stream.id}}”, “version”: 0}{% if not loop.last %},{% endif %}{% endfor %}

]

},

“keepAlive”: {
“timeoutSeconds”: 430

},

“properties”:

[
{“name”: “device.localEvents”, “version”: 0}, {“name”: “device.storeAndForward”, “version”: 0}, {“name”: “device.groups”, “version”: 0}

],

“ipui”: “{{device.serialno}}”, “unit_types”: [0, 263], “name”: “smart_ac_plug”, “streams”: [

{
“name”: “on_off”, “streamId”: “{{ streamByName[“on_off”].id }}”, “event_interface_type”: 0, “event_interface_id”: 6, “event_unit_id”: 0, “event_data_array_index”: -1, “event_data_bit_mask”: -1, “event_data_signed”: false, “command_interface_type”: 1, “command_interface_id”: 512, “command_unit_id”: 1

}, {

“name”: “keep_alive”, “streamId”: “{{ streamByName[“keep_alive”].id }}”, “event_interface_type”: 0, “event_interface_id”: 277, “event_unit_id”: 0, “event_data_signed”: true, “event_data_array_index”: 0, “event_data_bit_mask”: -1, “event_sensitivity”: “1”

}, {

“name”: “power_meter”, “event_interface_type”: 0, “event_interface_id”: 768, “event_unit_id”: 1, “event_streams”: [

{ “attr_id”: 1, “attr_type”:”precision” ,”sensitivity”: “0.1”, “streamId”: “{{ streamByName[“energy”].id }}” }, { “attr_id”: 2, “attr_type”:”precision” ,”sensitivity”: “0.1”, “streamId”: “{{ streamByName[“energy_at_last_reset”].id }}” }, { “attr_id”: 3, “attr_type”:”time” , “streamId”: “{{ streamByName[“time_at_last_reset”].id }}” }, { “attr_id”: 4, “attr_type”:”precision” ,”sensitivity”: “0.1”, “streamId”: “{{ streamByName[“instantaneous_power”].id }}” }, { “attr_id”: 5, “attr_type”:”precision” ,”sensitivity”: “0.1”, “streamId”: “{{ streamByName[“average_power”].id }}” }, { “attr_id”: 6, “attr_type”:”u16” ,”sensitivity”: “1”, “streamId”: “{{ streamByName[“average_power_interval”].id }}” }, { “attr_id”: 7, “attr_type”:”precision” ,”sensitivity”: “0.1”, “streamId”: “{{ streamByName[“voltage”].id }}” }, { “attr_id”: 8, “attr_type”:”precision” ,”sensitivity”: “0.01”, “streamId”: “{{ streamByName[“current”].id }}” }, { “attr_id”: 9, “attr_type”:”precision” ,”sensitivity”: “0.1”, “streamId”: “{{ streamByName[“frequency”].id }}” }, { “attr_id”: 10, “attr_type”:”u8” ,”sensitivity”: “1”, “streamId”: “{{ streamByName[“power_factor”].id }}” }, { “attr_id”: 11, “attr_type”:”u16” ,”sensitivity”: “1”, “streamId”: “{{ streamByName[“report_inverval”].id }}” }

]

}

]

}