Skip to main content

iotery.io Embedded Python SDK

The python iotery.io SDK is intended to be used on your embedded device to interact with the itoery.io IoT Platform. The SDK is a fully featured wrapper for the REST API.

Getting Started

Setup your free account on iotery.io and go to your dashboard get started with creating device types and devices.

After you get your key, install the SDK:

pip install iotery-embedded-python-sdk

Note: Make sure you are using Python 3.5+!

And finally, some simple example usage:

from iotery_embedded_python_sdk import Iotery
TEAM_ID="265fcb74-8889-11f9-8452-d283610663ec" # team ID found on the dashboard: https://iotery.io/system
iotery = Iotery()
d = iotery.getDeviceTokenBasic(data={"key": "thermal_sensor_001",
                                     "serial": "THERMAL_SENSOR_001", "secret": "thermal_sensor_001_secret", "teamUuid": TEAM_ID})
iotery.set_token(d["token"])
me = iotery.getMe()

print(me["name"])

API

This SDK simply wraps the REST API, so more information and specifics can be found there. Since the API is a wrapper around the REST API, the syntax is standard for each of the Create, Read, Update, and Delete operations on iotery.io resources. All methods return a dictonary containing the API response. If there is an error, the method will raise an expection.

Creating Resources

The generalized syntax for creating resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", data={ "data": "variables" })

For example, to create a device, the python would look like

createDeviceCommandInstanceEmbedded(
  deviceUuid="a-valid-device-type-uuid",
  commandTypeUuid="a-valid-command-type-uuid",
  data={}
)

where createDeviceCommandInstanceEmbedded maps to methodName, deviceUuid maps to inputParameter, and data={} and maps to the dictonary {data : "variables"} in the generalized form given above.

The available resource creation (POST) methods are

methodName input link description
getDeviceTokenBasic link Get token for device via key, serial, and secret.
reportAlreadyExecutedCommands link Report an already executed set of commands to the server.
createDevice link Create a device.
createDeviceCommandInstance deviceUuid,commandTypeUuid link Create a command instance via a device.
postData deviceUuid link Post data to the cloud.
upsertDeviceSettings deviceUuid link Upsert settings for a device.
uploadDeviceLogs deviceUuid link Upload zip file of device logs.
provisionNetwork link Provision a network.
getDeviceTokenAsymmetric link Get device token based on encrypted credentials.

Reading Resources

The generalized syntax for reading (getting) resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", opts={"query":"parameter"})

For example, to get a device by it's unique identifier uuid, the python would look like

getDeviceTypeFirmwareRecord(
  deviceUuid="a-valid-device-uuid",
  version="valid version",
  opts={ "limit": 1 }
)

where getDeviceTypeFirmwareRecord maps to methodName, deviceUuid maps to inputParameter, and { "limit": 1 } maps to the dictonary {"query" : "parameters"} in the generalized form given above.

The limit option is for instructive purposes only. By definition, a uuid is unique and so there will never be more than one device for a given uuid.

The available resource creation methods are

methodName input link description
getBrokerAddress link Get the MQTT broker address.
getCommandTypeList link Get a list of available command types.
getCurrentTimestamp link Get the current server time in epoch (unix) time.
getDataTypeList link Get a list of available data types.
getDeviceSettingList deviceUuid link Get a list of settings for a device.
getDeviceUnexecutedCommandInstanceList deviceUuid link Get a list of unexecuted command instances for a device.
getDeviceTypeFirmwareRecord deviceTypeUuid,version link Get a desired version of a firmware record for a given device type.
getPublicCloudKey link Get base64 encoded public key from the server for use in RSA scheme.
getMe link Get information about the device.
getNotificationTypeList link Get a list of available notifications.
getSettingTypeList link Get a list of available setting types.
getTeam link Get the team information for a device.

Updating Resources

The generalized syntax for updating resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", data={ "data": "variables" })

For example, to update a device type, the code would look like

updateDeviceChannel(
  deviceUuid="a-valid-device-type-uuid",
  channelId="1",
  data={}
)

where updateDeviceChannel maps to methodName, deviceUuid maps to inputParameter, and {} maps to the dictonary {data : "variables"} in the generalized form given above (if there was a body).

The available resource creation methods are

methodName input link description
setNotificationInstanceListInactive link Set notification instance list inactive.
setBatchedCommandInstancesAsExecuted batchReferenceUuid link Set a collection of batched command instances as executed.
setCommandInstanceAsExecuted commandInstanceUuid link Report that a command has been executed to the server.
updateDeviceChannel deviceUuid,channelId link Update device channel.
setNotificationInstanceInactive notificationInstanceUuid link Set notification instance inactive.

Deleting Resources

The generalized syntax for reading (getting) resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", opts={"query":"parameter"})

For example, to get a device by it's unique identifier uuid, the python would look like

deleteDevice(
  deviceUuid="a-valid-device-uuid",
  opts={ "some": "option" }
)

where deleteDevice maps to methodName, deviceUuid maps to inputParameter, and { "some": "option" } maps to the dictonary {"query" : "parameters"} in the generalized form given above.

The available resource creation methods are

methodName input link description

Contributing

We welcome contributors and PRs! Let us know if you are interested.

Metadata

Release files for iotery-embedded-python-sdk 0.1.14

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

Source distribution (sdist)

Source distribution for iotery-embedded-python-sdk 0.1.14
File Size Uploaded
iotery-embedded-python-sdk-0.1.14.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iotery-embedded-python-sdk 0.1.14
File Interpreter ABI Platform
iotery_embedded_python_sdk-0.1.14-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / iotery-embedded-python-sdk-0.1.14.tar.gz

Download URL iotery-embedded-python-sdk-0.1.14.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f7ae5379a7dc956c3e9e092173ed65240cec8b877e3cc174cd80b126fc4f30d6
BLAKE2b-256 checksum
How to use checksums
0fafe5419b9570e1aa9ca445a452e374e68f1ba7084c7aff3f90e75c87f79f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.7

Release files / iotery_embedded_python_sdk-0.1.14-py3-none-any.whl

Download URL iotery_embedded_python_sdk-0.1.14-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9637e5c816e38b0a8ac0d84cd738c88682d8e545b85943dab3870b4b6aae0a56
BLAKE2b-256 checksum
How to use checksums
ad2efac9a22ff5e7c911d87ba9b446993d7cf01d198b7c2ae14a434bb48533c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.1.14 This release

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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