Git Product home page Git Product logo

ocpp.core's People

Contributors

dallmann-consulting avatar danielnord avatar jeremymahieu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocpp.core's Issues

System.Net.WebSockets.WebSocketException (0x80004005) in OCPPMiddleware.OCPP16.cs

Hello!
I get above error at this line when receiving data:
WebSocketReceiveResult result = await chargePointStatus.WebSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None); (this is line 32 of: OCPPMiddleware.OCPP16.cs)

Error (bolded) is below (along with leading context):

info: OCPPMiddleware[0]
OCPPMiddleware => Connection request with chargepoint identifier = 'my_station_ID1'
info: OCPPMiddleware[0]
OCPPMiddleware => SUCCESS: Found chargepoint with identifier=my_station_ID1
info: OCPPMiddleware[0]
OCPPMiddleware => No authentication for chargepoint 'my_station_ID1' configured
fail: Microsoft.AspNetCore.Server.Kestrel[13]
**Connection id "0HMUP3UVKMSG2", Request id "0HMUP3UVKMSG2:00000002": An unhandled exception was thrown by the application.
System.Net.WebSockets.WebSocketException (0x80004005): An exception caused the WebSocket to enter the Aborted state. Please see the InnerException, if present, for more details.
at System.Net.WebSockets.ManagedWebSocket.CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus closeStatus, WebSocketError error, String errorMessage, Exception innerException)
at System.Net.WebSockets.ManagedWebSocket.HandleReceivedCloseAsync(MessageHeader header, CancellationToken cancellationToken)
at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory1 payloadBuffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at System.Threading.Tasks.ValueTask1.GetTaskForValueTaskSource(IValueTaskSource`1 t)

--- End of stack trace from previous location ---
at OCPP.Core.Server.OCPPMiddleware.Receive16(ChargePointStatus chargePointStatus, HttpContext context) in C:\Users\JOSKO\Documents\VisualStudioProjekti\OCPP.Core-main\OCPP.Core.Server\OCPPMiddleware.OCPP16.cs:line 32
at OCPP.Core.Server.OCPPMiddleware.Invoke(HttpContext context) in C:\Users\JOSKO\Documents\VisualStudioProjekti\OCPP.Core-main\OCPP.Core.Server\OCPPMiddleware.cs:line 404
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)**

Transaction Authorized by RFID Tag and stopped without RFID Tag!

Hi,

Ive managed to run OCPP Core platform and connect two Siemens D Charger 300Kw DC Ocpp 1.6J.

I have an issue with uncompleted transaction that were authorized by RFID Tag and stopped by the car or power outage.

Uncompleted transactions in the photo below:
OCPP Overview
OCPP Trans

How can I modify the code to handle cases where the charging is stopped by the car/power outage and receive complete transaction data and unlock RFID Tag?

Charger can't connect.

  1. I'm run OCPP.CORE V1.3.0 Portable. file OCPP.Core.management , OCPP.Core.Server
  2. I add new Charge point ID already.
  3. I set device charger OCPP URL to ws://localhost:8081/OCPP/mychargername
  4. The charger is connected to the Ethernet cable and in the same group as WINDOWS 10.
  5. I use windows 10 and I open port 8081 on firewall already.
  6. OCPP.Core.Server Debug Show (warn: OCPPMiddleware => Bad path request)

What more do I need to do?
I have 3 chargers of 3 different brands, and I tested them all and they cannot connect.
Please help me to be able to connect.

Problems with installing new charging stations.

I added a new charging station through the management web interface. The charging station ID is L2-U2. However, the following error message appeared in OCPP.Core.Server.exe:
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET https://192.168.50.104/OCPP/L2-U2 - -
info: OCPPMiddleware[0]
OCPPMiddleware => Connection request with chargepoint identifier = 'L2-U2'
info: OCPPMiddleware[0]
OCPPMiddleware => SUCCESS: Found chargepoint with identifier=L2-U2
info: OCPPMiddleware[0]
OCPPMiddleware => No authentication for chargepoint 'L2-U2' configured
warn: OCPPMiddleware[0]
OCPPMiddleware => No supported sub-protocol in '' from charge station 'L2-U2'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET https://192.168.50.104/OCPP/L2-U2 - - - 400 0 - 1.5490ms
How can I resolve this issue?

Start Transaction Error

Hello

I am testing server with INFINITY Simple OCPP 1.6 Chargebox Simulator provided in Readme file (https://github.com/victormunoz/OCPP-1.6-Chargebox-Simulator)

when I click Start Transaction button it gives this error
fail: OCPPMiddleware.OCPP16[0]
OCPPMiddleware.Receive16 => Unknown message type: 1 / Msg: [1,"ETPCN52r6YfYsB0xI2G2imfhjDf3RoUVoVe9","StartTransaction",{"connectorId":1,"idTag":"12345678","timestamp":"2022-07-10T3:11:55Z","meterStart":0,"reservationId":0}]

How can I solve this?

`StopTransaction`: a Transaction Can Be Stopped with Random Transaction ID

Issue Description:
The server allows a StopTransaction message to stop an active transaction using a random transactionId instead of requiring the specific transactionId assigned at the start of the transaction. This could potentially lead to unauthorized stopping of transactions.

Steps to Reproduce:

  1. Start a transaction using StartTransaction, receiving a valid transactionId.
  2. Send a StopTransaction message with a random transactionId instead of the one received in step 1.
  3. Observe that the transaction is stopped by the server.

Expected Behavior:
The StopTransaction message should be validated to ensure it includes the correct transactionId that was assigned at the start of the transaction, thereby binding the user to the specific transaction being stopped.

Actual Behavior:
The server stops an active transaction when a StopTransaction message is sent with any random transactionId.

Suggested Solution:
Implement strict validation on the server to only stop transactions when the StopTransaction message contains the correct transactionId provided at the beginning of the transaction.

I look forward to your input on this matter.

Best regards,
Gaetano Coppoletta

Multiple Transactions Allowed with Same connectorId and idTag

Issue Description:
The current implementation of the OCPP server does not adhere to the specified behavior in the OCPP documentation regarding concurrent transactions. The documentation states that if an idTag is already involved in an active transaction, any attempt to initiate a new transaction with the same idTag should result in an AuthorizationStatus of ConcurrentTx. However, I've observed two issues:

  1. The server allows initiation of multiple transactions using the same idTag without the ConcurrentTx status.
  2. A StopTransaction message with a random transactionId can stop the current transaction.

Steps to Reproduce:

  1. Send a StartTransaction message using a specific idTag.
  2. While the transaction is active, send another StartTransaction message with the same idTag.
  3. Observe that the server does not return an AuthorizationStatus of ConcurrentTx.
  4. Send a StopTransaction message with a random transactionId.
  5. Note that the server stops the most recent transaction.

Expected Behavior:
In compliance with the OCPP specification, the server should not allow a new transaction to start with an idTag that is already in use for an ongoing transaction. The server should issue an AuthorizationStatus of ConcurrentTx.

Actual Behavior:
Multiple transactions are allowed for the same idTag without returning a ConcurrentTx status, and transactions can be stopped using random transactionIds.

Potential Impact:
This could cause a critical error in transaction management and billing processes, affecting operational integrity.

Suggested Solution:

  • Update the server logic to return an AuthorizationStatus of ConcurrentTx for StartTransaction requests that involve an idTag in an ongoing transaction.
  • Validate transactionId in StopTransaction requests to ensure the correct transaction is being stopped.

Best regards,
Gaetano Coppoletta

The WebSocket received compressed frame when compression is not enabled.

Error Occurred in File: OCPPMiddleware.OCCP16.cs

Code Block: private async Task Receive16(ChargePointStatus chargePointStatus, HttpContext context)

Error-prone Code: WebSocketReceiveResult result = await chargePointStatus.WebSocket.ReceiveAsync(new ArraySegment(buffer),CancellationToken.None);

The error message is: "The WebSocket received compressed frame when compression is not enabled."

resim

I connected three different devices to the same service. I am encountering an issue in one of the devices at this point. Can you help me?

[WebSocket Library Suggestion] Improving performance and reliability

Hi,
I maintain a library called SimpleR. In a nutshell, it is a fork of SignalR without the custom protocols allowing you to write very fast pure WebSocket servers.

So you basically get all the benefits of SignalR, like advanced buffer management, low allocation, very good integration with asp.net core(routing, authentication, etc...) but still have the ability to integrate with custom protocols like OCPP.

I have started to write a helper package for OCPP, to make it simpler to write OCPP servers using SimpleR(pun intended) and would love to hear what you think can be beneficial to you. If you are interested in using such a library, let me know and I'll try to help as best I can.

install on ubuntu

Hi. Can I install on ubuntu?
I have installed the SDK. Compiled projects (dotnet build OCPP.Core.sln and dotnet publish OCPP.Core.sln).
But when I run ( dotnet run ) I get the error:

crit: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to start Kestrel.
Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file
at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)
at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)
at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.LoadCertificate(CertificateConfig certInfo, String endpointName)
at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.ValidateOptions()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication1 application, CancellationToken cancellationToken) Unhandled exception. Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle) at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags) at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password) at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.LoadCertificate(CertificateConfig certInfo, String endpointName) at Microsoft.AspNetCore.Server.Kestrel.KestrelConfigurationLoader.Load() at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.ValidateOptions() at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at OCPP.Core.Management.Program.Main(String[] args) in /var/www/ocpp/data/www/idmcorp.ru/OCPP.Core.Management/Program.cs:line 34

Add implementation for SetChargingProfile

Is possible to have the SetChargingProfile implemented ?
I need to change the MaxCurrent for the Wallbox so I can monitor the load and balance the power for charging the EV

Deploy server on Azure

Hi and thank you for the sample implementation! It gave me a much better understanding of the protocol(s). I tried to deploy the server part on azure and perform some tests but the web socket connection kept disconnecting with error 1006 and no description of course :( . The web sockets protocol is switched on, keep alive is also on - the server works great on my machine btw - tested both with the simulator and a real cp. Do you have any ideas regarding this issue ? Thank you in advance!!!

[Feature] Charge report

This is a feature request but I would be inclinded to make this feature myself. Opening an issue first so it can be discussed first, avoid double work.

  1. Make an extra page in the menu Administration > Charge report
  2. Have a date time span selector to indicate begin time, end time
  3. Two tables with charge data: One that says the amount of energy charged per person "123kWh". Grouped by the "group" of a chargetag. And another table that gives details of the person with each charge session. This table only appears if you click a person.
  4. 2 exports to csv/xlsx (using ClosedXML library), one with the aggregated data as in the first table, and another one that gives all charge transactions in the selected timespan

Already started building this would look something like this
image

Build the envorinment

Hi,First thanks for the great work.
I really like this UI and some of the things.
I'm a student from taiwan and now trying to build a charging station.
Here is my problem :
First I follow the step in Configuration and Installation:
STEP 1 & 2 I use the default , I didn't do any changes.
STEP 3:
Make sure you installed the .NET-Core SDK. →I download : .NET Core 3.1 SDK (v3.1.405)
Open a command shell and navigate to the root folder of the project. →Yes
Execute the following command dotnet build OCPP.Core.sln →Success
Copy the 'wwwroot' folder to the build target directory (where the dlls are)
→I can't understand this,so I copy the folder to

  • OCPP.Core.Database\bin\Debug\netcoreapp3.1
  • OCPP.Core.Management\bin\Debug\netcoreapp3.1
  • OCPP.Core.Server\bin\Debug\netcoreapp3.1

Start both executables (=> Kestrel webserver) → This step I can't understand either.

I have learn C# windowform before , I want to see this project's feature can do work for me or not.
Thank you!

It was not working with multiple charger at the same time . Do you have any idea or details we want to setup multiple charger and also load testing along with it

It was not working with multiple charger at the same time at a single grid due to load issue . Do you have any idea or details if we want to setup multiple charger and also load testing along with it. Similar concepts ??

steve-community/steve#552

Kindly help or provide an idea also would like to see if we can connect with any Smart plugs -https://www.amazon.com/dp/B089DR29T6

Originally posted by @rahulbhat13 in #14 (comment)

[Feature] Exporting (prometheus) metrics

It would be nice if this OCPP server had an endpoint /metrics where the actual values for each chargepoint are written. Then we could use something like influxdb or premetheus/grafana to make a dashboard of the chargeing infrastructure.

nuget has prometheus client libraries that produce this file, just need to set the values

Some example data of what a metrics file could look like (just some invented metrics I don't know what would be usefull,

# HELP ocpp_chargepoint_sessions_total Total number of charging sessions
# TYPE ocpp_chargepoint_sessions_total counter
ocpp_chargepoint_sessions_total{chargepoint="CP1", rfid_tag="TAG123"} 120
ocpp_chargepoint_sessions_total{chargepoint="CP2", rfid_tag="TAG456"} 85
ocpp_chargepoint_sessions_total{chargepoint="CP3", rfid_tag="TAG789"} 98

# HELP ocpp_chargepoint_energy_consumed_kwh Total energy consumed by the chargepoint in kilowatt hours
# TYPE ocpp_chargepoint_energy_consumed_kwh counter
ocpp_chargepoint_energy_consumed_kwh{chargepoint="CP1", rfid_tag="TAG123"} 24.005
ocpp_chargepoint_energy_consumed_kwh{chargepoint="CP2", rfid_tag="TAG456"} 19.877
ocpp_chargepoint_energy_consumed_kwh{chargepoint="CP3", rfid_tag="TAG789"} 21.532

# HELP ocpp_chargepoint_uptime_percentage Percentage of uptime for the chargepoint
# TYPE ocpp_chargepoint_uptime_percentage gauge
ocpp_chargepoint_uptime_percentage{chargepoint="CP1", rfid_tag="TAG123"} 99.8
ocpp_chargepoint_uptime_percentage{chargepoint="CP2", rfid_tag="TAG456"} 98.5
ocpp_chargepoint_uptime_percentage{chargepoint="CP3", rfid_tag="TAG789"} 99.1

# HELP ocpp_chargepoint_current_sessions_active Number of currently active charging sessions
# TYPE ocpp_chargepoint_current_sessions_active gauge
ocpp_chargepoint_current_sessions_active{chargepoint="CP1", rfid_tag="TAG123"} 1
ocpp_chargepoint_current_sessions_active{chargepoint="CP2", rfid_tag="TAG456"} 2
ocpp_chargepoint_current_sessions_active{chargepoint="CP3", rfid_tag="TAG789"} 1

# HELP ocpp_chargepoint_error_count_total Total number of errors encountered by the chargepoint
# TYPE ocpp_chargepoint_error_count_total counter
ocpp_chargepoint_error_count_total{chargepoint="CP1", rfid_tag="TAG123"} 5
ocpp_chargepoint_error_count_total{chargepoint="CP2", rfid_tag="TAG456"} 12
ocpp_chargepoint_error_count_total{chargepoint="CP3", rfid_tag="TAG789"} 8

# HELP ocpp_chargepoint_current_charge_current_amp Current charge current in amperes
# TYPE ocpp_chargepoint_current_charge_current_amp gauge
ocpp_chargepoint_current_charge_current_amp{chargepoint="CP1", rfid_tag="TAG123"} 16.5
ocpp_chargepoint_current_charge_current_amp{chargepoint="CP2", rfid_tag="TAG456"} 20.4
ocpp_chargepoint_current_charge_current_amp{chargepoint="CP3", rfid_tag="TAG789"} 32.0

# HELP ocpp_chargepoint_charge_limit_amp Charge limit in amperes
# TYPE ocpp_chargepoint_charge_limit_amp gauge
ocpp_chargepoint_charge_limit_amp{chargepoint="CP1", rfid_tag="TAG123"} 32
ocpp_chargepoint_charge_limit_amp{chargepoint="CP2", rfid_tag="TAG456"} 32
ocpp_chargepoint_charge_limit_amp{chargepoint="CP3", rfid_tag="TAG789"} 32

Unable to connect to the database

I am unable to connect to the database using SQLite or SqlServer...

With SQLite, I always get this error:

An error occurred while processing your request.
Error details:
SQLite Error 1: 'no such table: ConnectorStatusView'.

What can I do?

Data exchange failed - JSON in not accepted

Good afternoon, I encountered such a problem, when using OCPP-2.0-CP-Simulator, it gives such a message, in the server logs it writes the following:
fail: OCPP.Core.Server.ControllerOCPP20[0] @ 2022-07-16T12:59:35.1770301+03:00
TransactionEvent => Exception: Required property 'transactionInfo' not found in JSON. Path '', line 1, position 475.
Newtonsoft.Json.JsonSerializationException: Required property 'transactionInfo' not found in JSON. Path '', line 1, position 475.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EndProcessProperty(Object newObject, JsonReader reader, JsonObjectContract contract, Int32 initialDepth, JsonProperty property, PropertyPresence presence, Boolean setDefaultValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at OCPP.Core.Server.ControllerOCPP20.HandleTransactionEvent(OCPPMessage msgIn, OCPPMessage msgOut) in C:\Users\ulrichd\source\repos\GitHub\OCPP.Core\OCPP.Core.Server\ControllerOCPP20.TransactionEvent.cs:line 46
Безымянный

Example of how to send a message from server to client

Could you please provide an example of how to send a message from the server to a ChargePoint using the library. Say, for example, a SetChargingProfile message. There doesn't seem to be a way via the UI, but it looks like the library supports it.

Energy Limit on a transaction - Advice

hi All

Is it possible to send to the OCCP client using the energy value, after which the charger will automatically stop charging?

anyways to which might work

Here is what l think

1: Charge profiles -
{
"connectorId": 0,
"idTag": "xxxxxxxxxxxx",
"chargingProfile": {
"chargingProfileId": 10,
"transactionId": null,
"stackLevel": 0,
"chargingProfilePurpose": "TxProfile",
"chargingProfileKind": "Relative",
"recurrencyKind": "Daily",
"validFrom": "2022-02-18T10:18:46.000Z",
"validTo": "2022-08-18T10:18:46.000Z",
"chargingSchedule": {
"duration": 4200,
"startSchedule": "2022-08-18T10:18:46.000Z",
"chargingRateUnit": "W",
"chargingSchedulePeriod": [
{
"startPeriod": 0,
"limit": 50
},
{
"startPeriod": 120,
"limit": 0
}
]
}
}
}

The last one will send zero currents and probably that time will stop

2: Custom Data Transfer , but this is more of confirming with the vendor right?

[Hager Witty Park / 1.0.0.0 / 9.0.1.0] Stop charging look not working

Capture d’écran 2024-04-29 à 15 12 25
Can you help me understand why I never get an end of charge?

Logs on my Hager Witty Park :
[2024-04-29 05:26:18] Connector 3: Cable connection
[2024-04-29 05:26:18] Connector 3: OCPP Status Preparing
[2024-04-29 05:26:18] Connector 3: Cable 32 A
[2024-04-29 05:26:23] Connector 3: Vehicle connection
[2024-04-29 05:27:03] RFID tag: XXXXXXX1
[2024-04-29 05:27:03] Authorize (tag = XXXXXXX1, status = Accepted, expiry date = 2024-04-29T05:32:03Z)
[2024-04-29 05:27:04] Connector 3: Suspended EVSE
[2024-04-29 05:27:04] Connector 3: OCPP Status Suspended EVSE
[2024-04-29 05:27:05] Connector 3: Suspended EV
[2024-04-29 05:27:05] Connector 3: OCPP Status Suspended EV
[2024-04-29 05:27:11] Connector 3: Charging
[2024-04-29 05:27:11] Connector 3: OCPP Status Charging
[2024-04-29 05:27:14] Connector 3: OCPP Status Charging
[2024-04-29 09:09:16] Connector 3: Suspended EV
[2024-04-29 09:09:16] Connector 3: OCPP Status Suspended EV
[2024-04-29 10:31:46] Connector 3: Vehicle disconnection
[2024-04-29 10:31:46] Connector 3: OCPP Status Finishing
[2024-04-29 10:31:53] Connector 3: Cable disconnection
[2024-04-29 10:31:53] Connector 3: OCPP Status Available

Simulator

l have cloned the project fine,

if l use the simulator and request connection, it always fails, debugging the code l have seen that it requires a basic auth token ( username and password ). l have done the steps of setting the charge point via the management : OCPP.Core.Management

The question is more on the simulator on why it's not sending the token in the header or where is it set on the simulator, l have used the latest in your git. or l am doing something wrong

image

2:
image
here is where it's failing , so as to get the first connection thanks

Start Charge Invalid error

Hello,
I start charging. It provides energy, but charging stops with an invalid error. Can you share an example of starting and stopping charging?

Start Transaction From Remote

Hello,

First of all, thank you very much for this beautiful example. Beautifully crafted down to the smallest detail. I have two questions;

  1. Can we send open or close transactions to the station via the admin page or api.
  2. How do we support 1.5 version.

For my first question, I tried something but failed. I am sharing the code below

thank you

/// <summary>
        /// Waits for new OCPP V1.6 messages on the open websocket connection and delegates processing to a controller
        /// </summary>
        private async Task BeginTransaction16(ChargePointStatus chargePointStatus, HttpContext apiCallerContext)
        {
            ILogger logger = _logFactory.CreateLogger("OCPPMiddleware.OCPP16");
            ControllerOCPP16 controller16 = new ControllerOCPP16(_configuration, _logFactory, chargePointStatus);

            Messages_OCPP16.StartTransactionRequest startTransaction = new Messages_OCPP16.StartTransactionRequest();
            startTransaction.ConnectorId = 2;
            startTransaction.IdTag = "1";
            startTransaction.Timestamp = DateTimeOffset.Now;
            startTransaction.ReservationId = 0;
            startTransaction.MeterStart = 0;
            string jsonResetRequest = JsonConvert.SerializeObject(startTransaction);

            OCPPMessage msgOut = new OCPPMessage();
            msgOut.MessageType = "2";
            msgOut.Action = "StartTransaction";
            msgOut.UniqueId = Guid.NewGuid().ToString("N");
            msgOut.JsonPayload = jsonResetRequest;
            msgOut.TaskCompletionSource = new TaskCompletionSource<string>();

            // store HttpContext with MsgId for later answer processing (=> send anwer to API caller)
            _requestQueue.Add(msgOut.UniqueId, msgOut);

            // Send OCPP message with optional logging/dump
            await SendOcpp16Message(msgOut, logger, chargePointStatus.WebSocket);

            // Wait for asynchronous chargepoint response and processing
            string apiResult = await msgOut.TaskCompletionSource.Task;

            // 
            apiCallerContext.Response.StatusCode = 200;
            apiCallerContext.Response.ContentType = "application/json";
            await apiCallerContext.Response.WriteAsync(apiResult);
        }

How to read current and temperature

Hello, I would like to know how to collect current and temperature data, and how to display them on the transaction list. Which files do I need to modify?

Connect over IP

Hi

I can make it work using localhost address (ws://localhost:8081/OCPP/TestAAA) but over the IP (ws://192.168.1.116:8081/OCPP/TestAAA) doesnt work. what setting should I do? I added rule for firewall 8081 port. still not working.

API

Hi. Installed. Great program. Is there an OCPP API for the server? I want to make an application with a payment system for payment on time and payment for kW.

connection refused from remote client on same lan

We are unable to connect to the OCPP.Core.Server using the chargebox (1.6) running in a browser on a separate / remote machine on the same LAN. The client & management console work properly on the same device as the server.

netstat -an on the server shows localhost:8081 is "LISTEN"

server device is running ubuntu 18.04.5 LTS
client browser is Chromium (same as server)

Please advise how to configure remote connection to OCPP.Core.Server.

Many Thanks Simon

Web Interface Fails to Display Multiple Transactions Across Different Connector IDs

Issue Description:
The web interface does not display all active transactions when multiple transactions are started across different connectors. Transactions initiated on one connector are visible, but subsequent transactions on different connectors do not appear in the interface.

Steps to Reproduce:

  1. Send a StartTransaction message using connectorId 1 and note the transaction on the web interface.
  2. Send another StartTransaction message with connectorId 2, identical in all other aspects.
  3. Observe that the second transaction is not visible in the web interface.

Expected Behavior:
The web interface should display all active transactions regardless of the connector ID, provided each transaction is distinct and properly initiated.

Actual Behavior:
Only the transaction for the first connectorId is displayed on the web interface. Subsequent transactions with different connectorIds are not shown.

Potential Impact:
This could lead to a lack of visibility for station operators, causing confusion and potential mismanagement of charging stations.

I hope this report helps in pinpointing the issue for a swift resolution.

Best regards,
Gaetano Coppoletta

Can't connect to the charge ponit

“I have successfully entered OCPP.CORE according to the established process. We are trying to connect to Phihong’s charge point named "AXSC111001". Could you please tell me if we need to change the URL or other code to connect?”

SQLite Error 14: 'unable to open database file'.

Hi, I have been download from here and try to build this.
But the Web page told me that "SQLite Error 14: 'unable to open database file' "

I'm using sqlite so I done this change:

"ConnectionStrings": {
"SQLite": "Filename=.\..\SQLite\OCPP.Core.sqlite;"
//"SqlServer": "Server=.;Database=OCPP.Core;Trusted_Connection=True;"
},
and rename the sql file from OCPP.Core.Empty.sqlite to OCPP.Core.sqlite

But I still get the error?
is there anything I did wrong?

Thanks!

[Feature] - Docker container/image

Hi

I think this project is worth to be available as docker image :)

If it helps, i could provide a PR here.. so tell ma what you think :)

Possible Inconsistency in Transaction Meter Values Allowing Negative Charging

Description of the Issue:
I have discovered a possible logic flaw in transaction handling. Specifically, the server accepts StopTransaction messages where the meterStop value is lower than the meterStart value from a corresponding StartTransaction message, leading to the storage of a negative charged value in the database.

Steps to Reproduce:

  1. Send a StartTransaction message with a meterStart value.
  2. Send a StopTransaction message with a meterStop value lower than the meterStart value.
  3. Observe that the server processes the transaction and stores a negative value for the charged amount.

Expected Behavior:
The server should validate that the meterStop value is greater than or equal to the meterStart value to ensure transaction consistency and prevent illogical charging data.

Actual Behavior:
The server stores the transaction with a negative charged amount, which is illogical in the context of energy metering and could lead to financial discrepancies.

Potential Impact:
If left unaddressed, this could result in incorrect billing calculations, impacting the integrity of transactional data and potentially causing financial losses or disputes.

Attachments:

  • A screenshot showing the negative charged amount as recorded in the system:

  • Screenshot from 2023-11-02 16-21-34

Suggested Solution:
Implementing server-side validation checks to confirm that meterStop is not less than meterStart before accepting and storing transaction data would mitigate this issue.

Thank you for your attention to this matter. Looking forward to your response.

Best regards,
Gaetano Coppoletta.

Cant connect with simulator

Hello, I am trying to connect the simulator at localhost without success (of course it is my bad, but I hope you can give any clues)
Server is running at localhost:8081 tag and station id are created

WebSocket connection to 'ws://localhost:8081/OCPP/station42' failed: WebSocket is closed before the connection is established.
wsConnect @ simple simulator1.6.html:128
(anonymous) @ simple simulator1.6.html:336
dispatch @ jquery-3.3.1.min.js:2
y.handle @ jquery-3.3.1.min.js:2
simple simulator1.6.html:239 ws connection error: 1006

Many thanks!

Error details

Hello, we followed the normal process and steps, but when we opened the http://localhost:8082/ ,we saw these error messages displayed on the webpage. Could you please advise on how to resolve this?
Error details

Unvalidated Acceptance of Additional and Duplicate Properties in `StartTransaction` Message

Issue Description:
The server accepts additional, arbitrary properties in the StartTransaction message, and when duplicate properties are provided, it accepts the last occurrence without validation. For example, a message with two different connectorId properties is processed using the value of the last one.

Steps to Reproduce:

  1. Send a StartTransaction message with a custom additional property.
  2. Send a StartTransaction message with duplicate properties, such as two different connectorId values.
  3. Observe that the server accepts the message and processes it based on the last occurrence of the duplicate property.

Expected Behavior:
The server should either reject messages with unknown additional properties. For duplicate properties, it should reject the message.

Actual Behavior:
The server stores the value from the last occurrence of a duplicate property in the StartTransaction message, leading to potential misconfigurations.

Potential Impact:
Accepting additional and duplicate properties without validation may lead to unpredictable system behavior and could be exploited to alter transaction records or impact system integrity.

Best regards,
Gaetano Coppoletta

No current status could be retrieved from the OCPP server

The charging stations work and are displayed correctly, but this error is always lit at the bottom

Screenshot_20240423-074914~2.png

The following error appears in the server log
IMG-4d3e9d385f8585f1167587e769e3c99d-V.jpg

How can I display data on the charge level and power consumption like in your screenshots? This information is in the logs, but is not displayed on the dashboard

IMG-213fd582f79646943936618d69b5d4ff-V.jpg

IMG-63206c76bbc1daedfa844cf40db1fd89-V.jpg

please help me out

Hello I have created charge points and server page using ocpp.core.server and ocpp.core.management. Using OCPP1.6 simulator I can able to connect, start, stop charging. But now my intention is Schedule charging. From ocpp2.0 simulator when I am giving start,stop,schedule it shows JSON is not accepted.
OCPP2 0

please help me out to solve my doubts

TLS Client Side Certificates not working on Kestrel

When a client tries to use a client certificate to authenticate towards OCPP.Core.Server, the certificate is not used by the web server. In essence, context.Connection.ClientCertificate in OCPP.Core.Server/OCPPMiddleware.cs is always empty.

The following workaround worked for me. This also disables the verification of the client side certificates as well.

diff --git a/OCPP.Core.Server/Program.cs b/OCPP.Core.Server/Program.cs
index 756818c..7baf813 100644
--- a/OCPP.Core.Server/Program.cs
+++ b/OCPP.Core.Server/Program.cs
@@ -22,6 +22,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
 using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Server.Kestrel.Https;
 using Microsoft.EntityFrameworkCore.Metadata;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Hosting;
@@ -60,6 +61,14 @@ namespace OCPP.Core.Server
                 .ConfigureWebHostDefaults(webBuilder =>
                 {
                     webBuilder
+                    .ConfigureKestrel(kestrel => {
+                        kestrel.ConfigureHttpsDefaults(https => {
+                            https.ClientCertificateMode = ClientCertificateMode.AllowCertificate;
+                            https.ClientCertificateValidation = (cert, chain, policyErrors) => {
+                                return true;
+                            };
+                        });
+                    })
                     .ConfigureLogging((ctx, builder) =>
                                         {
                                             builder.AddConfiguration(ctx.Configuration.GetSection("Logging"));

How to connect to device

Hello, I have a problem to connect the device to the server. Could you explain how to do it?
Also, how can I connect by simulator using IP addres?
For example when I put in Central station: ws://localhost:8081/OCPP/station42, everything is ok, but when I put ip addres of local device it doesn't work: ws://192.168.1.2:8081/OCPP/station42

[Feature] OCPP forwarding

Imagine you are a company and want to have public charge points. But when an employee uses the company RFID badge, you don't want them to be using the public OCPP server (which has subscriptions fees).

Could there be a way to forward chargepoints to a further upstream OCPP server, in a way this upstream server does not need any additional functionality besides the standard OCPP functions.

This could then even be used in a hierarchical way so there's multiple levels.

Possible DoS Vulnerability: No Control on length of 'chargePointVendor' property in 'BootNotification' OCPP message

Description of the possible vulnerability:
While performing black box testing on OCPP.Core on my local machine, I discovered a potential security vulnerability that might lead to a Denial of Service (DoS) attack.

Details:

  • There appears to be no control over the length of the chargePointVendor property of the BootNotification OCPP message. According to the protocol specifications, the maxLength of this property should be 20 characters.
  • I conducted a test by sending a BootNotification message with a chargePointVendor length of 442 MB, resulting in the server crashing.

Attachments:

  • I have attached a screenshot of the server logs that displays the behavior when the oversized BootNotification message was received.

dos_bootNotification_chargePointVendor

StopTransaction => Exception: Error converting value {null} to type 'System.Int32'

We had this exception in the logging. Not sure what went wrong exactly but the EV charger seems to accept the charing session, then immediatly (about 450ms later) stopped the transaction and while stopping this was logged.

2023-08-31T11:12:08.470119992Z fail: OCPP.Core.Server.ControllerOCPP16[0]
2023-08-31T11:12:08.470156990Z       StopTransaction => Exception: Error converting value {null} to type 'System.Int32'. Path 'transactionId', line 1, position 100.
2023-08-31T11:12:08.470162285Z       Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Int32'. Path 'transactionId', line 1, position 100.
2023-08-31T11:12:08.470166293Z        ---> System.InvalidCastException: Null object cannot be converted to a value type.
2023-08-31T11:12:08.470170019Z          at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
2023-08-31T11:12:08.470173731Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
2023-08-31T11:12:08.470177771Z          --- End of inner exception stack trace ---
2023-08-31T11:12:08.470189007Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
2023-08-31T11:12:08.470193655Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2023-08-31T11:12:08.470209951Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2023-08-31T11:12:08.470219734Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2023-08-31T11:12:08.470292399Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2023-08-31T11:12:08.470322085Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2023-08-31T11:12:08.470367614Z          at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2023-08-31T11:12:08.470373702Z          at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2023-08-31T11:12:08.470377432Z          at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
2023-08-31T11:12:08.470386265Z          at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
2023-08-31T11:12:08.470390377Z          at OCPP.Core.Server.ControllerOCPP16.HandleStopTransaction(OCPPMessage msgIn, OCPPMessage msgOut) in /src/OCPP.Core.Server/ControllerOCPP16.StopTransaction.cs:line 41

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.