Skip to main content

Using EnOS Device SDK for Python

Table of Contents

The EnOS Device SDK for Python allows developers to write Python scripts to use their devices to access EnOS IoT hub through MQTT.

Installation

Prerequisites

To use the EnOS Device SDK, you will need Python 3.5.3 or later, and pip is required. Note that Python 2.x is not recommended as some functions might not be compatible with Python 2.x in future SDK versions.

If you are upgrading from an earlier version of EnOS Device SDK for Python, you need to change the path of the SDK package by adding enos prefix in your "Import" statement in the existing Python codes to use the latest version.

You can install the SDK from pip, or build from source.

Installing from pip

The latest version of EnOS Device SDK for Python is available in the Python Package Index (PyPi) and can be installed using

pip install enos-mqtt-sdk-python

Update setuptools if necessary:

pip install --upgrade setuptools

Building From Source

  1. Obtain the source code of EnOS Device SDK for Python.

    • From GitHub:
    git clone https://github.com/EnvisionIot/enos-mqtt-sdk-python.git
    
    • From EnOS SDK Center. Click SDK Center from the left navigation of EnOS Console, and obtain the SDK source code by clicking the GitHub icon in the Obtain column.
  2. From the directory where the source code is stored, run the following command:

    python setup.py install
    

Feature List

For the list of features supported by this SDK and the availability of EnOS device connectivity and management features in all SDKs we provide, see EnOS Device SDK.

Quick Start

  1. Create an MQTT client and connect it to EnOS Cloud using the secret-per-device authentication:
client = MqttClient(enos_mqtt_url, product_key, device_key, device_secret)
client.connect()
  1. Build a request to post a measurement point and publish the request using the connected client.
measure_point_post_request = MeasurepointPostRequest.builder() 
    .add_measurepoint('measurepoint_id', measurepoint_value) 
    .set_timestamp(timestamp) 
    .build()
# publish request and wait for the response
measure_point_response = client.publish(measure_point_post_request)
  1. Close the connection
client.close()

Sample Codes

Related Information

  • To learn more about EnOS IoT Hub, see EnOS IoT Hub Documentation.
  • To learn more about how to develop your device for EnOS IoT Hub, see EnOS Device Development Guide (Python).

Release Notes

  • 2019/11/15(0.1.0): Reconstruction and new functions added.
  • 2021/07/23(0.1.1): Support specified encryption algorithms suite.

Metadata

Release files for enos-mqtt-sdk-python 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enos-mqtt-sdk-python 0.1.1
File Size Uploaded
enos-mqtt-sdk-python-0.1.1.tar.gz 49.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for enos-mqtt-sdk-python 0.1.1
File Interpreter ABI Platform
enos_mqtt_sdk_python-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 152.1 kB

Release files / enos-mqtt-sdk-python-0.1.1.tar.gz

Download URL enos-mqtt-sdk-python-0.1.1.tar.gz
Size 49.4 kB
Tags Source
SHA-256 checksum
How to use checksums
671a0331456b95a4b786ae9dd2b37405f8e6cc245cd9c71d4d982ec62cfd7c38
BLAKE2b-256 checksum
How to use checksums
e1ad54c3d9c0ac3897fe66a8ab2a46592f9485d10747e0b646284ec34d38003e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

Release files / enos_mqtt_sdk_python-0.1.1-py3-none-any.whl

Download URL enos_mqtt_sdk_python-0.1.1-py3-none-any.whl
Size 102.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44243a228a21b266abd3f94c2d7df7e2aced44bb141450c90147d375cbbee8dc
BLAKE2b-256 checksum
How to use checksums
1387b1b66dc058aa4f9a2eed8b5b314bce369a7724d8e178bce45ec54f481995
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page