AttributeEnumType,
ConnectorEnumType,
ConnectorStatusEnum,
+ DataEnumType,
ErrorType,
GenericDeviceModelStatusEnumType,
type IncomingRequestHandler,
type OCPP20NotifyReportRequest,
type OCPP20NotifyReportResponse,
OCPP20RequestCommand,
+ OCPP20VariableName,
OCPPVersion,
ReportBaseEnumType,
type ReportDataType,
},
],
variableCharacteristics: {
- dataType: 'string',
+ dataType: DataEnumType.string,
supportsMonitoring: false,
},
})
if (stationInfo.chargePointModel) {
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'Model' },
+ variable: { name: OCPP20VariableName.Model },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: stationInfo.chargePointModel },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: false },
})
}
if (stationInfo.chargePointVendor) {
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'VendorName' },
+ variable: { name: OCPP20VariableName.VendorName },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: stationInfo.chargePointVendor },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: false },
})
}
if (stationInfo.chargePointSerialNumber) {
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'SerialNumber' },
+ variable: { name: OCPP20VariableName.SerialNumber },
variableAttribute: [
{
type: AttributeEnumType.Actual as string,
value: stationInfo.chargePointSerialNumber,
},
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: false },
})
}
if (stationInfo.firmwareVersion) {
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'FirmwareVersion' },
+ variable: { name: OCPP20VariableName.FirmwareVersion },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: stationInfo.firmwareVersion },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: false },
})
}
}
variable: { name: configKey.key },
variableAttribute: variableAttributes,
variableCharacteristics: {
- dataType: 'string',
+ dataType: DataEnumType.string,
supportsMonitoring: false,
},
})
evse: { id: evseId },
name: OCPP20ComponentName.EVSE,
},
- variable: { name: 'AvailabilityState' },
+ variable: { name: OCPP20VariableName.AvailabilityState },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: evse.availability },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: true },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: true },
})
if (evse.connectors.size > 0) {
for (const [connectorId, connector] of evse.connectors) {
evse: { connectorId, id: evseId },
name: OCPP20ComponentName.EVSE,
},
- variable: { name: 'ConnectorType' },
+ variable: { name: OCPP20VariableName.ConnectorType },
variableAttribute: [
{
type: AttributeEnumType.Actual as string,
value: connector.type ?? ConnectorEnumType.Unknown,
},
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: {
+ dataType: DataEnumType.string,
+ supportsMonitoring: false,
+ },
})
}
}
evse: { connectorId, id: 1 },
name: OCPP20ComponentName.Connector,
},
- variable: { name: 'ConnectorType' },
+ variable: { name: OCPP20VariableName.ConnectorType },
variableAttribute: [
{
type: AttributeEnumType.Actual as string,
value: connector.type ?? ConnectorEnumType.Unknown,
},
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: {
+ dataType: DataEnumType.string,
+ supportsMonitoring: false,
+ },
})
}
}
if (stationInfo.chargePointModel) {
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'Model' },
+ variable: { name: OCPP20VariableName.Model },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: stationInfo.chargePointModel },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: false },
})
}
if (stationInfo.chargePointVendor) {
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'VendorName' },
+ variable: { name: OCPP20VariableName.VendorName },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: stationInfo.chargePointVendor },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: false },
})
}
if (stationInfo.firmwareVersion) {
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'FirmwareVersion' },
+ variable: { name: OCPP20VariableName.FirmwareVersion },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: stationInfo.firmwareVersion },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: false },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: false },
})
}
}
reportData.push({
component: { name: OCPP20ComponentName.ChargingStation },
- variable: { name: 'AvailabilityState' },
+ variable: { name: OCPP20VariableName.AvailabilityState },
variableAttribute: [
{
type: AttributeEnumType.Actual as string,
: OCPP20ConnectorStatusEnumType.Unavailable,
},
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: true },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: true },
})
if (chargingStation.evses.size > 0) {
evse: { id: evseId },
name: OCPP20ComponentName.EVSE,
},
- variable: { name: 'AvailabilityState' },
+ variable: { name: OCPP20VariableName.AvailabilityState },
variableAttribute: [
{ type: AttributeEnumType.Actual as string, value: evse.availability },
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: true },
+ variableCharacteristics: { dataType: DataEnumType.string, supportsMonitoring: true },
})
}
} else if (chargingStation.connectors.size > 0) {
evse: { connectorId, id: 1 },
name: OCPP20ComponentName.Connector,
},
- variable: { name: 'AvailabilityState' },
+ variable: { name: OCPP20VariableName.AvailabilityState },
variableAttribute: [
{
type: AttributeEnumType.Actual as string,
value: connector.status ?? ConnectorStatusEnum.Unavailable,
},
],
- variableCharacteristics: { dataType: 'string', supportsMonitoring: true },
+ variableCharacteristics: {
+ dataType: DataEnumType.string,
+ supportsMonitoring: true,
+ },
})
}
}
import {
AttributeEnumType,
type ComponentType,
+ GenericDeviceModelStatusEnumType,
GetVariableStatusEnumType,
+ MutabilityEnumType,
OCPP20ComponentName,
type OCPP20GetVariableDataType,
type OCPP20GetVariableResultType,
interface StandardVariableConfig {
attributeTypes: AttributeEnumType[]
defaultValue?: string
- mutability: 'ReadOnly' | 'ReadWrite' | 'WriteOnly'
+ mutability: MutabilityEnumType
persistent: boolean
}
component: variableData.component,
statusInfo: {
additionalInfo: 'Internal error occurred while retrieving variable',
- reasonCode: 'InternalError',
+ reasonCode: GenericDeviceModelStatusEnumType.Rejected,
},
variable: variableData.variable,
})
component,
statusInfo: {
additionalInfo: `Component ${component.name} is not supported by this charging station`,
- reasonCode: 'NotSupported',
+ reasonCode: GenericDeviceModelStatusEnumType.NotSupported,
},
variable,
}
component,
statusInfo: {
additionalInfo: `Variable ${variable.name} is not supported for component ${component.name}`,
- reasonCode: 'NotSupported',
+ reasonCode: GenericDeviceModelStatusEnumType.NotSupported,
},
variable,
}
component,
statusInfo: {
additionalInfo: `Attribute type ${attributeType} is not supported for variable ${variable.name}`,
- reasonCode: 'NotSupported',
+ reasonCode: GenericDeviceModelStatusEnumType.NotSupported,
},
variable,
}
{
attributeTypes: [AttributeEnumType.Actual, AttributeEnumType.Target],
defaultValue: '300',
- mutability: 'ReadWrite',
+ mutability: MutabilityEnumType.ReadWrite,
persistent: true,
}
)
{
attributeTypes: [AttributeEnumType.Actual, AttributeEnumType.Target],
defaultValue: '30',
- mutability: 'ReadWrite',
+ mutability: MutabilityEnumType.ReadWrite,
persistent: true,
}
)
...Object.values(OCPP20RequiredVariableName),
]
- return knownVariables.includes(
- variable.name as OCPP20OptionalVariableName | OCPP20RequiredVariableName
- )
+ return knownVariables.includes(variable.name)
}
}