Flows Manager
14 min
The flows module manages Node-RED flow instances on Litmus Edge.
Note: For reading or modifying the internal content of a flow (nodes, wires, tabs), use the Node-RED API directly. The SDK only covers the flows-manager service (lifecycle management).
Imports
from litmussdk import flows
Common Operations (3.x and 4.0.x)
Listing Flows
all_flows = flows.list_flows() # list[dict]
# Each entry: {id, name, memory_limit, secret, tabs: [...]}
# Find a flow by name
flow = next((f for f in flows.list_flows() if f["name"] == "My Flow"), None)Creating a Flow
Creates a stopped, empty flow. Fails if a flow with the same name already exists.
flow = flows.create_flow(
name="My Flow",
secret="my-secret",
memory_limit=256,
)
flow_id = flow["id"]Starting and Stopping
flows.start_flow(flow_id)
flows.stop_flow(flow_id)Calling start_flow on a running flow (or stop_flow on a stopped flow) will raise an error.
Updating a Flow
flows.update_flow(
flow_id=flow_id,
name="Renamed Flow",
memory_limit=512,
)Removing a Flow
Destroys the flow and all its internal tabs.
flows.remove_flow(flow_id)
4.0.x-Only Operations
These functions raise UnsupportedVersionError when called against a 3.x device.
Download Flow File
Returns the raw .json flow definition as bytes.
content: bytes = flows.download_flow_file(flow_id)
# Save to disk
with open("my_flow.json", "wb") as f:
f.write(content)2.6.0 fix: prior versions of the SDK silently UTF-8-decoded the response, which corrupted binary content. As of 2.6.0, download_flow_file and download_flow_logs route through a binary-safe code path and return real bytes. Upgrade if you saw mangled output or the literal string "None" before.
Download Flow Logs
logs: bytes = flows.download_flow_logs(flow_id)Delete Flow Artifacts
Clean up individual flow artifacts without deleting the flow itself:
flows.delete_flow_flows_json(flow_id) # removes flows.json
flows.delete_flow_credentials(flow_id) # removes credentials file
flows.delete_flow_logs(flow_id) # removes log files
flows.delete_flow_node_modules(flow_id) # removes node_modules
License
Copyright (c) Litmus Automation Inc.