-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from e-flux-platform/add-soc
- Loading branch information
Showing
9 changed files
with
131 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
src/lib/ChargeStation/eventHandlers/ocpp-16/send-stop-transaction.js
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
src/lib/ChargeStation/eventHandlers/ocpp-16/send-stop-transaction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import {sleep} from '../../../../utils/csv'; | ||
import {ChargeStationEventHandler} from "lib/ChargeStation/eventHandlers"; | ||
import {StopTransactionRequest} from "schemas/ocpp/1.6/StopTransaction"; | ||
|
||
const sendStopTransaction: ChargeStationEventHandler = async ({ | ||
chargepoint, | ||
session, | ||
}) => { | ||
chargepoint.sessions[session.connectorId].isStoppingSession = true; | ||
|
||
chargepoint.sessions[session.connectorId].tickInterval?.stop(); | ||
await sleep(1000); | ||
|
||
chargepoint.writeCall<StopTransactionRequest>( | ||
'StopTransaction', | ||
{ | ||
idTag: session.options.uid, | ||
meterStop: Math.round(session.kwhElapsed * 1000), | ||
timestamp: session.now().toISOString(), | ||
reason: 'EVDisconnected', | ||
transactionId: Number(session.transactionId), | ||
transactionData: [ | ||
{ | ||
timestamp: session.now().toISOString(), | ||
sampledValue: [ | ||
{ | ||
value: session.kwhElapsed.toString(), | ||
context: 'Sample.Periodic', | ||
format: 'Raw', | ||
measurand: 'Energy.Active.Import.Register', | ||
location: 'Outlet', | ||
unit: 'kWh', | ||
}, | ||
], | ||
}, | ||
{ | ||
timestamp: session.now().toISOString(), | ||
sampledValue: [ | ||
{ | ||
value: session.stateOfCharge.toString(), | ||
context: 'Transaction.End', | ||
location: 'Outlet', | ||
unit: 'Percent', | ||
measurand: 'SoC', | ||
} | ||
] | ||
} | ||
], | ||
}, | ||
session | ||
); | ||
} | ||
|
||
export default sendStopTransaction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters