}
/**
- * Updates the supervision server URL and optionally the CSMS basic auth credentials in configuration or station info.
- * @param url - The new supervision server URL
- * @param supervisionUser - The new CSMS basic auth user (optional; "" clears, undefined preserves)
- * @param supervisionPassword - The new CSMS basic auth password (optional; "" clears, undefined preserves)
+ * Updates the supervision server URL and optionally the CSMS basic auth credentials.
+ * @param url
+ * @param supervisionUser
+ * @param supervisionPassword
*/
public setSupervisionUrl (
url: string,
} else if (this.stationInfo != null) {
this.stationInfo.supervisionUrls = url
this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl()
- this.saveStationInfo()
}
- if (this.stationInfo != null && (supervisionUser != null || supervisionPassword != null)) {
+ if (this.stationInfo != null) {
if (supervisionUser != null) {
this.stationInfo.supervisionUser = supervisionUser
}
checkEvsesConfiguration(stationTemplate, this.logPrefix(), this.templateFile)
}
const stationInfo = stationTemplateToStationInfo(stationTemplate)
- // hashId and chargingStationId are intentionally not set here. They are derived
- // at the end of getStationInfo() so that any identity overrides coming from
- // ChargingStationOptions (baseName, fixedName, nameSuffix) are honoured.
stationInfo.templateIndex = this.index
stationInfo.templateName = buildTemplateName(this.templateFile)
createSerialNumber(stationTemplate, stationInfo)
baseName: z
.string()
.optional()
- .describe('Override the template base name used to derive the chargingStationId'),
+ .describe('Override the template base name used to derive the charging station id'),
enableStatistics: z.boolean().optional().describe('Enable charging station statistics'),
fixedName: z
.boolean()
.optional()
- .describe('Use baseName verbatim as chargingStationId instead of appending index/suffix'),
+ .describe('Use base name verbatim as charging station id instead of appending index/suffix'),
nameSuffix: z
.string()
.optional()
- .describe('Suffix appended to the derived chargingStationId (ignored when fixedName is true)'),
+ .describe(
+ 'Suffix appended to the derived charging station id (ignored when fixed name is true)'
+ ),
ocppStrictCompliance: z
.boolean()
.optional()
ProcedureName.SET_SUPERVISION_URL,
{
description:
- 'Set the OCPP server supervision URL for one or more charging stations. Optionally updates the CSMS basic auth credentials (empty string clears a credential, undefined preserves it).',
+ 'Set the OCPP server supervision URL and optionally the CSMS basic auth credentials for one or more charging stations',
inputSchema: z.object({
hashIds,
supervisionPassword: z
.string()
.optional()
- .describe('CSMS basic auth password (empty string clears)'),
+ .describe('CSMS basic auth password used on the supervision WebSocket'),
supervisionUser: z
.string()
.optional()
- .describe('CSMS basic auth user (empty string clears)'),
+ .describe('CSMS basic auth user used on the supervision WebSocket'),
url: z.url().describe('The OCPP server supervision URL to set'),
}),
},
placeholder="<template value>"
type="text"
>
- Fixed name (base name is full station name):
+ Fixed name:
<input
v-model="state.fixedName"
false-value="false"
$uiClient.setSupervisionUrl(
props.hashId,
state.value.supervisionUrl,
- state.value.supervisionUser,
- state.value.supervisionPassword
+ state.value.supervisionUser.length > 0 ? state.value.supervisionUser : undefined,
+ state.value.supervisionPassword.length > 0 ? state.value.supervisionPassword : undefined
),
'Supervision url successfully set',
'Error at setting supervision url',
expect(wrapper.find('#supervision-password').exists()).toBe(true)
})
- it('should send empty credential strings when only url is set', async () => {
+ it('should preserve existing credentials when only url is set', async () => {
const wrapper = mountComponent()
await wrapper.find('#supervision-url').setValue('wss://new-server.com:9000')
await wrapper.find('button').trigger('click')
expect(mockClient.setSupervisionUrl).toHaveBeenCalledWith(
TEST_HASH_ID,
'wss://new-server.com:9000',
- '',
- ''
+ undefined,
+ undefined
)
})
)
})
- it('should send empty password when only user is typed', async () => {
+ it('should preserve password when only user is typed', async () => {
const wrapper = mountComponent()
await wrapper.find('#supervision-url').setValue('wss://new-server.com:9000')
await wrapper.find('#supervision-user').setValue('alice')
TEST_HASH_ID,
'wss://new-server.com:9000',
'alice',
- ''
+ undefined
)
})