Overview
Litmus SDK for Python
The Litmus SDK is an official Python library that gives developers programmatic access to the full Litmus Edge API. Whether you're automating device provisioning, building custom dashboards, processing industrial data pipelines, or integrating Litmus Edge into your existing software stack, the SDK removes the complexity of raw API calls and lets you work directly in Python.
The SDK officially supports Litmus Edge 4.4.x, 4.0.x (LTS) and 3.16.x and Litmus Edge Manager 2.31.x, and requires Python 3.12 or later.
- Releases (download .whl): github.com/litmusautomation/litmus-sdk-releases/releases
What You Can Do with the SDK
- Manage DeviceHub devices, drivers, and tags programmatically
- Build, list, and inspect Digital Twin models and instances
- Create and control Flows Manager pipelines
- Query Analytics processors and results
- Deploy and manage Marketplace applications
- Browse and configure OPC UA servers and tags
- Manage system certificates, LDAP, network services, and users
- Connect directly to a Litmus Edge device or via the Litmus Edge Manager (LEM) Bridge
For AI Agents
If you are an AI agent (or are building one) and your task is "use the Litmus SDK to do X", start at api.litmus.io/sdk-agents.md rather than reading these pages top-to-bottom. That file is the canonical machine-readable guide and contains:
- A full site map of these docs (every URL slug, every section)
- Module -> Python import path -> Litmus API Collection mapping
- The litmus-sdk-cli discovery flow (litmus-sdk-cli list <module>) for enumerating all ~540 functions
- What's NOT in the SDK and where to find it (UNS, raw API)
The litmus-sdk-cli exposes every SDK function from the shell, returns JSON, and is the recommended interface for agents. See Litmus CLI Reference for the command reference.
Requirements
- Python 3.12 or newer
- pip or a compatible Python package manager
- A reachable Litmus Edge 4.4.x, 4.0.x (LTS) or 3.16.x, or a Litmus Edge Manager 2.31.x when connecting through the LEM bridge
- An OAuth 2.0 client with Admin permissions on the Edge device (Edge UI: System > Access Control > Tokens > API Credentials > OAuth 2.0 Client)
Install
Which download to pick
One release covers every supported Edge version. The SDK reads the device version at runtime, so download the latest release from the releases page whatever your Edge version is:
Litmus Edge | SDK release |
|---|---|
4.4.x | latest (2.8.1 or newer) |
4.0.x (LTS) | latest (2.8.1 or newer) |
3.16.x | latest (2.8.1 or newer); functions exclusive to 4.x raise UnsupportedVersionError |
Pick the .whl file. The .tar.gz is the source distribution for the same release.
Install the package
We strongly recommend a virtual environment:
python -m venv .venv
source .venv/bin/activate
python -m pip install litmussdk-<version>-py3-none-any.whlValues to set
Export these in the shell or put them in a .env file in your working directory (both are loaded automatically):
Variable | Required | Meaning | Default |
|---|---|---|---|
EDGE_URL | Yes | Address of the Litmus Edge device, for example https://10.0.0.5 | none |
EDGE_API_CLIENT_ID | Yes | OAuth 2.0 client ID from the Edge device | none |
EDGE_API_CLIENT_SECRET | Yes | OAuth 2.0 client secret from the Edge device | none |
VALIDATE_CERTIFICATE | No | Set to false to skip the TLS check for self-signed certificates | true |
Other settings, needed only for the matching connection mode:
Variable | Meaning | Default |
|---|---|---|
TIMEOUT_SECONDS | Seconds before an API request times out | 30 |
USE_LEM_BRIDGE | Reach the Edge device through Litmus Edge Manager instead of directly | false |
EDGE_MANAGER_URL | Address of the Litmus Edge Manager instance; required when USE_LEM_BRIDGE is true | none |
EDGE_API_TOKEN | Litmus Edge Manager API token (sent as X-AuthToken); used only for LEM connections and the LEM bridge, not for direct Edge connections | none |
EDGE_MANAGER_PROJECT_ID | LEM project ID of the target Edge device; required when USE_LEM_BRIDGE is true | none |
EDGE_MANAGER_DEVICE_ID | LEM device ID of the target Edge device; required when USE_LEM_BRIDGE is true | none |
EDGE_MANAGER_ADMIN_URL | Admin address of the LEM instance; currently unused | none |
UNS_URL, UNS_USERNAME, UNS_PASSWORD | Litmus Unify address and user, for the Unify modules | none |
See Getting Started and Managing Connections for the full walkthrough.
Verify
Make a real call against the device:
python -c "from litmussdk.devicehub import devices; print(len(devices.list_devices()), 'devices')"Expected output is the number of DeviceHub devices on the Edge, for example 12 devices (0 devices on a fresh device). An authentication error means the client ID or secret is wrong; a certificate error means VALIDATE_CERTIFICATE=false is needed for a self-signed device.
Remove
get_dh_cache_dir # note the DeviceHub record cache folder it prints
python -m pip uninstall -y litmussdkThen delete:
- the cache folder printed by get_dh_cache_dir
- ~/.litmus/<profile>.json, if you saved a profile with litmus-cli config set
- any .env file you created for the SDK
What's in This Documentation
- Getting Started - install the SDK and make your first call
- Managing Connections - direct LE, direct LEM, and LEM bridge connection modes; multi-device usage
- Usage Guideline + Authentication - per-module reference for DeviceHub, Drivers, Digital Twins, Flows Manager, Analytics, and Air gap Features
- Litmus CLI Reference - litmus-sdk-cli command reference
- Example Usages - end-to-end walkthroughs (Digital Twins, Flows, Marketplace, Analytics, Integration, OPC, Device Management/System)
- Release Notes - version history and what's new
Supported Versions
Litmus Edge Version | Status |
|---|---|
4.4.x | Supported |
4.0.x (LTS) | Default, actively tested |
3.16.x | Supported (manual CI trigger) |
3.11.x | Best-effort, not actively tested |
Python: 3.12 or newer required.
Functions exclusive to 4.x raise UnsupportedVersionError when called against a 3.x device.
License
Copyright (c) Litmus Automation Inc.