Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running session check on remote start #105

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ export default async function handleRemoteStartTransaction({
response = {
status: 'Rejected',
};
} else {
setTimeout(() => {
chargepoint.startSession(Number(connectorId), {
uid: idTag,
skipAuthorize:
chargepoint.configuration
.getVariableValue('AuthorizeRemoteTxRequests')
?.toString() === 'false',
});
}, 100);
response = {
status: 'Accepted',
};
}
setTimeout(() => {
chargepoint.startSession(Number(connectorId), {
uid: idTag,
skipAuthorize:
chargepoint.configuration
.getVariableValue('AuthorizeRemoteTxRequests')
?.toString() === 'false',
});
}, 100);
response = {
status: 'Accepted',
};

chargepoint.writeCallResult(callMessageId, response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ export default async function handleRemoteStopTransaction({
response = {
status: 'Rejected',
};
} else {
setTimeout(() => {
chargepoint.stopSession(Number(connectorId));
}, 100);
response = {
status: 'Accepted',
};
}
setTimeout(() => {
chargepoint.stopSession(Number(connectorId));
}, 100);
response = {
status: 'Accepted',
};

chargepoint.writeCallResult(callMessageId, response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ const handleRequestStartTransaction: ChargeStationEventHandler<
> = ({ chargepoint, callMessageId, callMessageBody }) => {
const { remoteStartId, evseId, idToken } = callMessageBody;

let response: RequestStartTransactionResponse = { status: 'Accepted' };
let response: RequestStartTransactionResponse;

if (chargepoint.hasRunningSession(Number(evseId))) {
response = { status: 'Rejected' };
response = {
status: 'Rejected',
};
} else {
setTimeout(() => {
chargepoint.startSession(
Expand All @@ -30,6 +32,9 @@ const handleRequestStartTransaction: ChargeStationEventHandler<
'rfid'
);
}, 100);
response = {
status: 'Accepted',
};
}

chargepoint.writeCallResult(callMessageId, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const handleRequestStopTransaction: ChargeStationEventHandler<
> = ({ chargepoint, callMessageId, callMessageBody }) => {
const { transactionId } = callMessageBody;

let response: RequestStopTransactionResponse = { status: 'Accepted' };
let response: RequestStopTransactionResponse;

const connectorId = ['1', '2'].find(
(cId) =>
Expand All @@ -18,13 +18,14 @@ const handleRequestStopTransaction: ChargeStationEventHandler<
response = {
status: 'Rejected',
};
} else {
setTimeout(() => {
chargepoint.stopSession(Number(connectorId));
}, 100);
response = {
status: 'Accepted',
};
}
setTimeout(() => {
chargepoint.stopSession(Number(connectorId));
}, 100);
response = {
status: 'Accepted',
};

chargepoint.writeCallResult(callMessageId, response);
};
Expand Down