Python 3 library for connecting to WolkAbout IoT Platform
Project description
██╗ ██╗ ██████╗ ██╗ ██╗ ██╗ ██████╗ ██████╗ ███╗ ██╗███╗ ██╗███████╗ ██████╗████████╗ ██║ ██║██╔═══██╗██║ ██║ ██╔╝██╔════╝██╔═══██╗████╗ ██║████╗ ██║██╔════╝██╔════╝╚══██╔══╝ ██║ █╗ ██║██║ ██║██║ █████╔╝ ██║ ██║ ██║██╔██╗ ██║██╔██╗ ██║█████╗ ██║ ██║ ██║███╗██║██║ ██║██║ ██╔═██╗ ██║ ██║ ██║██║╚██╗██║██║╚██╗██║██╔══╝ ██║ ██║ ╚███╔███╔╝╚██████╔╝███████╗██║ ██╗╚██████╗╚██████╔╝██║ ╚████║██║ ╚████║███████╗╚██████╗ ██║ ╚══╝╚══╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═╝ ██████╗ ██╗ ██╗████████╗██╗ ██╗ ██████╗ ███╗ ██╗ ██╔══██╗╚██╗ ██╔╝╚══██╔══╝██║ ██║██╔═══██╗████╗ ██║ █████╗██████╔╝ ╚████╔╝ ██║ ███████║██║ ██║██╔██╗ ██║ ╚════╝██╔═══╝ ╚██╔╝ ██║ ██╔══██║██║ ██║██║╚██╗██║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
WolkAbout Python Connector library for connecting devices to WolkAbout IoT Platform.
Supported device communication protocols:
- WolkAbout Protocol
Prerequisite
- Python 3.7+
Installation
There are two ways to install this package
Installing with pip
python3 -m pip install wolk-connect
Installing from source
Clone this repository from the command line using:
git clone https://github.com/Wolkabout/WolkConnect-Python.git
Install dependencies by invoking python3 -m pip install -r requirements.txt
Install the package by running:
python3 setup.py install
Example Usage
Establishing connection with WolkAbout IoT platform
Create a device on WolkAbout IoT platform by using the provided Simple example device type. This template fits main.py and demonstrates the sending of a temperature sensor reading.
import wolk # Setup the device credentials which you received # when the device was created on the platform device = wolk.Device(key="device_key", password="some_password") # Pass your device and server information # defaults to secure connection to Demo instance - comment out host, port and ca_cert wolk_device = wolk.WolkConnect( device, host="api-demo.wolkabout.com", port=8883, ca_cert="path/to/ca.crt" ) wolk_device.connect()
Adding sensor readings
wolk_device.add_sensor_reading("T", 26.93) # Multi-value sensor reading wolk_device.add_sensor_reading("ACL", (4, 2, 0))
or multiple sensors at once with add_sensor_readings
:
wolk_device.add_sensor_readings({"T": 26.93, "ACL": (4, 2, 0)})
Optionally pass a timestamp
as round(time.time()) * 1000
.
This is useful for maintaining data history when readings are not published immediately after adding them to storage.
If timestamp
is not provided, the library will assign a timestamp before placing the reading into storage.
Data publish strategy
Stored sensor readings are pushed to WolkAbout IoT platform on demand by calling:
wolk_device.publish()
Disconnecting from the platform
wolk_device.disconnect()
Additional functionality
WolkConnect-Python library has integrated additional features which can perform full WolkAbout IoT platform potential. Read more about full feature set example HERE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size wolk_connect-4.1.3-py3-none-any.whl (81.7 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size wolk-connect-4.1.3.tar.gz (54.9 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for wolk_connect-4.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b31e504bec6ace32c171fea90f0b38bff5c5208bc368460a3fc44283aa494b1b |
|
MD5 | 85dd2b90bac624aeb04f3f9df2462047 |
|
BLAKE2-256 | 3a1117de21cd63692b635814791617e21a5ba59f03cc508e55b1d9d13642bd40 |