Devices
A Device instance resource represents a single device entity.
Resource Attributes#
| Attribute | Description |
|---|---|
| id | A 23 to 26 characters long string that uniquely identifies this device. |
| accountId | The unique id of the account that created this device. |
| name | Account wide unique, URL friendly name of the device. |
| friendlyName | Human friendly name of the device. |
| profileId | Id of the device profile that this device is generated from. |
| apps | Id list of the apps that this device plugged into. Can be empty. |
| description | Optional. Device description, maintenance notes, etc. |
| tags | Optional. Device tags. |
| status | Can be enabled, disabled and debug. All incoming and outgoing data are rejected for disabled devices. Disabled devices cannot connect to csipio via MQTT. Default value is enabled. |
| period | Number of seconds that is the expected reporting period of the device. This attribute helps csipio to determine whether a device is active and communicating as expected. 0 can be set to disable this feature. Default is 0. See predefined device profiles tutorial for advanced usage of this attribute. |
| customIds | Optional. Map of user defined identifiers. Supported custom id types are sn, mac, imei, and esn. |
| timezone | Optional. The time zone of this device to be used when visualizing device data. |
| annotateWithLoc | if true, each incoming data point is annotated with device location info. Default value is false. |
| annotateWithMeta | if true, each incoming data point is annotated with device meta data such as device profile tags, device tags, device class, product name, custom ids etc. Default value is false. |
| location | Optional. Location of the device. |
| locked | if locked, entity cannot be modified, deleted. |
| dateCreated | The date that this device was created, in ISO 8601 format. |
| dateModified | The date that this device entity was modified in ISO 8601 format. |
๐ง Rule#
Note that all custom ids are case sensitive. They must be account wide unique; otherwise device won't be located. Max length of a custom id value can be 64 ASCII character long.
๐ Tip#
debugstatus is a feature designed to provide more visibility into device backend's behaviour. When indebugmode, device backends log unexpected events such as data point rejections, out of bounds conditions, etc.
As its name suggests it should not be used in production due to performance implications. When set, the following internal errors and events are written into the device log:
- Data rejections caused by property type and boundaries
- Invalid / malformed data feeds
- Every web hook calls done by alert notification mechanism
- Provisioning attempts
- Errors related to methods
๐ Tip#
When
annotateWithLocattribute is true, all data points written by the device is automatically enriched by the device location at the server. This feature eliminates the need to set location information in each data point sent over wire and helps users to better control the size of the payload.
Create device#
POST https://api.csip.io/v3/devices#
๐ Creating multiple devices#
Simply make your request within an array element:
List devices#
GET https://api.csip.io/v3/devices#
cURL#
Node#
Ruby#
JavaScript#
Python#
๐ Filtering by CUSTOM ID and DEVICE NAME#
"Custom id" and "Name" filter always return single or no result. When mixed with other filters, other filters will be automatically ignored. Custom id value is always case sensitive; Name value is case insensitive.
All filters except "Custom id" and "Name" can be mixed. Mixed queries are applied to the device set in the order shown above starting from "Device Profile" filter.
Filtering by TAG#
ou can use logical operator for tag filtering. If you add "-" operator in front of a tag, it implies a NEGATE; if you add "^" operator to the end of a tag, it implies an OR. For example, if you like to see all the devices tagged as "house", and tagged as either "kitchen", "bathroom", or "bedroom" but not tagged as "mansion" you should set a tag filter as:
?tags=house, kitchen^, bathroom^, bedroom^, -mansion
๐ Filtering by PROPERTY VALUES#
You can use both property name or qualified name within property value filters. For example:
?prop=connecteddevice$connectionstatus,eq,onlineand?prop=connectionstatus,eq,onlineconsidered same. Property value comparison operator could be one of the followingeq, neq, lt, lte, gte, gt, and match(for case insensitive text comparison). Note that private properties, Waypoint, Object, Blob and File type properties cannot be used in property value filters.
๐ง Filtering by ConnectionStatus Property#
When a device with ConnectionStatus property is created, this property is set to undefined until it connects to the system via MQTT. If you query the device before the first connection you are not going to get any result from both
?prop=connectionstatus,eq,onlineand?prop=connectionstatus,eq,offlinequeries.