| title | CLI (`ocpp-cp-sim`) | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| type | entity | ||||||||||||||||||||||||
| summary | The headless binary (Node >= 22.13 or Bun) — interactive REPL, JSON Lines mode, daemon launcher, and Socket.IO client modes — plus the full flag reference. | ||||||||||||||||||||||||
| sources |
|
||||||||||||||||||||||||
| related |
|
||||||||||||||||||||||||
| updated | 2026-11-25 |
Headless charge point simulator for scripting, CI pipelines, and AI/automation integration. Runs on Node.js >= 22.13 or on Bun. The same binary is also the launcher for the daemon and a thin Socket.IO client for a daemon someone else started.
- Node.js >= 22.13 or Bun to run the package (#916); Bun to develop in the repository and to use behavior files (see Runtimes)
# Interactive REPL
ocpp-cp-sim --ws-url ws://localhost:9000/ocpp --cp-id CP001
# JSON Lines mode (for automation)
ocpp-cp-sim --ws-url ws://localhost:9000/ocpp --cp-id CP001 --json
# Daemon on the default TCP loopback port (http://127.0.0.1:9700)
ocpp-cp-sim --daemon
# npm script shorthand from a checkout
npm run cli -- --ws-url ws://localhost:9000/ocpp --cp-id CP001The package exposes four bins for the same entry point: ocpp-cp-sim, its
aliases ocpsim and cp-sim, and ocpp-cp-simulator (the one npx / bunx
run, since it matches the package name). It can be invoked from anywhere once
installed:
# npm registry (recommended) — ships the web-console dist/. Runs on Node >= 22.13 or Bun.
npm install -g ocpp-cp-simulator # or: pnpm install -g (needs Node >= 22.13 on PATH)
npx ocpp-cp-simulator --help # no install
# Bun-only machine (no node on PATH), see "Bun-only machines" under Runtimes:
bunx ocpp-cp-simulator --help
bun install -g ocpp-cp-simulator && bun --bun "$(which ocpp-cp-sim)" --help
# The same package as a prebuilt release tarball
pnpm install -g https://github.com/shiv3/ocpp-cp-simulator/releases/download/cli-latest/ocpp-cp-simulator.tgz
bun install -g https://github.com/shiv3/ocpp-cp-simulator/releases/download/cli-latest/ocpp-cp-simulator.tgz
# From a local checkout (dev) — the bin is the built bundle, so build it first
# (the install needs a read:packages token, see CONTRIBUTING.md#setup)
GITHUB_TOKEN=${GITHUB_TOKEN:-$(gh auth token)} bun install
bun run build:cli
bun link
bun link ocpp-cp-simulator # in any consumer project
# Then use ocpp-cp-sim anywhere
ocpp-cp-sim --ws-url ws://localhost:9000/ocpp --cp-id CP001
ocpp-cp-sim --daemonA plain
bun install -g github:shiv3/ocpp-cp-simulatoris not supported: the web-consoledist/is built at release time (not committed to git), and bun does not install devDependencies for global packages so it cannot runvite buildon install. Use the prebuilt tarball URL above. Release tarballs are produced by theRelease CLIworkflow onv*tags — the same tag that builds the desktop app, so the CLI, the app and the libraries share one version. (Releases up tocli-v0.4.1used a separatecli-v*train.)npm registry.
ocpp-cp-simulatoris published on npm (first version0.10.0, #814 / #815). Thepublish-npmjob of theRelease CLIworkflow publishes the release's own tarball on everyv*tag, authenticated by GitHub's OIDC token (npm trusted publishing, no stored secret; the trusted publisher allowsnpm publish) and gated on the repository variableNPM_PUBLISH=true. A SemVer prerelease (v1.0.0-rc.1) is published under thenextdist-tag, neverlatest; a re-run of a tag already on npm skips. The bin isdist-cli/main.js, one bundle under anodeshebang that also runs on Bun (#916). See Runtimes.The first version had to be published by hand (a package that does not exist yet cannot have a trusted publisher); that publish also went through npm's staged-publish approval, which the trusted publisher's "Allow
npm publish" setting skips for the CI publishes.
GitHub's own releases/latest/download/… is not usable in this repository
and must not be reintroduced (#321). The repo had two independent tag trains —
v* for the desktop app and cli-v* for the CLI (unified into v* after cli-v0.4.1) — and
releases/latest resolves across both. Whenever the newest release is a
desktop one, which is the case for roughly half of any release cycle, the URL
redirects to a release that carries no .tgz and the install command fails
with a 404. That is the steady state, not a transient.
The replacement is cli-latest, a rolling pre-release that
scripts/roll-cli-latest.sh moves onto every CLI release from
cli-release.yml, re-uploading the stable-named ocpp-cp-simulator.tgz:
https://github.com/shiv3/ocpp-cp-simulator/releases/download/cli-latest/ocpp-cp-simulator.tgz
It is scoped to the CLI train, so it stays correct without anyone remembering
to bump a version number, and it is kept a pre-release precisely so it can
never itself become the repository's "Latest" release, which the desktop train
owns. The per-tag cli-vX.Y.Z releases are published with make_latest: false for the same reason, and release-drafter resolves the next desktop
version from v* tags only (tag-prefix: "v"), so a CLI release never
becomes the baseline of a desktop draft.
Rollout status. The pointer exists since cli-v0.4.0 (2026-10-01), the
first CLI release cut after it was introduced, and this page and
README.md advertise it. A pinned version is still
installable from its own release asset
(releases/download/cli-vX.Y.Z/ocpp-cp-simulator-X.Y.Z.tgz); the quick-start
commands no longer go stale when a CLI release is cut.
The contract. cli-latest always serves the highest published
cli-vX.Y.Z release, and never a lower one, whatever order the pointer jobs
run in or fail in. Three carve-outs, stated rather than left to be discovered:
- A CLI release tagged with a SemVer prerelease or build-metadata suffix
(
cli-v1.0.0-rc.1) is not eligible to own the pointer and is ignored when picking the highest. Install those by their pinned URL. - If the highest release is later deleted, the pointer follows the new
highest downwards, with a
::warning::— an unpublished release cannot be the thing the pointer serves. It never moves down on the strength of a release listing alone; see The marker is load-bearing, narrowly. - Replacing the asset is not atomic — GitHub has no atomic asset swap — so there is a window, bounded by two metadata calls rather than by a 2 MB upload, in which the URL can 404. It is recovered from rather than exited from; only a recovery that is exhausted — or that cannot establish what state the release is in — leaves it 404ing, and it says so loudly and says how to restore it.
How it holds. Every pointer run asks which is the highest published
cli-v* release and rolls to that, not to the version that triggered it. The
obvious alternative — each run moves the pointer to its own version, refusing
if a marker in the pointer's body names something newer — fails two ways, and
both shipped before this design:
- Queue order is not version order. GitHub keeps exactly one pending job
per
concurrency:group and replaces it with the most recently queued one, and queue order here is release-job completion order. With 1.1 running, 1.3 pending and a slow rerun of 1.2 arriving, 1.2's job evicts 1.3's, 1.2 advances the pointer from 1.1, and the already-published 1.3 is never served. - An unverified marker is not a trustworthy authority. Uploading the asset and writing the marker are two API calls. If the upload lands and the write does not, the URL immediately serves the new asset while the body still names the old version — and a later, older run passed its comparison against that stale marker and rolled the served bytes backwards. While the marker was trusted unverified, reversing the two calls only swapped which direction was wrong; it is the point lookup added later, described below, that makes one order safe. The code writes the marker first, and "If this dies here…" says why.
Converging on the highest published release removes both, because it removes the two things that were being trusted. Queue order stops mattering: whichever job survives reaches the same state. A cancelled job costs nothing, because the next one to run reaches that same state. A stale or hand-edited marker cannot by itself authorise anything — it is a record of what is served, and the one decision it participates in is gated on a point lookup that verifies it (see the next section). It is deliberately not used to short-circuit the upload, because that would put it back on the trusted path.
Converging on "the highest published release" is only as good as the listing it
is computed from, and gh release list is eventually consistent. Waiting until
the listing shows the triggering tag closes "the listing has not caught up
with me". It does not close "the listing has not caught up with someone
newer": an older rerun can see a listing that looks complete, omits a
higher release, and would then overwrite the pointer downwards — recreating the
rollback this design exists to prevent.
In that one situation the marker is the only evidence the newer release exists,
so it is consulted — as a lower bound on what has already been served, never
as authority to move. Whenever it names something higher than the listing did,
the run does a point lookup of that single release (a direct GET of one tag,
not a paginated list) and: published → the listing was stale, converge up
to it; confirmed 404 → deleted, converge down with a warning; draft →
not published, converge down with a warning; any other error → fail closed
and leave the pointer alone. A hand-edited or corrupt marker therefore cannot
move the pointer anywhere — it can only trigger a lookup whose answer decides.
Asked of every mutating call, because the reviews of this script have found partial-failure bugs rather than logic bugs:
| Step | URL then serves | What the next run may conclude |
|---|---|---|
| download the target's asset | previous release | nothing changed |
| write the notes (the marker) | previous release | marker over-claims: its lookup finds the release published, converges up |
upload <asset>.incoming |
previous release | as above — the pending swap is completed by whichever run comes next |
| delete the live asset | the only 404 window | as above |
rename .incoming into place |
new release | consistent |
| move the git tag | new release | consistent |
The second column is the half this table used to cover. The third is where two rounds of findings actually lived: a state is only safe if the next run cannot draw a wrong conclusion from what it finds.
There is a third class of failure besides "it failed" and "it failed partway":
"it may have succeeded and we cannot tell". A retry loop cannot distinguish
a lost request from a lost response, so an exhausted retry does not mean the
mutation was not applied. The rule is therefore that after an exhausted retry
of a mutation the state is queried, never assumed. Assuming a rename had
failed is what let the destructive --clobber fallback run against the asset
that same rename had already put in place — turning a cosmetic retry failure
into a dead install URL. Where each exhausted retry lands:
| Exhausted call | What happens |
|---|---|
| write the notes (marker) | Fail. Safe either way — if it did apply, the marker over-claims, which self-heals |
upload <asset>.incoming |
Fail. Safe either way — an orphan serves nothing and the next run clobbers it |
| delete the live asset | Query. Present → stop; absent → continue; unknown → stop |
rename .incoming |
Query. Present → it worked; absent → fall back; unknown → never fall back |
| fallback re-upload | Query, so a lost response is not reported as a dead URL |
| create the pointer | Query, same reason |
| move the git tag | Query, to keep the warning honest. Cosmetic either way |
That is why the marker is written first, and why failing to write it is fatal rather than a warning. Writing it last looked right in isolation — the bytes are correct and the URL works, so why fail? — but it leaves a successful swap whose marker still names the older version, and a later run on a stale listing then sees nothing higher to verify and replaces the newer bytes with an older tarball. Once the marker became a lower bound, the two directions of staleness stopped being symmetric:
| Marker relative to the bytes | Consequence |
|---|---|
| over-claims (ahead) | Self-healing: the next run verifies the claim, converges up, finishes it |
| under-claims (behind) | Permits a rollback — the failure this whole design exists to prevent |
Writing it first also costs nothing when it fails: at that moment nothing else has been touched, so the run can simply exit non-zero with the URL still serving the previous release.
Lookups on that path preserve their status: "the asset is absent" and "the
asset could not be looked up" are different answers, and only the first may
allow the destructive fallback to proceed. Collapsing them is the fail-open
class this script closes everywhere else, and it caused the exact outcome the
fallback exists to prevent — a failed query read as absence lets --clobber
run against a live, working asset.
gh release upload --clobber is deliberately not used for the live asset.
Its own help says "If the upload fails, the original assets will be lost": it
deletes first and uploads second, so a transient failure would leave the URL
README.md advertises 404ing indefinitely. The new bytes go up under a
temporary name first, so the destructive step never runs until the replacement
is already on the server; then delete and rename, both fast metadata calls,
both retried, with a recovery that re-uploads under the live name — but only
once a query has confirmed the live asset is absent. Only if that recovery is
also exhausted, or the state cannot be established, does the run exit with the
URL dead, and then it says so and says how to restore it.
The git tag is moved to the commit behind the target release, not to the
checkout's HEAD — an older run that converged upward is checked out at its
own older tag, and tagging that would make the tag disagree with the asset. It
is moved through the refs API, so the checkout's fetch depth does not matter,
and failing to move it is a warning rather than an error: the tag is cosmetic
and the URL is already correct by then.
| Situation | What happens |
|---|---|
A higher cli-v* release exists than the one that triggered the run |
::notice::, pointer goes to the higher one |
| Release listing cannot be read | Release fails. The highest release is unknown, so the pointer is left alone |
| Listing is stale and omits the triggering release | Retried; then the triggering version is used as a floor, since its publish job demonstrably finished |
| Listing is stale and omits a release the marker records as higher | Point lookup decides: published -> converge up; 404 or draft -> converge down, warned; other error -> fail closed |
Target release has no (or an empty) ocpp-cp-simulator.tgz |
Release fails rather than pointing at a release that cannot be served |
| Pointer lookup returns a confirmed 404 | Pointer is created |
| Pointer lookup fails any other way (401, 403, 5xx, DNS) | Release fails. "Absent" must never be inferred from a transient error |
| Pointer's marker is missing or unparseable | ::warning::, marker overwritten — in this state it carries no information |
| Pointer's marker names a version higher than the target | Point lookup of that release decides (row above); it is never simply overwritten |
| A mutation exhausts its retries | The state is queried, never assumed — a lost response is not a failed request |
| Version given is a prerelease or has build metadata | Release fails with an error naming the reason |
Versions are compared numerically field by field, never with sort -V, which
is not SemVer-aware: it orders 1.0.0-rc.1 after 1.0.0. The asset is taken
from the target release itself, so the bytes the pointer serves are provably
the bytes that release published. The marker is written first, then the
asset is swapped, then the tag moves — that order is the safety invariant, not
an implementation detail, and the reasoning is in
"If this dies here…".
Do not reverse it.
Only the pointer move is serialised. cli-release.yml is two jobs: the
publish job, which creates the per-tag cli-v* release, and roll-pointer.
The concurrency: group is on roll-pointer alone. It must not be on the
workflow or on the publish job: GitHub cancels the pending run when a newer
one enters a group, and cancel-in-progress: false protects only the run
already executing — so a workflow-level group would cancel a queued CLI release
outright and it would never publish its own cli-v* assets, which are the
release. The group on roll-pointer exists only to stop two --clobber
uploads interleaving; it is not what makes the pointer correct, and it must not
be, because it is that group's own eviction behaviour that the convergence
above is written to survive. verify-install-urls.sh asserts this placement so
the group cannot migrate back up.
CI runs scripts/verify-install-urls.sh on every pull request, and what it
does there depends on the diff (#808). It fetches every install command
this page and README.md advertise and fails if one does not return 200 — an
earlier version of the guard only checked that the places restating the command
agreed with each other, which is no guard at all, since several places agreeing
on a broken URL is precisely the state #321 describes. It also refuses any
releases/latest/download install command, and asserts that cli-release.yml
still advertises the rolling URL and still moves it through the roll script.
Prose that merely names a URL (such as the block above) is exempt: it is not an
instruction a reader will paste.
The fetch needs a reachable GitHub release, so it is not run for every pull
request. A pull request gets the full script only when its diff adds or removes
a line matching (pnpm|bun|npm) install -g https:// in a Markdown file (the
pattern the script itself greps for) or touches cli-release.yml,
roll-cli-latest.sh or the script; any other pull request runs
scripts/verify-install-urls.sh --offline, which keeps every repository-only
invariant and skips the fetch. A push to main always fetches, and the
Install URLs workflow (.github/workflows/install-urls.yml) fetches daily,
so a broken cli-latest is still noticed between such changes.
package.json's files field lists two build outputs and no sources:
| Entry | What it is |
|---|---|
dist-cli |
main.js, the bin: one ES-module bundle of apps/cli/src/main.ts with a #!/usr/bin/env node shebang that runs on Node and on Bun (bun run build:cli, scripts/build-cli.ts, built with rolldown; bun build --target=node emits some modules twice, #916). The Docker image and the Tauri sidecar keep the bun build --target=bun output (bun run build:cli:bun). Every repository module the CLI imports is inlined — the vendored OCA JSON schemas, packages/core/schema/scenario.schema.json and the scenario templates included |
dist |
The Vite-built web console served by --web-console |
Both are built by prepack (and explicitly by cli-release.yml), never
committed. The bundle finds dist/ one level up from itself
(resolveBundledDist in apps/cli/src/bundledDist.ts), and export-k6 writes its k6 runtime
from an embedded copy (apps/cli/src/exportK6/runtimeSources.ts, generated from
runtime/ by bun run gen:k6-runtime; a stale copy fails
runtimeManifest.test.ts). Nothing in the package depends on the source
layout, which is what let the sources move into packages/ and apps/
(#578) without the published CLI noticing. The same holds for the
Open OCPP Trace SDK
(#886): @open-ocpp-trace/* are root devDependencies, inlined into
dist-cli/main.js and dist/, so the published manifest does not depend on
them and installing the package needs no GitHub Packages token.
Until 2026-11-04 the tarball shipped the sources instead, and files listed
every src/ directory the CLI imported. Between 2026-07-01 and 2026-09-12
that list omitted src/data, src/ocpp, src/trace and vendor, so the
tarball the release workflow produced could not start at all (#320). Nothing
caught it because the only checks on the tarball were tar -tf | greps for
three filenames that happened to be present — a listing check cannot see a
path nobody thought to name. scripts/verify-cli-tarball.sh replaced them
and still guards the bundle: it installs the tarball into a throwaway global
prefix (refusing one that ships src/, packages/ or apps/, or a workspace: dependency in its manifest; then installing it with npm as well) and then boots it — --help, a
bun build --compile over the installed bundle (every bare specifier it kept
must resolve from the installed package), the daemon answering
GET /v1/healthz with a charge point bootstrapped, export-k6 writing its
runtime, and, when dist/ is present, the web console serving its shell. It
runs on every pull request (ci.yml) as well as at release time, so
packaging breaks on the PR that breaks it. apps/cli/src/build/__tests__/cliBundle.bun.test.ts
pins the same shape without npm pack: it builds the bundle into a directory
outside the checkout and runs it from another one.
--runtime node|bun (#916) pins the runtime: node cuts PATH down to node's
directory (the script fails if bun is still found), installs with npm only
and runs the bin through its node shebang; bun is a Bun-only machine: PATH
holds the system tools minus node / npm / npx plus bun (the script fails if
node is still found), the tarball is installed with bun install -g and the
bin runs as bun --bun <bin>. It also prints what running the bin directly
does there (it fails, see below).
A --json status command over stdin is part of the smoke. The cli-runtimes
job in ci.yml runs it on Node 22.13 (the floor), 24 and 26 (current LTS) and
on Bun, with --expect-dist. The vitest suite stays on Node lts/* only: six
test files use the global CloseEvent, which Node 22 lacks.
The Docker image does not run the published bundle: it
builds dist-cli/main.js with bun run build:cli:bun (bun build --target=bun,
a bun shebang) and runs that under Bun, and
cliBundle.bun.test.ts pins that bundle. The desktop sidecar
is bun build --compile of apps/cli/src/main.ts; the embedded k6 runtime
serves both.
All flags described below apply whether you run the installed ocpp-cp-sim
command or, from a source checkout, bun apps/cli/src/main.ts ….
The published package runs on Node >= 22.13 (tested on 22.13, 24 and 26,
the current LTS) and on Bun; the same dist-cli/main.js serves both
(#916). engines.node is >=22.13.0. The runtime is chosen once at start-up
(typeof Bun, apps/cli/src/runtime/).
| Area | Node | Bun |
|---|---|---|
| HTTP / Socket.IO (daemon, web console, SOAP listener) | node:http + the stock Socket.IO engine |
Bun.serve + @socket.io/bun-engine |
State DB (--state-db) |
node:sqlite (its ExperimentalWarning is filtered) |
bun:sqlite |
| OCPP WebSocket client | ws (handshake headers, TLS options, --ws-max-payload, --ws-local-address) |
native WebSocket (--ws-proxy) |
behavior build, --behavior, --watch-behaviors |
not available: fails with "needs Bun" | available |
Sentry (SENTRY_DSN) |
@sentry/bun without the Bun-only integrations, runtime: node |
@sentry/bun |
Where a flag differs per runtime, the flag table says so (--ws-proxy is Bun
only, --ws-max-payload and --ws-local-address are Node only: a start that
asks for the other runtime's option is refused, not silently ignored). To use a
behavior file from an npm install, run the CLI under Bun:
bunx --bun ocpp-cp-simulator --behavior ./b.ts ....
The bin starts with #!/usr/bin/env node. Where Node is not installed, a plain
ocpp-cp-sim (the symlink bun install -g creates) therefore fails with
/usr/bin/env: 'node': No such file or directory. This is a known regression
of #916: before it the shebang was bun and bun install -g plus a plain run
worked on a Bun-only machine. What works there, verified with Bun 1.3.14 and no
node on PATH (CI job "CLI on Bun (no Node)" covers the bun --bun row; the bunx row was checked by hand):
| Command | Result |
|---|---|
bun install -g ocpp-cp-simulator, then ocpp-cp-sim ... |
fails: env: 'node': No such file or directory |
bun install -g ocpp-cp-simulator, then bun --bun "$(which ocpp-cp-sim)" ... |
works (also bun "$(which ocpp-cp-sim)" ...) |
bunx ocpp-cp-simulator ... / bunx --bun ocpp-cp-simulator ... |
works: with no Node on PATH bunx runs the bin under Bun itself |
Workaround: use bunx / bun --bun <bin>, or a shell alias
alias ocpp-cp-sim='bun --bun "$(which ocpp-cp-sim)"', or install Node.
Not changed: the Docker image and the Tauri sidecar run on
Bun with a separate bun build --target=bun bundle (bun run build:cli:bun).
Building the package from the repository still needs Bun (bun run build:cli);
only running it does not. CI proves the Bun-free run: the cli-runtimes job
(see What the package ships).
Default mode. Connects to a CSMS and provides a ocpp> prompt.
ocpp-cp-sim --ws-url ws://localhost:9000/ocpp --cp-id CP001OCPP CP Simulator CLI - CP001 (1 connector(s))
Target: ws://localhost:9000/ocpp
Type "help" for available commands.
ocpp> connect
Connecting...
[EVENT] connected to CSMS
Connected.
ocpp> start 1 TAG001
Transaction start requested on connector 1
ocpp> status
ChargePoint: CP001 Status: ...
Connector 1: Charging (Operative) Meter: 0 Wh TX#12345
| Command | Description |
|---|---|
connect |
Connect to CSMS (sends BootNotification) |
disconnect |
Disconnect from CSMS |
status |
Show charge point and connector status |
start <connector> <tagId> |
Start a transaction |
stop <connector> |
Stop a transaction |
meter <connector> <value> |
Set meter value (Wh) |
send-meter <connector> |
Send current meter value to CSMS |
heartbeat |
Send a single heartbeat |
heartbeat start <seconds> |
Start periodic heartbeat |
heartbeat stop |
Stop periodic heartbeat |
authorize <tagId> |
Send authorization request |
connector-status <connector> <status> |
Update connector status |
help |
Show help |
exit |
Exit |
Machine-readable mode for automation and AI agent integration. Each line of
stdin is a JSON command; each line of stdout is a JSON response or event.
By default the simulator's own log lines ([ts] [INFO] ..., including every
Sent: / Received: wire line, see the TCK contract below) share stdout with
the JSON lines. Add --log-to-stderr to send them to stderr so stdout is pure
JSON Lines (#1088); --log-file <path> keeps a copy in a file and
--log-level thins them out.
ocpp-cp-sim --ws-url ws://localhost:9000/ocpp --cp-id CP001 --jsonIn the Docker image the same arguments work
without --entrypoint: docker run -i <image> --json --cp-id CP001 --ws-url ….
{"id": "req-1", "command": "connect"}
{"id": "req-2", "command": "start_transaction", "params": {"connector": 1, "tagId": "TAG001"}}
{"id": "req-3", "command": "status"}{"id": "req-1", "ok": true}
{"id": "req-2", "ok": true}
{"id": "req-3", "ok": true, "data": {"id": "CP001", "status": "Available", "error": "", "connectors": [...]}}Error responses:
{ "id": "req-x", "ok": false, "error": "error description" }Asynchronous events are emitted as JSON lines without an ok field:
{"event": "connected", "data": {}, "timestamp": "2025-01-01T00:00:00.000Z"}
{"event": "connector_status", "data": {"connectorId": 1, "status": "Charging", "previousStatus": "Available"}, "timestamp": "..."}The JSON-mode command IDs are exactly the CP-scoped Socket.IO RPC method
names of the daemon — connect, status, start_transaction,
run_scenario, … — and take the same params. The single canonical table
(params, constraints, notes) lives in
Control plane → CP command methods;
the server routes both surfaces through the same command handler.
open-ocpp-tck (the OCPP conformance
runner, #271) runs
this CLI as a charge point: --json --ws-url … --cp-id … --ocpp-version …
with stdin kept open. The parts it depends on are a stable contract
(#346); the golden
tests named below fail on an incompatible change:
| Surface | What is promised | Pinned by |
|---|---|---|
| JSON Lines commands | connect, status, start_transaction, stop_transaction, authorize, heartbeat, send_meter_value, transaction_event, load_scenario_template, get_scenario, remove_scenario, load_scenario, run_scenario, run_scenario_template keep their name and the parameters of the CP command table. The test sends the optional parameters with non-default values (context: "Sample.Clock", reason: "EVDisconnected", 2.0.1 CablePluggedIn / EVConnected / EVDeparted, once: true) and reads them back off the wire, because JSON mode ignores keys it does not know |
apps/cli/src/__tests__/tck-contract/tck.jsonLines.golden.bun.test.ts |
| Template-once flow | On one connector, before connect: load_scenario_template, get_scenario, remove_scenario, then load_scenario of the same definition with enabled: false. The scenario id is kept (<templateId>-c<connector>), the disabled copy does not auto-start when the station boots, and run_scenario with the original id starts it |
same |
| Parameter shapes | The keys of each command above and whether each is optional. Required keys and existing keys never change; a new key must be optional (idTokenType of authorize / start_transaction is one, #599 / #672; so is maxDurationSeconds of run_scenario_template, #1101). A rename goes through an alias period (rules below) |
packages/contracts/src/__tests__/tckContract.methods.test.ts |
| Response envelope | {id, ok: true, data?} / {id, ok: false, error}; data is absent, not null, for commands without a result; load_scenario_template answers {scenarioId} (<templateId>-c<connector>), remove_scenario answers {removed} |
same |
| Events | {event, data, timestamp} on the same stream, e.g. boot_notification, scenario_started |
same |
| Exit | EOF on stdin ends the process with exit code 0 | same |
| Wire log lines | In the default --log-format plain, every frame is one stdout line [<ISO-8601 UTC ms>] [INFO] [WebSocket] Sent: <raw frame> or … Received: <raw frame>; the frame text is what went over the socket, except that secrets are redacted (below) |
apps/cli/src/__tests__/tck-contract/tck.wireLogLines.golden.bun.test.ts |
cert16-* template ids |
Every id that was shipped keeps resolving through load_scenario_template / run_scenario_template. The set only grows |
packages/core/src/utils/tckContract.templateIds.test.ts |
start_transaction answers once the transaction exists or the start was
refused (#813), on 1.6
and 2.x: after the Authorize answer when the station asks one. A client can send
the next command (transaction_event, stop_transaction) as soon as the reply
arrives, without waiting for a Started event. The reply carries
data: {started, denialStatus?}; started: false is still ok: true, and
denialStatus is the non-Accepted Authorize status when that was the reason.
data is an optional addition to the envelope.
Rules when changing these:
- New parameters are optional. A command or parameter is not renamed or removed without an alias that keeps the old name working for at least one minor release.
- A
cert16-*template is not removed or renamed in one step: register the old id as an alias entry for a release first. The TCK pins the image by digest, so the alias period is what gives it time to re-pin. Whether the JSON templates stay owned here is open (the Gherkin scenarios may become the source and the templates generated); the ids stay stable either way. - The golden tests are not updated to make them pass. A deliberate break is a wire or default change: announce it in the release notes and tell the TCK repository.
- Frames on stdout pass the log redactor: a secret
in a payload (
AuthorizationKey,BasicAuthPassword,password, private keys) reads[redacted], so a TCK assertion cannot depend on its value.
The TCK reads the rest of the surface only through these: the trace file
(--trace-output, Trace format) and the flags
--ws-url, --cp-id, --ocpp-version, --basic-auth-user /
--basic-auth-pass and the security flags; --connectors reaches it only
through the TCK's SIM_EXTRA_ARGS.
Long-running process that exposes health, optional static web-console assets, and a Socket.IO control plane on TCP. See Daemon for the process itself and Control plane for the full RPC reference.
# Start daemon on the default TCP target: http://127.0.0.1:9700
ocpp-cp-sim --daemon &
# Start daemon with an initial CP and default TCP control plane
ocpp-cp-sim --ws-url ws://localhost:9000/ocpp --cp-id CP001 --daemon &
# Start foreground server on a custom TCP port
ocpp-cp-sim --http-port 9701
# Daemon + bundled browser UI
ocpp-cp-sim --daemon --web-console| File | Description |
|---|---|
/tmp/ocpp-server.pid |
PID file for duplicate detection (daemon) |
There is no Unix-domain socket listener. --unix-socket <path|none> is still
accepted for launcher compatibility, prints a deprecation warning, and is
ignored (see REST → Socket.IO migration).
Network Simulation — configuration is applied at runtime via the daemon's
Socket.IO RPC methods or MCP tools; there are no --network-sim-* startup
flags. See Network simulation.
--cp-id becomes optional in server mode. A whole fleet can be bootstrapped
from the flags:
# CP001 .. CP020, all pointed at the same CSMS
ocpp-cp-sim --http-port 5172 --cp-id CP --cp-count 20 \
--ws-url wss://csms.example.com/ocpp/--cp-id-pattern overrides the generated ids (--cp-id-pattern "site-a-{n:04}").
A startup scenario, if given, is loaded onto every charge point in the fleet,
and so are the labels of a repeated --label key=value (--label site=lab --label env=ci), so the fleet comes up already selectable with
cp.list { labels } (#472).
The whole fleet is registered before anything dials the CSMS, so cp.list
answers immediately even against an unreachable one; connecting then proceeds
8 charge points at a time. For SOAP, --soap-public-base-url (or the origin a
--soap-tunnel yields) is re-derived per generated id, while an explicit
--soap-callback-url must carry the same {n} placeholder — one callback
address cannot route a fleet.
Additional CPs can also be added at runtime with the browser UI, the
cp.create Socket.IO RPC method, or cp.create_many for a batch:
await rpc({
method: "cp.create",
params: {
cpId: "CP001",
wsUrl: "ws://localhost:9000/ocpp",
connectors: 1,
autoConnect: true,
},
});Run a scenario automatically when bootstrapping a CP at startup. All three
sources can target a single connector, a comma-separated list, or every
connector via --scenario-connector all.
# Built-in template on connector 1
ocpp-cp-sim --daemon --ws-url ws://localhost:9000/ocpp --cp-id CP001 \
--scenario-template full-charging-cycle --scenario-connector 1
# Concrete scenario JSON file (cpId/connectorId baked in)
ocpp-cp-sim --daemon --ws-url ws://localhost:9000/ocpp --cp-id CP001 \
--scenario /path/to/scenario.json --scenario-connector 1
# cpId-independent template JSON applied to every connector
ocpp-cp-sim --daemon --ws-url ws://localhost:9000/ocpp --cp-id CP001 --connectors 5 \
--scenario-template-file /path/to/template.json \
--scenario-connector all
# Or pick specific connectors
ocpp-cp-sim --daemon ... --scenario-template-file /path/to/template.json \
--scenario-connector 1,3,5--scenario-template-file reads a JSON file shaped like a
ScenarioDefinition (the format the browser Scenario Editor exports — see
Scenario format for the field reference and
the published JSON Schema), then clones it
per connector — rewriting targetType, targetId, id, and name — so each
connector runs an independent state machine from the same file. --scenario
and --scenario-template fan out the same way when --scenario-connector
resolves to more than one id. Both --scenario and --scenario-template-file
validate the file against that schema at load time and warn (never reject)
on a mismatch. Built-in template ids are listed in
Scenario templates.
At most one of the three. --scenario, --scenario-template and
--scenario-template-file each load a definition onto every selected
connector, so passing two is refused at parse time with a message naming the
flags it cannot reconcile — the daemon does not start. They were silently
ranked before, and the three places in the daemon that derive from these flags
ranked them differently: see the startup rules in
Daemon.
Restarts with --state-db. Each instance a startup flag loads keeps the
same id across restarts, and one the flag creates records which flag
generated it. A restart removes the startup instances the current flags no
longer call for — a connector dropped from --scenario-connector, a file
whose own id changed, a switched or dropped flag — and an older build's
clock-suffixed instance of what it installs on the same connector, but never
another scenario (#338). Details: Daemon.
The same binary doubles as a TCP Socket.IO client for a running daemon. Client
modes default to http://127.0.0.1:9700, so --http-url is optional for a
bare local daemon.
# Send command to a running local daemon (default target is 127.0.0.1:9700)
ocpp-cp-sim --cp-id CP001 --send '{"command":"status"}'
# Send command via an explicit TCP URL
ocpp-cp-sim --cp-id CP001 --http-url http://127.0.0.1:9701 \
--send '{"command":"status"}'
# Subscribe to real-time events for one CP
ocpp-cp-sim --cp-id CP001 --events
# Subscribe to all CP and registry events
ocpp-cp-sim --events --all
# Talk to a daemon protected by --web-console-basic-auth-*
ocpp-cp-sim --cp-id CP001 --http-url http://127.0.0.1:9700 \
--send '{"command":"status"}' \
--http-basic-auth-user admin --http-basic-auth-pass secret
# Stop CP001's running transactions (reason Other), wait for the answers, then disconnect
ocpp-cp-sim --cp-id CP001 \
--send '{"command":"disconnect","params":{"stopTransactions":true}}'
# Shut down the server
ocpp-cp-sim --stop--send is for CP-scoped JSON commands and requires --cp-id. Daemon-level
methods such as cp.create, logs.get, and state.reset are available over
the Socket.IO RPC contract documented in
Control plane → Daemon methods
and through the browser UI. stopTransactions on disconnect and cp.delete is a daemon feature
(Control plane → Stopping transactions on close):
the standalone JSON Lines and REPL disconnect ignore it. How the client authenticates to a protected
daemon is covered in Access control.
--time-scale <N> (every mode, daemon included) makes the charge points of the process read a clock that runs N times
faster than the wall clock (a ScaledClock: timers fire after ms / N real milliseconds, now() advances N times faster
from the wall-clock time the process started at). A scenario with a 5-minute Auto MeterValue node finishes in 5 / N
minutes against a real CSMS, which the in-process VirtualClock of the tests cannot do (it only moves when told to
and keeps real I/O out).
ocpp-cp-sim --ws-url ws://localhost:9000/ocpp --cp-id CP001 --json --time-scale 20Limits, all consequences of only the charge point's clock being accelerated:
- Wire timestamps run ahead of the wall clock (
StartTransaction.timestamp,MeterValuessampled times, a reservation's expiry the charge point computes): after 60 s of real time at N = 20 they are 20 minutes ahead. A CSMS that validates timestamps against its own clock may reject or flag them. - The CSMS sees N times the traffic: Heartbeats, MeterValues and retries come N times as often, and the energy a meter node adds per interval is unchanged, so a transaction accrues N times the energy per real second. A CSMS that rate-limits or disconnects a chatty station will react.
- CSMS-side timeouts do not accelerate, the charge point's do: its own wait for an answer (the call timeout of the
serial CALL queue, retry intervals, reconnect back-off) shrinks to
ms / Nreal milliseconds, so a CSMS that answers slowly looks unresponsive at a high N. Keep N small (20 or less) against a real CSMS; a local mock tolerates more. - Scenario
forSecondsloops,delaynodes, wait timeouts andmaxDurationSecondscount station time, so they speed up with it. The run history'sstartedAt/endedAtanddurationMsare wall-clock. - It is read once at startup; there is no command to change it while the process runs.
ocpp-cp-sim analyze <trace.jsonl> runs OCPP DebugKit's failure-pattern
detection over a trace file or a running
daemon's stored logs and writes a Markdown / HTML report. It has its own page:
analyze.
ocpp-cp-sim cp probe checks whether a charge point with the given settings
would get into the CSMS, before anything is created (#1132). It takes the
connection flags of a local charge point — --cp-id, --ws-url,
--ocpp-version, --basic-auth-user / --basic-auth-pass,
--security-profile, --authorization-key, --tls-ca / --tls-cert /
--tls-key, --header, --ws-subprotocol and the --ws-* handshake flags —
opens one WebSocket handshake exactly as that charge point would, and closes
it. No OCPP message is sent and nothing is created.
ocpp-cp-sim cp probe --cp-id CP001 --ws-url wss://csms.example.com/ocpp \
--security-profile 2 --authorization-key 0011…ff --json
# {"ok":false,"code":"credentials_refused","stage":"upgrade","httpStatus":401,
# "url":"wss://csms.example.com/ocpp/CP001","message":"…","hint":"…",…}- Without
--jsonit printsok: <url> (subprotocol …), orfailed: <code> at <stage>with the URL, message and hint, then any warnings (e.g. a URL that already ends with the charge point id). - Exit status: 0 when the verdict is
ok, 1 otherwise, including a probe that could not run (bad flags, an unreachable daemon). - The budget is
--ws-handshake-timeout-ms(default 8000). --http-url <url>(with--http-basic-auth-*) runs the check on that daemon instead, from its network, through thecp.probeRPC; TLS files are then read on the daemon's host.- The SOAP versions have no WebSocket and are refused.
The verdict fields and every code / stage are listed under
cp.probe.
Needs Bun: on Node,
--behaviorandbehavior buildfail with a "needs Bun" message (see Runtimes).
A behavior is a TypeScript or
JavaScript module whose default export is a behavior ({ api: 1, id, requires?, onCall?, on?, beforeSend?, main?, onResume? })
or an array of them. It answers CSMS CALLs and drives the station through a narrow ctx port. api: 1 is a
preview (Stability lists the experimental members: ctx.raw,
ctx.setConnectorStatus, onResume, useBehavior, the browser loader). What the station does without any
behavior is in Default behaviors; which of a scenario, a policy and a behavior answers a
CALL is in Who answers an inbound CALL; whether to write JSON or code is in
Scenario or behavior?.
ocpp-cp-sim --cp-id CP001 --ws-url ws://localhost:9000 --behavior examples/behaviors/flaky-firmware.ts
ocpp-cp-sim behavior build examples/behaviors/flaky-firmware.ts --out dist/flaky-firmware.js--behavior <file>(repeatable) bundles the file withBun.build(TypeScript is read directly, relative imports are followed,k6/*stays external), imports it and loads every behavior onto every charge point the process runs: the one of a single-CP session, and in a daemon the bootstrap, the restored and the ones created over RPC. A file that does not load (syntax error, bad default export, a duplicate id, an id starting withdefault.or naming an object member, an unknownrequires, a physical verb orctx.rawused withoutphysical/raw-frameslisted,mode: "extend"on an action with no default, arequiresthe station cannot meet) stops the start with exit code 1 and the file's name.afterand the answer. Anafterreturned with an answer runs once that answer settled on the wire, and is skipped with a warning when it was not delivered (a closed or changed connection): do not hang a reboot you need on an answer the CSMS may not have got.afterdoes not keep the rule busy.- Disable a default. There is no
disablemode: replace the action with the valid answer and no follow-up,onCall: { UpdateFirmware: { mode: "replace", handle: (_req, ctx) => ({ response: ctx.accepted("UpdateFirmware") }) } }(the station answers and does nothing else), or{ noResponse: true }to stay silent, or{ error: { code: "NotSupported", description: "…" } }. For a station-initiated message (Heartbeat, MeterValues, StatusNotification) usebeforeSend: { Heartbeat: () => ({ drop: true }) }; the station then never gets an answer to it, and what that breaks (a droppedStartTransactionleaves the transaction without a CSMS id) is yours. More recipes: Scenario or behavior?. - The code runs with this process's full authority. It comes from the command line and nowhere else:
Socket.IO, MCP and OCPP carry data, never code, and there is no RPC method that loads a behavior. A scenario
that arrives over
load_scenariowith fields that look like code is stored or refused as data (behaviorCodeIsNotRemote.bun.test.ts). - A daemon (
--daemon,--http-port,--web-console) additionally needs--allow-behavior-code, and refuses--allow-behavior-codetogether with--unsafe-remote: a daemon that runs code from disk must not also drop its network protections. Both refusals exit with code 1 and say which flag to remove. The flag has no effect on a single-CP session.--behavioris refused with--send,--stopand--events. behavior build <file> [--out <file>]type-checks the behavior (strict, ES2017 libraries only, soAbortController,structuredClone,performanceand the like are errors, as on k6;k6andk6/*need no types), then writes one ESM bundle with ES2017 output andk6/*external. Default output:<name>.bundle.jsnext to the source. It fails, namingfile:line:column, onfor await, async generators andusing/await using, in the file or in anything it imports: k6 hangs silently on them. The syntax check runs before the type check, because the ES2017 library turns the same constructs into confusing "cannot find name" errors.- The ESLint config
@ocpp-cp-simulator/contracts/eslint-behavior(packages/contracts/eslint/behavior.js, a flat config array) reportsDate,performance,Math.random,crypto.randomUUID, timers, module-scopelet/var, module-scope empty arrays / objects andnew Map/Set, and the three syntaxes above. Spread it after your own TypeScript parser setup. examples/behaviors/flaky-firmware.tsis a template (UpdateFirmware with a seeded failure) andflaky-firmware.bun.test.tsbeside it shows the same-seed test onrunBehavior().- A behavior's
ctx.stateand the notification statuses survive a restart with--state-db: State persistence. - Event hooks and
beforeSend.on: { connectorStatus, transactionStarted, transactionStopped, connected, disconnected, callResult, callReceived }observes the station (after the turn that caused the event, never nested in it, not awaited, a throw is logged and changes nothing) andbeforeSend: { MeterValues(payload, ctx) { … } }rewrites or drops ({ drop: true }) a station-initiated CALL before it is queued, synchronously;ctx.accepted("UpdateFirmware")/ctx.rejected(…)return the valid canned response of this station's OCPP version. Details and decisions: Charger engine and its migration history;examples/behaviors/disconnect-on-charging.tsis a template using hooks andbeforeSend.
--behavior files go into a library, by behavior id. Without further flags every charge point runs every
loaded behavior (as before). To give charge points different behaviors:
# one charge point, only one of the two loaded behaviors
ocpp-cp-sim --cp-id CP001 --ws-url ws://localhost:9000 \
--behavior a.ts --behavior b.ts --use-behavior b
# a daemon: charge points pick theirs by id over the control plane (ids only, never code)
ocpp-cp-sim --http-port 8080 --allow-behavior-code --watch-behaviors --behavior a.ts --behavior b.ts
# cp.create { cpId, wsUrl, behaviors: ["a"] } cp.behaviors.set { cpId, behaviors: ["b"] }-
--use-behavior <id>(repeatable) selects the behaviors of the charge points the command line itself starts (--cp-id,--cp-count); for one the state database restored under that id it replaces the stored selection (logged); it needs--behaviorand--cp-id. An unknown id stops the start with exit code 1 andUnknown behavior id "x"; loaded behaviors: a, b. Charge points created later choose with thebehaviorsparameter ofcp.create/cp.create_many/cp.update/ a blueprint, orcp.behaviors.set(Control plane → Behaviors). -
--behavior-params <id>=<json file or inline json>(repeatable, one per id) sets the params of a behavior on the same charge points:<id>is a loaded behavior or a built-indefault.*one. A value that starts with{is inline JSON, anything else is the path of a JSON file; it must be an object. It needs--cp-id, and a--behavioris needed only for a loaded behavior (default.*ids need none). The object is checked against the behavior's params schema (behavior.list); a value that does not fit, an unknown key, an id the charge point does not run or JSON that is not an object stops the start with exit code 1 and the reason, and nothing is converted. JSON only: a string in it is never evaluated.ocpp-cp-sim --cp-id CP001 --ws-url ws://localhost:9000 \ --behavior-params 'default.firmware={"stepMs":500,"failAt":"InstallationFailed"}' \ --behavior-params default.reset=./reset-params.json -
--watch-behaviorsre-bundles a behavior file when a file in its directory changes (150 ms debounce) and applies the new version without a restart; the daemon methodbehavior.reloaddoes the same on demand (only with--watch-behaviorsor--allow-behavior-reload) and accepts no path or code. A file whose bundle did not change is not imported again. A top level that has not finished after 2 s fails the reload. Reload is atomic per file (a file that fails to build or load keeps the old version and logs the error), exchanges in flight finish on the old code,ctx.statestays, and a runningmainis asked to stop (ctx.stopping) and gets 5 s before the newmainstarts. A reload cannot add or remove behavior ids (restart for that). Each reload imports a fresh bundle from a new temporary directory, which is removed afterwards, so the runtime's module cache never serves an old version.
Export a scenario JSON as a runnable k6 load-test bundle:
ocpp-cp-sim export-k6 --scenario charge.json -o loadtest/(--behavior instead of --scenario exports behavior code: below.)
The bundle contains a scenario.k6.ts entry, a self-contained TypeScript
OCPP runtime (ocpp-runtime/), the scenario, and a README with the full
environment-variable reference (PROFILE=spike|steady|soak, VUS,
CP_IDS_FILE, mTLS notes). Requires k6 >= v1.6.0 (the bundle uses the
stable k6/websockets module, not the deprecated
k6/experimental/websockets). Phase 1 supports OCPP 1.6J.
CSMS_URL=wss://csms.example.com/ocpp k6 run loadtest/scenario.k6.tsThe bundle is a second implementation of the scenario semantics, not the daemon compiled to another target, and it models a deliberately reduced subset: enough to put realistic OCPP traffic on a CSMS at volume, not enough to reproduce the simulator's meter physics. The line was drawn when the charging-curve model landed — the k6 export ignores the curve and keeps its flat rate rather than porting the model into the runtime — and it is stated here so each difference is not discovered one at a time.
| Behaviour | In the exported runtime |
|---|---|
| Auto-meter time curve, session-relative | Yes, and agreeing: the curve is shifted so its value at session start (t = 0, not its earliest point) lands on the register the run started from, so a second session never rewinds and a curve beginning above zero is not double-counted. The trajectory between the points agrees too — see the row below. |
| Auto-meter curve shape between its points | Yes, since #329: both runtimes evaluate the same De Casteljau Bezier over all control points, from one module the bundle copies verbatim. The export used to interpolate piecewise-linearly, which agreed only on a two-point curve and from three points on ran ahead by up to ~15% of the curve's span at its midpoint. A bundle regenerated after #329 can therefore send different MeterValues than one generated before it, for a curve with three or more control points. A curve of three or more points can send different values, not always: the Bezier and the polyline coincide when the control points are evenly spaced on a straight line (a plain (0,0) (10,10) (20,20) ramp) or all carry the same value. Collinearity alone is not enough — (0,0) (5,5) (20,20) is collinear, unevenly spaced, and differs by 2.5 kWh at its widest. |
| Energy register integral on the wire | Yes: meterStart, meterStop and the register sample are rounded at the wire, and the unrounded value is carried between ticks. |
maxValue / maxTime / target-SoC stop conditions |
Yes, judged on the delivered value. |
Battery charging curve (evSettings.chargingCurve) |
No — chargingCurve is not read; the rate is the scenario's own increment or time curve. |
Electrical model (currentType, phases, voltageV, powerFactor) |
No — the runtime sends one measurand, Energy.Active.Import.Register. No current, voltage, power or power-factor samples, and so no per-phase samples. |
SetChargingProfile limits |
No — the auto-responder Accepts the call and the profile is never applied, so nothing caps the meter. |
| State of charge | Arithmetic only — SoC is computed inside the target-SoC stop condition. It is not tracked, sampled or persisted, so the SoC-ownership rules do not apply. |
| Persistence / restart resume | No — a k6 VU is a fresh charge point each run. |
EV-side disconnect (connectorPlug plug-out, #488) |
No — a plug-out sends StatusNotification Available; StopTransactionOnEVSideDisconnect is not modelled, so only a transaction stop node ends the transaction. |
A scenario that relies on anything in the "No" rows still exports and runs; it simply generates traffic at the scenario's configured rate rather than the simulated one. The rows marked "Yes" are the ones a change to scenario behaviour has to reach in both places (#301).
The tables below are the machine-checked half of the same boundary:
apps/cli/src/exportK6/__tests__/documentedSubset.test.ts reads them out of this
page and compares them against packages/core/schema/scenario.schema.json and the runtime's
own source, so a scenario node type or an evSettings field cannot be added to
the domain — or quietly implemented in the export — without this page moving
too. A missing or wrongly-marked row fails that test with a message naming the
field and the two ways out: implement it in the runtime, or record here that
the export does not (#329).
"Honoured" means the exported runtime reads the field, or walks the node type, at all. It is not a claim that the behaviour matches the simulator's in every detail — the table above is where those differences live.
| Scenario node type | Honoured |
|---|---|
start |
Yes |
end |
Yes |
statusChange |
Yes |
transaction |
Yes |
meterValue |
Yes |
delay |
Yes |
notification |
Yes |
connectorPlug |
Yes |
remoteStartTrigger |
Yes |
remoteStopTrigger |
Yes |
statusTrigger |
Yes |
reserveNow |
Yes |
cancelReservation |
Yes |
reservationTrigger |
Yes |
statusNotification |
Yes |
unlockOutcome |
Yes |
configSet |
Yes |
dataTransfer |
Yes |
csmsCallTrigger |
Yes |
responseOverride |
Yes |
inboundPolicy |
No |
certQuirks |
No |
connectionTrigger |
No |
ocppCall |
Yes |
callResponse |
No |
useBehavior |
No |
notify |
No |
switch |
No |
choice |
No |
setState |
No |
parallel |
No |
join |
No |
A scenario containing a node type marked "No" is refused by export-k6 with
the offending type named, rather than exported and silently skipped. The schema 1.5 additions
(Scenario format)
are refused with their own reason: callResponse and useBehavior (they need a station behavior
engine the k6 runtime does not have), a csmsCallTrigger with behavior: "replace" (or an onBusy),
and an ocppCall whose payload holds {"$from": …}. The schema 1.6 additions (#654) are refused too: the notify, switch, choice and setState nodes, and a delay with until or jitterSeconds (the k6 runtime waits for delaySeconds only). The schema 1.9 parallel and join nodes are refused (the k6 interpreter has no branch-scoped cancellation). A timeout edge (schema 1.8, an edge with kind: "timeout") is refused naming the edge and its source: the k6 runtime fails the iteration when a wait times out. A loop edge (schema 1.10, an edge with kind: "loop") is refused naming the edge and its source: the k6 runtime has no loop bounds (times, forSeconds, until), so run such a scenario on the simulator. The k6 runtime always lets the station answer a
CALL, so none of them is ever exported as the observing node it resembles.
ocpp-cp-sim export-k6 --behavior examples/behaviors/flaky-firmware.ts -o loadtest/
CSMS_URL=ws://localhost:9000 VUS=5 DURATION=30s RUN_FOR_MS=14000 k6 run loadtest/behavior.k6.ts--behavior <file> (repeatable; exclusive with --scenario) exports behavior code
instead of a scenario. The file is type-checked and bundled as by behavior build, the bundle is copied to
behaviors/, and behavior.k6.ts imports it statically (nothing is loaded by name at run time). OCPP 1.6J only.
The k6 side is BehaviorHost (packages/k6-runtime/src/behaviorHost.ts): ctx over the same charge point the
scenario interpreter drives. ctx.sleep and ctx.until are timers of the host, never k6 sleep(), so one VU can
drive several charge points (CHARGERS_PER_VU) and stopping rejects every pending wait.
What an iteration does: each VU connects its charge points, starts every main and onCall rule, and stops when
every main returned, at RUN_FOR_MS, or 2 s before the end of a steady / soak run (DURATION, or its default of 5 m / 1 h), whichever is first (a
behavior with no main and no RUN_FOR_MS serves CALLs for 60 s). Stopping sets ctx.stopping, rejects the waits
and closes the sockets before k6's gracefulStop starts counting; a main that waits on something the host does
not own is abandoned after 1.5 s and the iteration is reported failed. SEED seeds ctx.random (same algorithm and
key as the simulator).
Refused at export, with the file and the reason named:
| Refused | Why |
|---|---|
requires of physical or ocpp2.x |
The k6 host has no connector model, runs on real time, and speaks 1.6J only. |
mode: "extend", ctx.defaultBehavior |
The k6 auto-responder has no default behavior with follow-ups to extend. |
ctx.connector, ctx.plugIn, unplug, authorize, startCharging, stopCharging, setConnectorStatus |
No connector model. The check is syntactic (it also flags a property of that name); the members throw at run time too. |
on.connectorStatus, on.transactionStarted, on.transactionStopped |
They need a connector and transaction model the k6 host does not have; never silently ignored. |
A bundle that imports k6 modules |
The export loads the bundle to read requires and the rules; it cannot do that. |
The k6 host does provide on.connected, on.disconnected, on.callResult, on.callReceived (same delivery
rule as in the simulator: after the turn, FIFO, not awaited), beforeSend (the k6 client asks the host before it
queues any CALL, the automatic Heartbeat included; a dropped CALL rejects its caller with OcppCallNoAnswerError
and is never queued) and ctx.accepted / ctx.rejected (the export writes the 1.6 answers into behavior.k6.ts).
Per-charger assignment and reload do not apply to k6 (one export, one set of behaviors).
Responses are not checked against the OCPP schema (skipValidation has nothing to skip), and a CALL no rule claims
is answered by the same auto-responder as in a scenario export. Environment variables are in the generated README.
Measured results: Charger engine migration → Verification results.
evSettings field |
Honoured |
|---|---|
batteryCapacityKwh |
Yes — denominator of the target-SoC stop condition |
initialSoc |
Yes — opening SoC of the target-SoC stop condition |
targetSoc |
Yes — the target-SoC stop condition's threshold |
maxChargingPowerKw |
Yes — default rate when the meterValue node sets no outputKw |
modelName |
No — cosmetic; nothing on the wire carries it |
chargingCurve |
No — the rate is the scenario's own increment or time curve |
currentType |
No — one measurand only, Energy.Active.Import.Register |
phases |
No — no per-phase samples |
voltageV |
No — no voltage or current samples |
powerFactor |
No — no reactive-power model |
vehicleBehavior |
No — no vehicle model; the rate is the scenario's own increment (#835) |
attribution |
No — informational credit for imported data (#458) |
Events are emitted in all modes:
- REPL shows formatted text.
- JSON Lines mode emits JSON event lines.
- Daemon mode emits Socket.IO
eventenvelopes withkind: "cp"orkind: "registry"(see Control plane → Event push and rooms).
| Event | Data Fields | Description |
|---|---|---|
connected |
- | WebSocket to the CSMS opened — transport only, not registration: see boot_notification |
boot_notification |
status, interval, currentTime |
Answer to BootNotification.conf processed: status is Accepted / Pending / Rejected, interval and currentTime the CSMS's. Once per BootNotification.conf, after connected and before its status changes (#395) |
disconnected |
code, reason |
Disconnected from CSMS. Once per socket, before the connected of the socket that replaces it; a reset of an open socket reports code 1005 (see Log format, #478) |
status_change |
status |
Charge point status changed |
error |
error |
Error occurred. A WebSocket close raises one only when the CP did not ask for it (not a disconnect, reset or network-sim cut) and its code is neither 1000 nor 1005 (#474); the next boot clears it with "" |
connector_status |
connectorId, status, previousStatus |
Connector status changed |
status_notification_suppressed |
connectorId, from, to, reason |
A status change outside the OCPP 1.6 §4.9 table was applied locally (a connector_status precedes it) but its StatusNotification was not sent: the capability profile sets statusTransitions: "enforce"; reason is invalidTransition (Status transitions, #618) |
transaction_started |
connectorId, transactionId, tagId |
Transaction started. On OCPP 1.6 it is emitted twice: once with the local placeholder id 0, again with the id StartTransaction.conf assigned — whatever integer that is, 0 included (#328). Tell the two apart by order, never by value. |
transaction_stopped |
connectorId, transactionId |
Transaction stopped |
meter_value |
connectorId, meterValue |
Meter value updated |
scenario_started |
connectorId, scenarioId |
Scenario execution started |
scenario_completed |
connectorId, scenarioId |
Scenario execution completed |
scenario_error |
connectorId, scenarioId, error |
Scenario execution failed |
scenario_node_execute |
connectorId, scenarioId, nodeId |
Scenario node executed |
scenario_state_changed |
connectorId, scenarioId, state, nodeId, expectation |
The scenario's execution state changed (idle, running, waiting, paused, completed, error, ...); nodeId is the current node, expectation the condition a parked wait awaits (type, action, targetStatus, ...) or null; also runId, and error on failure. Block on it with wait_for (#1090) |
scenario_wait_changed |
connectorId, scenarioId, kind |
An operator extended, retried or continued the wait the scenario is parked on (kind: extend / retry / continue; also carries nodeId and runId) (#240) |
scenario_run_recorded |
connectorId, scenarioId, runId |
A finished run's report was added to the daemon's run history, so a client listing runs can re-list (#388) |
timeline_entry |
the entry (seq, timestamp, kind, …) |
An entry was added to the charge point's operational timeline (#448) |
charging_session |
the whole session (sessionId, …) |
A charging session was opened, updated or closed and stored; carries the full record (#447) |
csms_call_received |
action, messageId, payload |
The CSMS sent a CALL (any OCPP-J action; a dispatchable SOAP one), announced before it is handled; see CSMS call events (#396) |
csms_call_completed |
action, messageId, outcome |
The simulator decided its answer to that CALL: CallResult, CallError (with errorCode) or NoResponse; see CSMS call events (#396) |
csms_call_received and csms_call_completed give an orchestrator direct
evidence that a command came through the CSMS, rather than inferring it from
the state change it caused (#396). The operation handlers, scenario hooks and
the OCPP answer are unchanged.
- Scope. On OCPP-J (1.6J, 2.0.1, 2.1) every inbound CALL gets exactly one
pair, whatever the action — an unsupported one completes as
CallError/NotImplemented. On SOAP (1.2, 1.5, 1.6S) only a dispatchable call does: a CS→CP operation of the station's dialect, addressed to it. A SOAP request refused before dispatch — an operation the dialect does not define (a 1.6-onlyTriggerMessagesent to a 1.5 station), another charge point's identity, a response instead of a request — is answered with a Fault and emits neither event, because announcing it would also release a scenariocsmsCallTriggerwaiting on that action (#257). - Correlation.
messageIdis the CALL's UniqueId (the WS-AddressingMessageIDon SOAP, which the envelope parser requires). Repeated calls of the same action are told apart by it.actionis the name on the wire: a 2.x station reportsRequestStartTransaction, not its 1.6 alias. - Order.
csms_call_receivedis emitted as the CALL enters dispatch, before anyinboundPolicy,responseOverrideor operation handler runs.csms_call_completedis emitted once the answer is decided, just before it is handed to the transport: after the handler's synchronous work and before any post-response effect (aResetreboots after it). - Answer, not state.
csms_call_completedconfirms the OCPP answer the station chose, never the state transition the call leads to. Watch the state events for that. On the default 1.6J path aRemoteStartTransactionhandler starts the transaction itself, sotransaction_startedprecedescsms_call_completed. When a scenario owns the remote start (remoteStartTrigger), the handler only hands the call to the scenario and answersAccepted; the transaction starts later, when the scenario reaches itstransaction(action: "start") node, if at all. - Outcome.
CallResultfor a response — including one chosen by aresponseOverride;CallErrorfor a CALLERROR (aninboundPolicy, a 2.xFormationViolation,NotImplemented, theInternalErrora handler failure answers on 1.6J and 2.x — on 2.x its description is the error message, capped at 255 characters (#399)), witherrorCode;NoResponsewhen aninboundPolicyof kindignorewithholds the answer. On SOAP a Fault answering a dispatched call is aCallErrorwhoseerrorCodeis the Fault code (Sender/Receiver). - Not delivery. The outcome is the answer chosen, not proof it reached the CSMS: a socket that closes, or a network-simulation drop, can still lose it.
- Redaction.
payloadis redacted before either channel sees it: aChangeConfigurationofAuthorizationKeyand a 2.xSetVariablesofBasicAuthPassword/AuthorizationKeycarry[redacted]as the value; a 2.xSetNetworkProfilecarries[redacted]asvpn.keyand has noapn.apnPassword/apn.simPin/vpn.passwordfield, nor a 2.1connectionData.basicAuthPassword(#401). TheReceived:log line of the same OCPP-J frame hides those values too (Log format → Redaction, #400).
{"event":"csms_call_received","data":{"action":"Reset","messageId":"b7e1…","payload":{"type":"Soft"}},"timestamp":"…"}
{"event":"csms_call_completed","data":{"action":"Reset","messageId":"b7e1…","outcome":"CallResult"},"timestamp":"…"}| Option | Required | Default | Description |
|---|---|---|---|
--cp-id <id> |
Yes* | - | Charge Point ID |
--ws-url <url> |
Yes** | - | WebSocket URL of CSMS (or the SOAP CentralSystemService URL for SOAP versions, see OCPP versions & transports) |
--connectors <n> |
No | 1 |
Number of connectors |
--cp-count <n> |
No | 1 |
Server mode: bootstrap N charge points instead of one, sharing every option but the id (#295) |
--cp-id-pattern <tpl> |
No | <cp-id>{n:03} |
Id template used with --cp-count. {n} is the index, {n:03} zero-pads it |
--fleet-template <file> |
No | none | Server mode, repeatable: load fleet templates from a JSON file; see Daemon (#445) |
--bootstrap-concurrency <n> |
No | 8 |
Server mode: charge points started at once; see Daemon (#610) |
--start-delay <ms> |
No | 0 |
Server mode: ms between the scheduled starts of consecutive charge points (#610) |
--start-jitter <ms> |
No | 0 |
Server mode: seeded random 0..ms-1 added to each start (#610) |
--start-seed <n> |
No | 0 |
Server mode: seed of --start-jitter; refused without it (#610) |
--label <key=value> |
No | none | Server mode, repeatable: label every bootstrapped charge point. Split on the first =; a bad key or value, a key given twice or more than 32 labels is refused at startup, and so is the flag without --cp-id, outside a server mode or beside --send / --stop / --events. A charge point restored from --state-db keeps its stored labels, and the startup log says so (#472) |
--ocpp-version <ver> |
No | OCPP-1.6J |
OCPP-1.6J, OCPP-2.0.1, OCPP-2.1, or the SOAP versions OCPP-1.2, OCPP-1.5, OCPP-1.6S, for a directly started or bootstrapped CP |
--soap-callback-url <url> |
No | - | SOAP versions: full callback URL the CSMS reaches the CP on (used verbatim) |
--soap-public-base-url <url> |
No | - | SOAP versions: public base the callback URL is derived from (<base><soap-path>/<cp-id>/ChargePointService) |
--soap-tunnel <none|ngrok> |
No | none |
SOAP versions, server mode only: expose the callback endpoint through a tunnel and derive the callback URL from its public origin (see OCPP versions & transports → Tunnels). Cannot be combined with --soap-callback-url / --soap-public-base-url — the tunnel is what provides the public base. Every SOAP charge point created without a callback URL (flags, RPC, console) derives one from it. |
--ngrok-auth-token <token> |
No | - | ngrok authtoken, handed to the agent through its environment (NGROK_AUTHTOKEN) — never on its command line, never logged. Without it the agent uses its own config file or an inherited NGROK_AUTHTOKEN. Requires --soap-tunnel ngrok. |
--ngrok-domain <domain> |
No | - | Reserved ngrok domain to request (ngrok http --url). Free-tier URLs change between runs. Requires --soap-tunnel ngrok. |
--ngrok-api-url <url> |
No | - | Attach to an already-running ngrok agent (e.g. a Docker sidecar, http://ngrok:4040) instead of spawning one; the https tunnel whose addr port is exactly --soap-tunnel-port is used; a tunnel to any other port is refused, even when it is the only one. Cannot be combined with the two options above. Requires --soap-tunnel ngrok. |
--soap-tunnel-port <port> |
No | 0 |
Local port of the SOAP-only listener the tunnel forwards to; 0 picks a free one. Required with --ngrok-api-url (the running agent forwards to the port it was configured with). Requires --soap-tunnel ngrok. |
--soap-path <path> |
No | /ocpp/soap |
Path prefix of the daemon-hosted SOAP ChargePointService endpoint |
--json |
No | - | JSON Lines mode |
--daemon |
No | - | Server daemon. With no --http-port, listens on http://127.0.0.1:9700. |
--http-port <port> |
No | 9700 with bare --daemon |
Enable the TCP health / Socket.IO server on this port |
--http-host <addr> |
No | 127.0.0.1 |
Bind address for HTTP. Non-loopback binds require web-console Basic Auth or --unsafe-remote. |
--behavior <file> |
No | - | Load behavior code into the library (every charge point runs all of it unless --use-behavior / behaviors picks); repeatable. Runs with the process's full authority. A daemon also needs --allow-behavior-code. See Behavior code. |
--allow-behavior-code |
No | - | A daemon's explicit opt-in to --behavior. Refused together with --unsafe-remote. |
--use-behavior <id> |
No | all loaded | Run only the loaded behavior with this id on the charge points started from --cp-id; repeatable. Needs --behavior and --cp-id. See Choosing behaviors per charge point. |
--behavior-params <id>=<json> |
No | - | Params for a loaded or built-in default.* behavior on the charge points started from --cp-id; inline JSON or a JSON file; repeatable. See Choosing behaviors. |
--allow-behavior-reload |
No | - | Daemon only: answer the behavior.reload method without watching (it re-reads the --behavior files). Without it or --watch-behaviors the method is refused. Needs --behavior. |
--watch-behaviors |
No | - | Reload a --behavior file when it (or a file in its directory) changes; in a daemon behavior.reload does the same on demand. |
--unsafe-remote |
No | - | Allow a non-loopback daemon bind without --web-console-basic-auth-user/pass. Use only on trusted networks. |
--unix-socket <path|none> |
No | deprecated no-op | Accepted for launcher compatibility, prints one warning, and is ignored. |
--web-console [<port>] |
No | - | Serve the bundled browser UI alongside Socket.IO. Without a port, shares --http-port; with a port, serves on that listener. Needs a directory with index.html: <repo>/dist after bun run build, the dist/ a release package ships, a dist/ beside the binary, or --web-console-dist. On failure it names every path it searched. |
--web-console-dist <dir> |
No | - | Serve the console from this directory instead of searching. Must contain index.html; a wrong path is an error, never a silent fallback. The desktop app passes its Tauri resource dir here (#319). |
--web-console-basic-auth-user <u> |
No | - | Basic Auth user for incoming static assets and Socket.IO handshake auth. Pair with --web-console-basic-auth-pass. The configured health path is exempt. |
--web-console-basic-auth-pass <p> |
No | - | Basic Auth password for incoming static assets and Socket.IO handshake auth. Pair with --web-console-basic-auth-user. |
--http-url <url> |
No | http://127.0.0.1:9700 in client modes |
Client target: TCP HTTP base URL for Socket.IO |
--send <json> |
No | - | Send a CP-scoped JSON command to a running server |
--events |
No | - | Subscribe to daemon events over Socket.IO |
--all |
No | - | With --events, subscribe to all CP and registry events |
--stop |
No | - | Shut down the running server with server.shutdown |
--http-basic-auth-user <u> |
No | - | Basic Auth user the client modes (--send/--stop/--events) send as Socket.IO handshake auth to a daemon protected by --web-console-basic-auth-* |
--http-basic-auth-pass <p> |
No | - | Basic Auth password for the client modes (pair with --http-basic-auth-user) |
--basic-auth-user <u> |
No | - | Basic auth username for outgoing CP → CSMS WebSocket |
--basic-auth-pass <p> |
No | - | Basic auth password for outgoing CP → CSMS WebSocket |
--header KEY:VALUE |
No | - | Extra header for the outgoing CP → CSMS WebSocket upgrade. Repeatable. |
--ws-subprotocol <value> |
No | - | Extra subprotocol for the outgoing CP → CSMS WebSocket upgrade. Repeatable. |
--security-profile <0|1|2|3> |
No | 0 |
OCPP 1.6 security profile enforcement for the CP → CSMS transport. See Security profiles. |
--authorization-key <hex> |
No | - | AuthorizationKey used as the Basic Auth password for profiles 1 and 2 |
--tls-ca <path> |
No | - | PEM CA bundle used to verify the CSMS server certificate |
--tls-cert <path> |
No | - | PEM client certificate for profile 3 mutual TLS |
--tls-key <path> |
No | - | PEM client private key for profile 3 mutual TLS; must be mode 0600 |
--cpo-name <name> |
No | - | CPO name used when generating certificate signing requests |
--inbound-validation <off|warn|enforce> |
No | warn |
OCPP 1.6J: what to do with an inbound CALL whose payload breaks the request schema. warn logs and traces it and runs the handler; enforce answers an OCPP-J 1.6 CALLERROR; off skips the check (#593). See Inbound CALL validation. |
--tx-updated-meter-values |
No | on | OCPP 2.x: scheduler samples during a transaction ride TransactionEvent(Updated, MeterValuePeriodic) (#347); on by default since #551, so the flag is the explicit form. --no-tx-updated-meter-values opts out and sends standalone MeterValues again. See OCPP versions |
--insecure-tls-key-perms |
No | - | Allow a --tls-key file readable by group/other (local testing only) |
--vendor <vendor> |
No | CLI-Vendor |
Charge point vendor |
--model <model> |
No | CLI-Model |
Charge point model |
--scenario <file> |
No | - | Startup scenario JSON file (server mode). Mutually exclusive with --scenario-template / --scenario-template-file |
--scenario-template <id> |
No | - | Built-in scenario template id (server mode) — see Scenario templates |
--scenario-template-file <p> |
No | - | Path to a cpId-independent template JSON |
--scenario-connector <list> |
No | 1 |
all, single id (1), or list (1,2,3) |
--state-db <path> |
No | (in-memory) | Persist scenarios, ChangeConfiguration overrides, charging profile state, availability flags, pending transaction messages, registered CPs and logs to a SQLite file. See State persistence. |
--log-format <fmt> |
No | plain |
plain writes the legacy [ts] [LEVEL] [TYPE] message lines; json writes one JSON Lines object per line (same shape as the logs table + browser export + logs.get RPC). See Log format. |
--log-level <level> |
No | debug |
debug, info, warn or error: lines below it are dropped from the console and --log-file. The logs table and logs.get keep every entry. See Log format → Level and file output. |
--log-file <path> |
No | none | Also append the console log lines (the Logger output, including the wire lines) to this file. |
--log-max-size <size> |
No | none | Rotate --log-file before it passes this size (10m, 512k, bytes). |
--log-to-stderr |
No | off | With --json: print log lines (wire lines included) on stderr so stdout is pure JSON Lines (#1088) |
--log-rotate-daily |
No | off | Rotate --log-file when the local date changes. |
--log-keep <n> |
No | 5 |
Rotated files kept (file.1 … file.n). |
--shutdown-stop-transactions |
No | off | On any shutdown (SIGINT / SIGTERM, server.shutdown) stop every running transaction and wait for the CSMS to answer before exiting. See Daemon → Shutdown and restore. |
--shutdown-wait-ms <ms> |
No | 5000 |
Longest wait for those answers. A second signal ends the wait. Also the wait of cp.delete / disconnect with stopTransactions: true (Control plane), which needs no --shutdown-stop-transactions. |
--no-connect-restored |
No | off | Restore the charge points of --state-db without dialling them; connect with cp.connect / cp.bulk. |
--cp-bulk-wait-ms <ms> |
No | 10000 |
Per-charge-point wait of cp.bulk and cp.scenario.run (Control plane). |
--time-scale <N> |
No | 1 |
Run every charge point's clock N times faster than the wall clock (0 < N <= 10000; process-wide, not persisted): a 5-minute scenario takes 5 / N minutes. See Time scale. |
--trace-output <path> |
No | - | Append each OCPP-J (WebSocket) wire message as a JSONL trace record (Trace format) in REPL, JSON, and daemon modes; SOAP transport is not captured yet. |
--health-path <path> |
No | /v1/healthz |
Absolute path for the unauthenticated health-check JSON. The browser UI build must use matching VITE_HEALTH_PATH when this changes. |
--metrics |
No | off | Server mode: serve GET /metrics (Prometheus text exposition). See Daemon → Metrics |
--metrics-no-auth |
No | off | Implies --metrics and serves it outside the Basic Auth gate. Trusted networks only |
--watch |
No | off | Server mode: re-read the idTag and scenario files this daemon loaded when they change on disk, debounced. Refused outside a server mode rather than silently ignored, like --cp-count. See Daemon → File hot-reload (#314) |
--cors-origin <origin> |
No | loopback: open; remote: same-origin | Restrict browser Origins. Repeatable. Pass literal "*" to opt into open CORS. See Access control. |
--trust-forwarded-headers |
No | - | With same-origin CORS, also accept the public origin reported by X-Forwarded-Proto / X-Forwarded-Host. Use only behind a trusted reverse proxy. |
--trusted-proxy <ip|cidr> |
No | none | Repeatable. Believe X-Forwarded-* / Forwarded only from peers in these IPs / CIDRs, and treat the X-Forwarded-For chain behind them as the client address; a request whose Forwarded and X-Forwarded-* disagree gets 400. Implies the header trust of --trust-forwarded-headers for those peers. See Access control → Hardening. |
--allowed-host <name> |
No | none | Repeatable. Answer only to these Host names (plus IP literals and localhost); other names get 403. Against DNS rebinding. See Access control → Hardening. |
--require-tls |
No | off | Refuse (403) a non-loopback client that did not arrive over TLS, as a --trusted-proxy reports it. Needs --trusted-proxy on a non-loopback bind; behind a same-host proxy on a loopback bind pass --trusted-proxy 127.0.0.1 too (a startup warning says so). A request from a trusted proxy must report https, even from loopback; the health path is exempt. |
--rate-limit-per-ip <n> |
No | 0 (off) |
Requests per second one client IP may make (token bucket, burst n); excess gets 429 with Retry-After. The health path is exempt. |
--rate-limit-max-ips <n> |
No | 10000 |
Client IPs the rate limiter tracks at once; the least recently seen is dropped past it. |
--oed-base-url <url|none> |
No | OED_BASE_URL, else public |
Server mode: the Open EV Directory API the console imports vehicle profiles through (#458). Default https://evdb.juherr.dev, called only on import. none turns import off (vehicle_catalog.* answers unavailable). Anything else not http(s) is exit 1, a malformed OED_BASE_URL too. |
--oed-api-key-file <path> |
No | OED_API_KEY_FILE, else OED_API_KEY |
Server mode: file holding your personal Open EV Directory API key (e.g. a Docker secret); optional, the catalog is anonymous too. An unreadable or empty file is exit 1. No flag takes the key itself (a command line shows in ps); a key with import off only warns. |
--reservation-authorize-id-tag |
No | off | OCPP 1.6: authorize the idTag of a ReserveNow (local rules, then Authorize.req) before accepting it; a tag that is not Accepted answers Rejected. The station's own checks run first (#595). See Default behaviors. |
--meter-value-decimal-separator <.|,> |
No | . |
OCPP 1.6 (JSON and SOAP): decimal separator of every SampledValue.value sent ("112,5" with ,, #1133). Exits 1 with , on any other --ocpp-version. See Meter realism. |
--empty-meter-values |
No | off | Negative testing: the periodic and clock-aligned samples of a running transaction go out with an empty sampledValue list (non-conformant; on 2.x the outbound schema warning is logged, #1134). See Meter realism. |
--reconnect-max-attempts <n> |
No | -1 |
Reconnect attempts after a connection loss before giving up (-1 unlimited, 0 never). See Reconnect policy. |
--no-reconnect |
No | off | Never reconnect after a connection loss; the same as --reconnect-max-attempts 0 (#1089). |
--reconnect-mode <m> |
No | exponential |
exponential or fixed. OCPP 2.x follows OCPPCommCtrlr.RetryBackOff* instead of the base delay and the jitter. |
--reconnect-base-delay-ms <ms> |
No | 1000 |
Wait before the first reconnect attempt. |
--reconnect-max-delay-ms <ms> |
No | 30000 |
Cap of the exponential wait; at least the base delay. |
--reconnect-jitter-ms <ms> |
No | 0 |
Random extra wait in [0, ms] from a stream seeded by the CP id. |
--ws-handshake-timeout-ms <ms> |
No | off | Close a connection attempt that has not opened within <ms>; the reconnect policy then applies. Every runtime. See WebSocket client options. |
--ws-no-compression |
No | off | Do not offer permessage-deflate. Bun and Node. |
--ws-max-payload <bytes> |
No | off | Largest incoming message. Node only: under Bun the start is refused. |
--ws-proxy <url> |
No | off | http(s):// proxy for the upgrade (CONNECT). Bun only. |
--ws-local-address <ip> |
No | off | Local address to bind. Node only: under Bun the start is refused. |
--ws-offer-subprotocol <name> |
No | the OCPP version's | Offer exactly this Sec-WebSocket-Protocol instead of the default, as given (case variants, unknown names); repeat to offer several. --ws-subprotocol adds one to the default (#1092) |
--ws-no-subprotocol |
No | off | Offer no subprotocol at all (#1092) |
--ws-path-suffix <s> |
No | - | Append <s> to the URL after the charge point id, as given: /, /extra, ?token=x (#1092) |
--ws-cp-id-raw |
No | off | Put the charge point id in the path as given instead of percent-encoding it (#1092) |
--ws-ping-interval <s> |
No | 0 |
Send a WebSocket ping every <s> seconds; sets the OCPP key WebSocketPingInterval, which ChangeConfiguration changes later (#1093) |
--boot-retry-limit <n> |
No | -1 |
Automatic BootNotification re-sends after Rejected before stopping (-1 unlimited). |
* --cp-id is optional in server mode (no bootstrap CP). Required for
REPL/JSON and for --send/--events without --all.
** --ws-url is required for REPL/JSON, and only when bootstrapping a CP in
server mode. CPs created later via Socket.IO cp.create supply their own
wsUrl in the RPC params.
Environment variables (server mode, #458): OED_BASE_URL (used when
--oed-base-url is absent), OED_API_KEY_FILE and OED_API_KEY. The key
comes from --oed-api-key-file, else OED_API_KEY_FILE, else OED_API_KEY;
the rules and failure cases are in
Open EV Directory → Configuration.
Environment variables (every mode, #794): OCPP_SIM_ERROR_REPORTER turns on
opt-in error reporting and selects the adapter, a built-in name (sentry) or
a module specifier exporting createErrorReporter. The Sentry adapter also
needs SENTRY_DSN (SENTRY_ENVIRONMENT names the environment). Unset,
nothing is sent and no adapter is loaded; see
Error reporting.