OpenIoE Python Library
This python sdk for openioe can be used to integrate user python based application with openioe platform.
🟩 Setup · 🟨 Configuration · 🟪 Device operations · 🟦 Reference
Table of contents
- Installation
- Welcome
- Load your configuration
- Read device data
- Write device data
- MQTT publish and subscribe
- Example programs
- Modules
- Handling errors
Installation
🟩 Setup
Install the library and all runtime dependencies, including MQTT support:
pip install openioe
Python 3.10 or newer is required. To update an existing installation:
python3 -m pip install --upgrade openioe
Paho MQTT 2.x (paho-mqtt>=2.1,<3) is installed automatically. HTTP operations
use Python's standard library. Build and release tools are development tools and
are installed separately when needed.
Welcome
Print the SDK welcome message and current package version:
import openioe
openioe.welcome()
Welcome to Open IoE Python SDK v1.1.2
The version is read from openioe.__version__; the greeting updates with the
installed package version. You can also use from openioe import welcome.
The function prints the greeting and returns None.
Load your configuration
🟨 Configuration
Download accountsecrets.json file from Accont Setting>> Secrets Tab.
Copy accountsecrets.json to your working folder.
from openioe import Config
from openioe.devices import Devices
config = Config("accountsecrets.json")
devices = Devices(config=config)
You may also use Config(config_file="accountsecrets.json"),
Config.from_json("accountsecrets.json"), or Devices(config_file="accountsecrets.json").
Relative paths resolve against the current working directory.
A minimal HTTP configuration is:
{
"base_url": "https://api.openioe.in",
"api_key": "your-account-api-key",
"api_version": "v1",
"timeout": 30,
"devices": [{
"idx": 1,
"device_id": "your-device-id",
"read_apikey": "your-read-api-key",
"write_apikey": "your-write-api-key",
"communication_protocol": "http"
}]
}
idx is the integer stored on the device entry, not its list position. Exactly
one entry must match. The library automatically selects read_apikey for reads
and write_apikey for writes. Keep actual credentials out of version control.
Provide configuration in Python
Labeled constructor input:
config = Config(
base_url="https://api.openioe.in",
api_key="your-account-api-key",
devices=[{
"idx": 1,
"device_id": "your-device-id",
"read_apikey": "your-read-api-key",
"write_apikey": "your-write-api-key",
"communication_protocol": "http",
}],
)
devices = Devices(config=config)
Ordered input uses base_url, api_key, api_version, timeout; resource lists
remain keyword arguments:
config = Config("https://api.openioe.in", "your-account-api-key", "v1", 30,
devices=[{"idx": 1, "device_id": "your-device-id",
"read_apikey": "your-read-api-key",
"write_apikey": "your-write-api-key"}])
api_version defaults to "v1" and timeout to 30 seconds. Do not mix file input
with direct settings. All module constructors accept a shared Config instance.
Read device data
🟪 HTTP read
response = devices.readdata(idx=1)
print(response["data"])
This POSTs to /v1/readdata using the selected device's device_id and
read_apikey. Omitted is_bulk defaults to False; omitted timestamps or None
are sent as empty strings. Supply a time range when needed:
response = devices.readdata(
idx=1,
is_bulk=False,
from_timestamp="2026-06-02 00:10:04.629315+00",
to_timestamp="2026-06-02 00:10:04.629315+00",
)
The full response dictionary is returned, for example:
{"data": {}, "message": "success"}
Write device data
🟪 HTTP write
response = devices.writedata(idx=1, data={"voltage": 230})
print(response)
This POSTs to /v1/writedata. The request's device_api_key is automatically
set to the configured device's write_apikey. data must be a JSON-serializable
dictionary. data_type defaults to "http" and can be supplied explicitly:
response = devices.writedata(idx=1, data={"voltage": 230}, data_type="http")
The full response dictionary is returned. HTTP endpoints use your configured
base_url and api_version.
MQTT publish and subscribe
🟪 MQTT messaging
MQTT support is included with pip install openioe.
Use a device with communication_protocol: "mqtt", MQTT_CLIENT,
MQTT_USERNAME, MQTT_PASSWORD, and a nonempty MQTT_TOPIC list. Set the
project's MQTT_BROKER and, if needed, MQTT_PORT. See the
full example configuration.
result = devices.publish(idx=1, data={"voltage": 230}, topic="data/monitor", qos=1)
print(result)
messages = devices.subscribe(idx=1, topic="data/control", num_messages=1)
for message in messages:
print(message["topic"], message["payload"].decode("utf-8"))
| Setting | Behavior |
|---|---|
| Topic | Must match a configured MQTT_TOPIC. Omit for publish only if one topic exists; omit for subscribe to receive from all configured topics. |
| Payload | Publish accepts dict/list (JSON encoded), string, bytes, or bytearray. Subscribe returns raw payload bytes. |
| QoS | qos=0 by default; accepts 0, 1, or 2. QoS 0 does not confirm broker delivery. |
| Retain | Publish defaults to retain=False. |
| Message count | Subscribe defaults to num_messages=1, then disconnects. |
| Client IDs | Publish uses {MQTT_CLIENT}_python_pub; subscribe uses {MQTT_CLIENT}_python_sub. |
| Timeout | Uses config.timeout; subscribe raises TimeoutError if the requested batch does not arrive. |
| TLS | Set tls=True; uses PEM Server_CA if provided, otherwise system trust. |
Both methods connect for the operation and disconnect afterward. Subscribe blocks
until its message count is reached or it times out. Publish returns topic, mid,
qos, and retain; each received message contains topic, payload, qos, and
retain. MQTT authenticates with its username/password rather than HTTP API keys.
Avoid simultaneous publishers for the same device or simultaneous subscribers for
the same device, since each role shares a client ID. Publish and subscribe use
different IDs and can run together.
TLS does not turn on automatically when Server_CA exists. The configured port
is always respected; if omitted, the default is 1883 or 8883 with TLS. The example
certificate placeholder must be replaced before use with TLS, or omitted to use
system trust.
Example programs
🟩 Run programs from examples/devices
Install with pip install openioe. Place your exported configuration in
examples/devices with the filename used by these programs, or edit their paths.
The read, write, publish, and subscribe programs select idx=9; change this to
your device's configured index. MQTT topics must match your configuration.
Run these commands from the examples directory:
The code below matches the existing example files.
Read program
Source: deviceread.py
from openioe import Config
from openioe.devices import Devices
# Resolve the example file relative to this script, from any working directory.
devices = Devices(config=Config("account-secrets-venkataswamyr-2026-10-25.json"))
response = devices.readdata(9)
print(response)
Run:
python3 deviceread.py
Write program
Source: devicewrite.py
from openioe import Config
from openioe.devices import Devices
devices = Devices(config=Config("account-secrets-venkataswamyr-2026-10-25.json"))
response = devices.writedata(idx=9,
data={'2026-10-19T00:36:10.244Z': {'SoC': 94, 'Current': 0.3, 'Voltage': 4.13}},
data_type="mqtt")
print(response)
Run:
python3 devicewrite.py
Publish program
Source: devicepublish.py
from openioe import Config
from openioe.devices import Devices
devices = Devices(config=Config("account-secrets-venkataswamyr-2026-10-25.json"))
print(devices.publish(9, {'SoC': 99, 'Current': 0.2, 'Voltage': 4.13}, topic="data/monitor", tls=False))
Run:
python3 devicepublish.py
Subscribe program
Source: devicesubscribe.py
from openioe import Config
from openioe.devices import Devices
devices = Devices(config=Config("account-secrets-venkataswamyr-2026-10-25.json"))
while True:
for message in devices.subscribe(9, topic="data/monitor", num_messages=1, tls=False):
print(message['topic'], message['payload'].decode('utf-8', errors='replace'))
Run:
python3 devicesubscribe.py
Configuration check program
Source: devices1.py
from pathlib import Path
from openioe import Config
from openioe.devices import Devices
# Resolve the example file relative to this script, from any working directory.
config = Config(Path(__file__).resolve().with_name("account-secrets-venkataswamyr-2026-10-25.json"))
devices = Devices(config=config)
print(devices)
Run:
python3 devices1.py
The read, write, publish, and subscribe examples make live network calls.
The write example uses write_apikey and sends its timestamp-keyed data through
HTTP /v1/writedata with data_type="mqtt". The subscribe example loops until
interrupted with Ctrl+C or until an exception such as TimeoutError occurs.
Each subscription call waits for one message using the configured timeout.
Publish uses {MQTT_CLIENT}_python_pub; subscribe uses
{MQTT_CLIENT}_python_sub. To try both, start the subscriber in one terminal
and the publisher in another. Set tls=True and configure the correct broker
port and CA certificate when TLS is required.
devices1.py loads configuration relative to its script and constructs the client
without network calls. The other examples use paths relative to the working
directory, which is why the commands above run from examples/devices.
Modules
🟦 Available modules
| Module | Class | Current availability |
|---|---|---|
openioe.auth |
Auth |
Configuration entry point for authentication integration |
openioe.devices |
Devices |
HTTP read/write and MQTT publish/subscribe |
openioe.dataset |
Dataset |
Configuration entry point for datasets |
openioe.ai |
AI |
Configuration entry point for AI workflows |
openioe.boards |
Boards |
Configuration entry point for boards |
openioe.edge |
Edge |
Configuration entry point for edge nodes |
openioe.digitaltwins |
DigitalTwins |
Configuration entry point for digital twins |
openioe.usermanagement |
UserManagement |
Configuration entry point for users and roles |
from openioe.edge import Edge
from openioe.edge.ota import OTA
edge = Edge(config=config)
ota = OTA(config=config)
OTA is a nested package entry point; firmware transfer is not implemented. Indexed AI model and edge firmware objects are preserved in the configuration. See the developer reference for the complete format and module examples.
Metadata
Release files for openioe 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openioe-1.1.3.tar.gz | 19.7 kB | Without provenance | Details for openioe-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openioe-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for openioe-1.1.3-py3-none-any.whl |
Total release size: 34.6 kB
Release files / openioe-1.1.3.tar.gz
| Download URL | openioe-1.1.3.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e259895ca271c250307a8a889c3ee0015731b794e318d87153d406a3839a0a1
|
|
BLAKE2b-256 checksum How to use checksums |
399d01605b3aa2995eaa96fc8424ec89d2ffa9ac8f63bc2a12b86ff9d6567f12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / openioe-1.1.3-py3-none-any.whl
| Download URL | openioe-1.1.3-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8fe8ff4fde46c400d5fd2ad04a1a9215919c0575d7c7818ba7aa392808adb4b
|
|
BLAKE2b-256 checksum How to use checksums |
bf7397ab0b542029048eb0af29cdffda47505e92ca03ecba485a4f9f18570d65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for openioe 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.