Device Code Example

This sample python code can be used freely in any device to bidirectionally communicate with the Connio platform.

You can download our sample python code that you can embed into your devices to communicate with the Connio platform securely.

Background

The following example shows how you can connect a device to the platform using provisioning mechanism or directly using device credentials.

Video Tutorial

Connecting your device to the Connio platform

Step by Step Instructions

In order to use the provisioning mechanism, you need to do the following:

1. Create an App

2860

2. Create an API Client

Create an API Client with App context, and device:read scope to access to the provisioning app

2844

3. Create a custom identifier for your device

2802

4. Link your device to your App

Final step is to link your device to the app that will be used for provisioning purpose.

3120

Access Credentials

In order to use the code, you need to set the following environment variables with your accounts values:

Host

BROKER_HOST
BROKER_PORT

❗️

SECURITY WARNING

Always use port 8883 in production.

Option 1: Access using device credentials

CONNIO_DEVICE_ID
CONNIO_DEVICE_KEY_ID
CONNIO_DEVICE_KEY_SECRET

You can easily access this information on Connio Portal.

3104

Device Cheatsheet Page

Option 2: Access using provisioning mechanism

CONNIO_PROVISION_KEY_ID
CONNIO_PROVISION_KEY_SECRET
CONNIO_DEVICE_SN

You can check provisioning key details at API Key Credentials page.

2768

API Key Credentials page