Define a Device

Add a Device to the Collection

Things represent the entities in your world, for example your computer. You can create a Thing using diverse methods, as highlighted in the image below. You can get more information in Online Help. For this training we will create a Thing from scratch, that is, using Option A highlighted in the image below.



Figure 1.
  1. To add a Thing, in the top right corner of the web editor, click + New Thing .


    A new window opens, labeled New Thing.


    Figure 2.
  2. In the dialog, enter the Thing name as Laptop and add a description.
  3. Click Create.
    The Laptop Thing will be added in the Things tab of AnythingDB.


    Figure 3.

Add Thing Properties

Properties define the attributes that should be expected for a given entity in the real world. These are important attributes that must be set to continue with the tutorial.

You can add a Thing manually using the steps below, or choose to upload a schema instead.

  1. Click the Laptop Thing to add Properties.
    The Details tab appears, which includes Overview, Properties, Actions, and Events.
  2. Add a new Property by clicking the plus icon in the Properties section.


    Figure 4.
    The New Property dialog opens.
  3. Set the following:
    1. Property Key as computerType
    2. Type as String
    3. Initial values as either Windows or Mac
    4. Optional Descriptors as Computer Type


    Figure 5.

Upload a Schema

You can build your schema in another program and upload it to SmartWorks IoT.
  1. To upload a schema for a new Thing, in the top right corner of the editor, click + New Thing .


    The New Thing dialog opens.
  2. Click Skip to Schema.
  3. Copy the following code into the section and click Save.
    {
    	"actions": {},
    	"description": "This is a standard description for a Laptop. ",
    	"events": {},
    	"properties": {
    		"color": {
    			"title": "Computer color",
    			"type": "string"
    		},
    		"computerType": {
    			"title": "Computer Type",
    			"type": "string"
    		},
    		"computerstatus": {
    			"title": "Computer Status",
    			"type": "string"
    		},
    		"cpu": {
    			"title": "CPU",
    			"type": "number",
    			"unit": "%"
    		},
    		"disk": {
    			"maximum": 100,
    			"minimum": 0,
    			"title": "Disk",
    			"type": "number",
    			"unit": "%"
    		},
    		"latitude": {
    			"maximum": 180,
    			"minimum": -180,
    			"title": "Latitude",
    			"type": "number",
    			"unit": "º"
    		},
    		"longitude": {
    			"maximum": 180,
    			"minimum": -180,
    			"title": "Longitude",
    			"type": "number",
    			"unit": "º"
    		},
    		"memory": {
    			"title": "Memory",
    			"type": "number",
    			"unit": "%"
    		},
    		"owner": {
    			"title": "Owner",
    			"type": "string"
    		},
    		"statecpu": {
    			"type": "string"
    		}
    	},
    	"title": "Laptop"
    }
    The Thing is created.