Skip to main content

Device creation

The concept of device is core to Connhex. Every device is the digital representation of a physical element that is able to connect to the infrastructure and send data of different nature (e.g. temperature, humidity, voltage, etc.) using a communication protocol supported by Connhex.

Every device is characterized by the following fields:

  • name: it is the name assigned by the user (e.g. the serial number of the device).
  • id: unique device identifier (generated following the UUID standard). It is automatically generated by Connhex during the device creation phase;
  • metadata: JSON object containing the custom fields defined by the user. It's a user-defined optional field (initialized to {} if no value is specified). During the device creation step, this field is automatically filled with the identifier of the channel that will be used by the device to communicate with Connhex;
  • key: Connhex access key (password) associated to the current device. Every time the device wants to send data to Connhex, it will use this key to be identified by the infrastructure.
Name uniqueness

You can have multiple devices with the same name: Connhex will still be able to distinguish them based on their IDs (see below). As a guideline, we recommend to stick with a unique name for each device, that maps an identifier of the physical element it represents.

In order to create a device, a user must specify:

  • name;
  • metadata (only if needed).

Devices can be created in two different ways:

  • directly from the Connhex Control app. In this case a user can create one single device at a time;
  • using a file: in order to create multiple devices simultaneously, a user can define its devices inside a CSV file and then upload it to Connhex using the web application (see details below).

Using Connhex Control

  • Use your Connhex credentials to log into Connhex Control
  • Open the Devices page: you can find it under the Connectables module
  • Click Add to create a new device
  • You will be prompted to insert a name and an optional description. Even if it's not strictly necessary, we strongly encourage to choose a unique name for each device
  • Click Confirm and the device will be created

Connhex Control: create a new device

Create devices from CSV file

In order to be correctly parsed by Connhex, the CSV file containing the details of the devices to be created must obey the following conventions.

The first column of each row must contain the name of the device. Additionally, any metadata must be specified inside a JSON object separated from the name by a vertical bar character |.

The following is an example of the content of a CSV file containing the details of three devices. Note how for the first device, named my_device_0, some metadata are specified. Instead my_device_1 and my_device_2 only contain the name.

my_device_0|{"manufacturerName": "Compiuta s.r.l.", "lot":"9207029531"}
my_device_1
my_device_2
Tip

There isn't a single convention associated to the case of the metadata object keys (i.e. the value manufacturerName of the previous example). The camelCase notation is often preferred, but the snake_case can be equally used. There are countless debates on which one should be used: we suggest to simply choose one, then stick to it and try to be as consistent as possible.