Skip to content

Python SDK

wallecpms is the official Python SDK for the Pipelet Headless CPMS API. It’s a thin, typed wrapper over the REST endpoints with sensible exceptions and a context-manager pattern for connection lifecycle.

Terminal window
pip install wallecpms
from wallecpms import HeadlessCPMS
cpms = HeadlessCPMS("http://localhost:8080", api_key="hcpms_live_...")
# List connected stations
for station in cpms.stations.list():
print(station["station_id"], station.get("status"))
# Start a charging session
result = cpms.transactions.start("WALLBOX_001", connector_id=1, id_tag="RFID_123")
print(result) # { "status": "Accepted", "transactionId": 42 }
# Stop charging by transaction ID
cpms.transactions.stop(transaction_id=42)
# Health check
print(cpms.system.health())

For long-lived clients, use the context manager so the underlying HTTP session closes cleanly:

with HeadlessCPMS("http://localhost:8080", api_key="...") as cpms:
print(cpms.stations.list())
ResourceMethods
cpms.stationslist(), list_compact(), liveness(), reset(), disconnect(), change_availability(), unlock_connector()
cpms.transactionslist(), start(), stop(), stop_connector()
cpms.configurationget(), set(), get_local_auth(), set_local_auth(), get_local_list_version(), send_local_list()
cpms.triggersboot(), meter_values(), status(), status_round(), message(), datatransfer()
cpms.firmwareupdate(), diagnostics()
cpms.webhookslist(), create(), get(), update(), delete(), events(), test()
cpms.hubjectremote_start(), remote_stop(), reserve(), sync()
cpms.systemhealth(), metrics_server(), metrics_websockets(), metrics_db_pool()

The SDK raises typed exceptions on non-2xx responses:

from wallecpms import HeadlessCPMS, AuthenticationError, NotFoundError, CPMSError
cpms = HeadlessCPMS("http://localhost:8080", api_key="wrong-key")
try:
cpms.stations.list()
except AuthenticationError:
print("Invalid API key!")
except NotFoundError:
print("Resource not found")
except CPMSError as e:
print(f"API error: {e} (HTTP {e.status_code})")
# Create a webhook
wh = cpms.webhooks.create(
name="My Integration",
url="https://my-app.example.com/webhooks/ocpp",
events=["StartTransaction", "StopTransaction", "StatusNotification"],
secret_header="X-Webhook-Secret",
secret_value="my-secret",
)
# List available event types
print(cpms.webhooks.events())
# Test a webhook
cpms.webhooks.test(wh["id"])
# Delete it
cpms.webhooks.delete(wh["id"])

wallecpms is currently sync-only. For high-concurrency workloads or async frameworks (FastAPI, Starlette), use the REST API directly with httpx.AsyncClient until the async port lands in v2.

import os
from wallecpms import HeadlessCPMS
cpms = HeadlessCPMS(
base_url=os.environ["CPMS_URL"],
api_key=os.environ["CPMS_API_KEY"],
timeout=10.0, # seconds, default 30
verify_ssl=True, # default True; set False for self-signed certs
)