Skip to main content

iotery.io embedded python SDK

Project description

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 javascript would look like

createDevice(
  deviceTypeUuid="a-valid-device-type-uuid",
  data={ "name": "My Device", "other": "parameter" }
)

where createDevice maps to methodName, deviceTypeUuid maps to inputParameter, and name and other map to the dictonary {data : "variables"} in the generalized form given above.

The available resource creation 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.
createDeviceCommandInstanceEmbedded 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.
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

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

where getDeviceByUuid 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.
getCommandTypeListEmbedded `` link Get a list of available command types.
getCurrentTimestamp `` link Get the current server time in epoch (unix) time.
getDataTypeListEmbedded `` link Get a list of available data types.
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.
getNotificationListEmbedded `` link Get a list of available notifications.
getSettingTypeListEmbedded `` link Get a list of available setting types.

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 javascript would look like

updateDevice(
  deviceTypeUuid="a-valid-device-type-uuid",
  data={ "name": "My New Name" }
)

where updateDevice maps to methodName, deviceTypeUuid maps to inputParameter, and { "name": "My New Name" } maps to the dictonary {data : "variables"} in the generalized form given above.

The available resource creation methods are

methodName input link description
setBatchedCommandInstancesAsExecuted `` link Set a collection of batched command instances as executed.
setCommandInstanceAsExecuted `` link Report that a command has been executed to the server.
updateDeviceChannel `` link Update device channel.
setNotificationInstanceInactive `` 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iotery-embedded-python-sdk-0.1.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

iotery_embedded_python_sdk-0.1.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file iotery-embedded-python-sdk-0.1.3.tar.gz.

File metadata

  • Download URL: iotery-embedded-python-sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for iotery-embedded-python-sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b975e484a991f36dfad8996317e1adb8d2bff413fadb0f4b35be93c6ec9d1731
MD5 c042e8cb9f3330546cc3d3c95564b6ba
BLAKE2b-256 035e460b8b04b8dfd14c1040616ad51258289daf42aa801d8a56bd162412137c

See more details on using hashes here.

Provenance

File details

Details for the file iotery_embedded_python_sdk-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: iotery_embedded_python_sdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for iotery_embedded_python_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2471dee5a28a70bb0ee843d2d7079b449d65dd5f2aad7b380942be977babcd3b
MD5 cd4080aeb49362b772541e17f90fee0a
BLAKE2b-256 7de5397905bb529efc31aa330b8407a1878b0934d21621b7a7bf261f24024a97

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page