Learn how to create an M2X Device using the M2X Developer portal.
Creating a Device
A Device is the collection of data Streams, metadata and location for a given data source.
Navigate to the Device dashboard and select “Create Device” and complete the device creation form:
Device Name : a plain text name to identify this device
Device Description (optional)
Tags : metadata that can be used later on as a search criteria when browsing your devices
Visibility : A device with Private visibility can only be accessed using API keys, while data associated with Public devices can be retrieved without an API key
Once the form has been completed, select “Create” to create the device.
Once the device has been created you’ll be navigated to the device's detail page. Here you will find the Device ID and Primary API Key which are used when making API requests involving this device.
Adding Streams to a Device
A Stream is a set of time series datapoints from a specific data source, such as a device sensor collecting temperature readings.
To add a Stream to a Device, navigate to the device from the Device dashboard, select “Add Stream”, and complete the stream creation form:
Stream ID : a plain-text identifier for the stream which will be used when making API requests that involve the stream
Stream Type : the type of data that will be pushed to the stream, either Numeric or Non-Numeric
Unit of Measure : (optional) the unit of measure applicable to the stream values
Once the form has been completed, select “Save” to add the stream to the device.
Now that there is a Stream associated with your device you can start pushing data to the device using the Device ID, API key and Stream ID.
A Trigger monitors a stream of data in real time and when the trigger condition is met the trigger fires an HTTP POST request to a callback URL specified in the trigger settings.
To add a Trigger to a Device, navigate to the device from the Device dashboard, select “Triggers”, then “Add Trigger”, and complete the trigger creation form:
Name : a name to identify the trigger
Stream : the stream this trigger will be monitoring, note that triggers can only be applied to numeric streams
Condition : the condition that must be met before the trigger fires
Threshold Value : the value that the condition is dependent on
Callback URL : an HTTP POST request is sent to this URL whenever the trigger is fired
Once the form has been completed, select “Save” to add the trigger to the device.
Logging Device Location
To log a Location for your Device, navigate to the device from the Device dashboard, select “Location”, then “Add Location”, and complete the Add Location form:
Location Name : a name to identify this location
Search Location : if you don’t know the location particulars you can search for a location or choose “My Location” to obtain the latitude and longitude values for your current location
Latitude : the latitude value for the device’s location
Longitude : the longitude value for the device’s location
Elevation : the elevation value for the device’s location
Once the form has been completed, select “Save” to add the device location.
Device Onboarding via The API
All of the device onboarding functions described above can also be performed by making requests to the M2X API. For a detailed look at the API calls for managing devices review the Device section of the API documentation or check out the API Command-Line Cheatsheet.