**`station add` options:**
-| Option | Required | Description |
-| ------------------------- | -------- | ------------------------------------ |
-| `-t, --template <name>` | Yes | Station template name |
-| `-n, --count <n>` | Yes | Number of stations to add |
-| `--supervision-url <url>` | No | Override supervision URL |
-| `--auto-start` | No | Auto-start added stations |
-| `--persistent-config` | No | Enable persistent OCPP configuration |
-| `--ocpp-strict` | No | Enable OCPP strict compliance |
+| Option | Required | Description |
+| ----------------------------------- | -------- | ------------------------------------------ |
+| `-t, --template <name>` | Yes | Station template name |
+| `-n, --count <n>` | Yes | Number of stations to add |
+| `--auto-start` | No | Auto-start added stations |
+| `--base-name <name>` | No | Override template base name for station id |
+| `--fixed-name` | No | Use base name verbatim as station id |
+| `--name-suffix <suffix>` | No | Suffix appended to derived station id |
+| `--ocpp-strict` | No | Enable OCPP strict compliance |
+| `--persistent-config` | No | Enable persistent OCPP configuration |
+| `--supervision-password <password>` | No | CSMS basic auth password |
+| `--supervision-url <url>` | No | Override supervision URL |
+| `--supervision-user <user>` | No | CSMS basic auth user |
**`station delete` options:**
#### supervision
```shell
-evse-cli supervision set-url --supervision-url <url> [hashId...] # Set supervision URL
+evse-cli supervision set-url --supervision-url <url> [--supervision-user <user>] [--supervision-password <password>] [hashId...] # Set supervision URL
```
#### performance
.description('Add stations from template')
.requiredOption('-t, --template <name>', 'station template name')
.requiredOption('-n, --count <n>', 'number of stations to add', parseInteger)
- .option('--supervision-url <url>', 'supervision URL for new stations')
.option('--auto-start', 'auto-start added stations')
- .option('--persistent-config', 'enable persistent OCPP configuration')
+ .option('--base-name <name>', 'override template base name for station id')
+ .option('--fixed-name', 'use base name verbatim as station id')
+ .option('--name-suffix <suffix>', 'suffix appended to derived station id')
.option('--ocpp-strict', 'enable OCPP strict compliance')
+ .option('--persistent-config', 'enable persistent OCPP configuration')
+ .option('--supervision-password <password>', 'CSMS basic auth password')
+ .option('--supervision-url <url>', 'supervision URL for new stations')
+ .option('--supervision-user <user>', 'CSMS basic auth user')
.action(
async (options: {
autoStart?: true
+ baseName?: string
count: number
+ fixedName?: true
+ nameSuffix?: string
ocppStrict?: true
persistentConfig?: true
+ supervisionPassword?: string
supervisionUrl?: string
+ supervisionUser?: string
template: string
}) => {
const payload: RequestPayload = {
numberOfStations: options.count,
options: pickDefined(options as Record<string, unknown>, {
autoStart: 'autoStart',
+ baseName: 'baseName',
+ fixedName: 'fixedName',
+ nameSuffix: 'nameSuffix',
ocppStrict: 'ocppStrictCompliance',
persistentConfig: 'persistentConfiguration',
+ supervisionPassword: 'supervisionPassword',
supervisionUrl: 'supervisionUrls',
+ supervisionUser: 'supervisionUser',
}) as RequestPayload,
template: options.template,
}
import { ProcedureName, type RequestPayload } from 'ui-common'
import { runAction } from './action.js'
-import { buildHashIdsPayload } from './payload.js'
+import { buildHashIdsPayload, pickDefined } from './payload.js'
export const createSupervisionCommands = (program: Command): Command => {
const cmd = new Command('supervision').description('Supervision URL management')
.command('set-url [hashIds...]')
.description('Set supervision URL for station(s)')
.requiredOption('--supervision-url <url>', 'supervision URL')
- .action(async (hashIds: string[], options: { supervisionUrl: string }) => {
- const payload: RequestPayload = {
- url: options.supervisionUrl,
- ...buildHashIdsPayload(hashIds),
+ .option('--supervision-password <password>', 'CSMS basic auth password')
+ .option('--supervision-user <user>', 'CSMS basic auth user')
+ .action(
+ async (
+ hashIds: string[],
+ options: {
+ supervisionPassword?: string
+ supervisionUrl: string
+ supervisionUser?: string
+ }
+ ) => {
+ const payload: RequestPayload = {
+ url: options.supervisionUrl,
+ ...pickDefined(options as Record<string, unknown>, {
+ supervisionPassword: 'supervisionPassword',
+ supervisionUser: 'supervisionUser',
+ }),
+ ...buildHashIdsPayload(hashIds),
+ }
+ await runAction(program, ProcedureName.SET_SUPERVISION_URL, payload)
}
- await runAction(program, ProcedureName.SET_SUPERVISION_URL, payload)
- })
+ )
return cmd
}
const result = await runCli(['station', 'add'])
assert.strictEqual(result.code, 1)
})
+
+ await it('should show identity and credential options in station add help', async () => {
+ const result = await runCli(['station', 'add', '--help'])
+ assert.strictEqual(result.code, 0)
+ assert.ok(result.stdout.includes('--base-name'), 'Expected --base-name option')
+ assert.ok(result.stdout.includes('--fixed-name'), 'Expected --fixed-name option')
+ assert.ok(result.stdout.includes('--name-suffix'), 'Expected --name-suffix option')
+ assert.ok(result.stdout.includes('--supervision-user'), 'Expected --supervision-user option')
+ assert.ok(
+ result.stdout.includes('--supervision-password'),
+ 'Expected --supervision-password option'
+ )
+ })
+
+ await it('should show credential options in supervision set-url help', async () => {
+ const result = await runCli(['supervision', 'set-url', '--help'])
+ assert.strictEqual(result.code, 0)
+ assert.ok(result.stdout.includes('--supervision-user'), 'Expected --supervision-user option')
+ assert.ok(
+ result.stdout.includes('--supervision-password'),
+ 'Expected --supervision-password option'
+ )
+ })
})