Code Monkey home page Code Monkey logo

java-oca-ocpp's Introduction

Java CI with Maven codecov Gitter

Java-OCA-OCPP

A library for the Open Charge-Point Protocol from openchargealliance.org

This library is made to support anyone who wants to implement a Central System or Charge Point that follows the Open Charge-Point Protocol. Please note, this is a library and not an application, so there is no main method.

The design is driven by test, which will ensure premium software that is easy to adapt and modify to your needs.

The library supports version 2.0.1 and 1.6 SOAP and web sockets.

Incoming request events are split into feature profiles as described in the OCPP specification. I recommend that you download and read the specification from openchargealliance.org

See the project plan here: https://tree.taiga.io/project/tvolden-java-oca-ocpp/

Maven

Find the maven repo here: https://mvnrepository.com/artifact/eu.chargetime.ocpp

License

MIT License

About ChargeTime.eu

We are devoted to push the marked for vehicles charging forward. There are many standards out there, we intend to implement and share them. Any help is much appreciated!

The market is in its defining state, the practices and standards we come up with now, may very well stick around for decades to come.

See our vision at http://www.chargetime.eu/

java-oca-ocpp's People

Contributors

bantu avatar cptmauli avatar danielcaro avatar decroc-shell avatar dependabot[bot] avatar dmitryb-asg avatar emilm avatar eupakhomov avatar goekay avatar in-fke avatar jakubjungiewiczcodibly avatar jmluy avatar lahnaoja avatar marcinar avatar maurobono avatar medvedev avatar mmauksch avatar raddatzk avatar robert-s-ubi avatar sandeepmattepu avatar simonweiser avatar slachiewicz avatar steven-smpct avatar sumlin avatar thetric avatar tommarkuske avatar tvolden 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-oca-ocpp's Issues

Ocpp1.6 soap request to central system

Hi one and all,

After a small testing with a mock-up soap (xml) request (from pole to CentralSystem) I noticed that I’m not quite sure what’s the correct form of an Ocpp1.6 soap request. Especially how the soap headers and namespaces should be set. I think that the request below is close the right form, but, do you have any comments?

Of course it could be also so that implementations in the poles could differ slightly.
In case message form below is about the right one the library needs a little fix to handle it, I could make a PR for that.

B.r. Antti

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="urn://Ocpp/Cs/2015/10/">
   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <ns:chargeBoxIdentity>Pole1000</ns:chargeBoxIdentity>
      <wsa:MessageID>1001001</wsa:MessageID>
      <wsa:From><wsa:Address>http://localhost:12345</wsa:Address></wsa:From>
      <wsa:ReplyTo><wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address></wsa:ReplyTo>
      <wsa:To>http://localhost:8887</wsa:To>
      <wsa:Action>/Authorize</wsa:Action>
   </soap:Header>
   <soap:Body>
      <ns:authorizeRequest>
        <ns:idTag>tag200</ns:idTag>
      </ns:authorizeRequest>
   </soap:Body>
</soap:Envelope>

Reestablishing connection results in error

I'm currently writing software for a CP with JSON/websockets and it seems like something is going wrong when the connection drops and I try to reconnect and send a HeartBeatRequest after that.

When I notice a connection drop, it triggers the ClientEvents() callback connectionClosed() in JSONClient.connect(...)) (client.isClosed() still returns false after the event?!)

I try to connect again. All goes fine, except for when I try to send a HeartbeatRequest it crashes and continuously spits out this log message:

Session:170 An internal error occurred and the receiver was not able to process the requested Action successfully

Could you please tell me, if I'm doing something wrong here? What's should be the procedure to reconnect after a connection drops?

Thanks in advance

  OCPPClient(String address, ClientCoreProfile coreProfile) {
        this.address = address;
        this.core = coreProfile;

        client = new JSONClient(coreProfile);
    }

    void addFWProfile(ClientFirmwareManagementProfile profile){
        this.fwProfile = profile;
        client.addFeatureProfile(profile);
    }

    void connect() throws Exception {
        client.connect(address, new ClientEvents() {
            @Override
            public void connectionOpened() {
                connected = true;
                logger.info("connection opened");
            }

            @Override
            public void connectionClosed() {
                try {
                    connected = false;
                    logger.info("connection closed");
                } catch (Exception ex) {
                    logger.error(ex.getMessage());
                }
            }
        });
    }

NPE during offline mode

java.lang.NullPointerException
at eu.chargetime.ocpp.Client$1.handleError(Client.java:98)
at eu.chargetime.ocpp.Session$CommunicatorEventHandler.onError(Session.java:178)
at eu.chargetime.ocpp.Communicator.sendCall(Communicator.java:169)
at eu.chargetime.ocpp.Session.sendRequest(Session.java:77)
at eu.chargetime.ocpp.Client.send(Client.java:146)

Client.send()
String id = session.sendRequest(feature.getAction(), request);

Session.sendRequest()
communicator.sendCall(uuid, action, payload);

Communicator.sendCall() -> NotConnectedException ex -> request is NOT transaction related
events.onError()

Session$CommunicatorEventHandler.onError()
events.handleError(id, errorCode, errorDescription, payload);

getPromise(uniqueId) method returns null, because Client.send() puts the uniqueId on the next line (by createPromise(id)).

How to reproduce:

  1. Block a connection to server's port by iptables -A INPUT -i lo -p tcp -m tcp --dport 8080 -j DROP

  2. Made a sync-safe connect() after disconnect().

     cl.sendBootNotificationRequest();
     delay(5);
     cl.sendStartTransactionRequest(1, "idTag");
     delay(10);
     cl.sendHeartbeatRequest();
     delay(150);
    

Solution: for my (it might be acceptable only for my async) code it works:

diff --git a/ocpp-common/src/main/java/eu/chargetime/ocpp/Session.java b/ocpp-common/src/main/java/eu/chargetime/ocpp/Session.java           
index 20d4739..c69fd14 100644                                                                                                                
--- a/ocpp-common/src/main/java/eu/chargetime/ocpp/Session.java                                                                              
+++ b/ocpp-common/src/main/java/eu/chargetime/ocpp/Session.java                                                                              
@@ -74,7 +74,7 @@ public class Session {
      */
     public String sendRequest(String action, Request payload) {
         String uuid = queue.store(payload);
-        communicator.sendCall(uuid, action, payload);
+        new Thread( () -> communicator.sendCall(uuid, action, payload) ).start();
         return uuid;
     }

P.S. I'm using all send* methods by async way. If i'd want to get sync method, I just execute .get() for a CompletableFuture<> object.

Quick start guide

Hi,
Your project and your approach seems very interesting ( http://www.chargetime.eu/ ).
A lot of things seems functional and I am very interested to try what is existing and try to communicate with a (real) JSON 1.6 charging station.

I tried to compile the project with MAVEN (without success) and I do not really understand how begin. Could you detail a little bit this point ?

Regards

Running basic client server class

Hi,

I have just started exploring this code. I want to run client server classes. However as they don't have main method I am unable to run. I am not sure what is the starting point. All I want to do is I want to establish connection between client and server.

Any help or hint would be big help.

Issue with a Communicator.EventHandler.receivedMessage(Object input) logger

Hello,

I believe there is an issue with a Communicator.EventHandler.receivedMessage(Object input) when it tries to logger.trace("Receive a message: {}", message) for a JSON message.

        public void receivedMessage(Object input) {
            Message message = parse(input);
            if (message != null) {
                Object payload = message.getPayload();
                if (payload instanceof Document) {
                    logger.trace("Receive a message: {}", SugarUtil.docToString((Document) payload));
                } else {
                    logger.trace("Receive a message: {}", message);
                }
            }
            if (message instanceof CallResultMessage) {
                events.onCallResult(message.getId(), message.getAction(), message.getPayload());
            } else if (message instanceof CallErrorMessage) {
                failedFlag = true;
                CallErrorMessage call = (CallErrorMessage) message;
                events.onError(call.getId(), call.getErrorCode(), call.getErrorDescription(), call.getRawPayload());
            } else if (message instanceof CallMessage) {
                CallMessage call = (CallMessage) message;
                events.onCall(call.getId(), call.getAction(), call.getPayload());
            }
        }

What I`m getting in a log console is:

FINEST [03:19:20 23-Jan-19 PST][eu.chargetime.ocpp.Communicator] Receive a message: eu.chargetime.ocpp.model.CallMessage@9023eb

While in a Wireshark I can see:

[2, "69015629", "Heartbeat", {}]

Could it be something to do with a missing .toString() method for a Message class?

Build this on top of javax.websocket-api

Building on top of the standard API for WebSockets in java would be safer and more flexible. It complicates the deployment a bit, because of the need to supply the implementation classes, but overall it should be a better solution.

Have the lib test with OCPP Compliancy Tool

Hello, recently I use this lib to test with "OCPP Compliancy Tool" from OCA?.

When I connect to server create by "OCPP Compliancy Tool", always get connection close event, then can not do next step test.

So, I want to check with you, do you ever face the issue same with me?.....

SOAPSyncHelper.java issue

I test some profile send from server to chargerbox by OCA testing tooling, chargerbox occur cannot reply message to server.

There maybe is a bug in SOAPSyncHelper.java, because of call forwardMessage() too early and cause 'uniqueID' does not put into 'promises'.

I move forwardMessage() to last section, and solve the issue.

public CompletableFuture<SOAPMessage> relay(SOAPMessage message) {
forwardMessage(message);<============================ position must move to last
CompletableFuture<SOAPMessage> promise = null;
String uniqueID = getHeaderValue(message, "MessageID");
if (uniqueID != null) {
promise = new CompletableFuture<>();
promises.put(uniqueID, promise);
}
<============================================= move to here
return promise;
}

Testing with Steve

I am trying to use this project as a chargepoint simulator to make tests with a central system that is running with Steve, now that it supports OCPP 1.6 (https://github.com/RWTH-i5-IDSG/steve).
But I haven't succeded on receiving any message in the Steve central system, neither using SOAP nor JSON types.

I have created a very basic main app that simply starts a chargepoint:

FakeChargePoint chargePoint = new FakeChargePoint();
chargePoint.connect();
chargePoint.sendBootNotification("A", "B");
chargePoint.sendHeartbeatRequest();

And in the constructor of the FakeChargePoint class I have changed the url to the ones that are provided by steve once it is started:

switch (type) {
            case JSON:
                client = new JSONClient(core, "testdummy");
                url = "ws://192.168.1.7:9220/steve/websocket/CentralSystemService/testdummy";
                break;
            case SOAP:
                client = new SOAPClient("me", new URL("http://127.0.0.1:8889"), core);
                url = "http://192.168.1.7:9220/steve/services/CentralSystemService";
                break;
        }

This code compiles and executes without problems or error messages. However, the Steve central system does not seem to be receiving anything at all from the chargepoint.

What is missing?

SetChargingProfile results in FormationValidation Error

I'm trying to send a SetChargingProfile Command to the station via the lib, but I'm getting a FormationValidation Error back. It might be the stations problem or me/the lib sending a wrong message/part of the message. Anyone else seeing a similar issue?

I'm testing with a eBee station.

Message sent to the station:

[
  2, 
  "faa4aaaf-5dad-482e-8353-6d5bc613e39e", 
  "SetChargingProfile", 
  {
    "chargingProfile": {
      "chargingProfileId": 0, 
      "chargingProfileKind": "Relative", 
      "chargingProfilePurpose": "TxProfile", 
      "chargingSchedule": {
        "chargingRateUnit": "A", 
        "chargingSchedulePeriod": [
          {
            "limit": 9.0, 
            "numberPhases": 3, 
            "startPeriod": 0
          }
        ]
      }, 
      "stackLevel": 0, 
      "transactionId": 2
    }, 
    "connectorId": 1
  }
]

Response from the station:

[
  4, 
  "faa4aaaf-5dad-482e-8353-6d5bc613e39e", 
  "FormationViolation", 
  "Command parsing error", 
  {}
]

Problem running tests in Eclipse Oxygen.3

Hello,

For historical reasons my favourite IDE is Eclipse. Having just tried to run your code in a fresh install of the latest version (Oxygen.3) ocpp-v1_6-test gives the following two errors:

Plugin execution not covered by lifecycle configuration: org.codehaus.gmavenplus:gmavenplus-plugin:1.5:addTestSources (execution: default, phase: initialize)	pom.xml	/ocpp-v1_6-test	line 93	Maven Project Build Lifecycle Mapping Problem

Plugin execution not covered by lifecycle configuration: org.codehaus.gmavenplus:gmavenplus-plugin:1.5:testCompile (execution: default, phase: test-compile)	pom.xml	/ocpp-v1_6-test	line 93	Maven Project Build Lifecycle Mapping Problem

Do you have any suggestions?

Jim

unable to transmitt a Calendar in AuthorizeConfirmation message

Hi Thomas

Today i found a new problem: If I want to transmit a Calendar object inside an IdTagInfo object inside an AuthorizeConfirmation object from the methode:
public AuthorizeConfirmation handleAuthorizeRequest(int sessionIndex, AuthorizeRequest request)
back to the client the following exception gets thrown by the client.

java.lang.IllegalArgumentException: java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2018,MONTH=1,WEEK_OF_YEAR=2,WEEK_OF_MONTH=2,DAY_OF_MONTH=1,DAY_OF_YEAR=13,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=11,HOUR_OF_DAY=1,MINUTE=1,SECOND=1,MILLISECOND=343,ZONE_OFFSET=3600000,DST_OFFSET=0]
	at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseAndSetYear(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.<init>(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(Unknown Source)
	at javax.xml.bind.DatatypeConverterImpl._parseDateTime(Unknown Source)
	at javax.xml.bind.DatatypeConverterImpl.parseDateTime(Unknown Source)
	at javax.xml.bind.DatatypeConverter.parseDateTime(Unknown Source)
	at eu.chargetime.ocpp.JSONCommunicator.parseValue(JSONCommunicator.java:157)
	at eu.chargetime.ocpp.JSONCommunicator.parseValue(JSONCommunicator.java:144)
	at eu.chargetime.ocpp.JSONCommunicator.parseJSON(JSONCommunicator.java:133)
	at eu.chargetime.ocpp.JSONCommunicator.parseValue(JSONCommunicator.java:174)
	at eu.chargetime.ocpp.JSONCommunicator.parseValue(JSONCommunicator.java:144)
	at eu.chargetime.ocpp.JSONCommunicator.parseJSON(JSONCommunicator.java:133)
	at eu.chargetime.ocpp.JSONCommunicator.unpackPayload(JSONCommunicator.java:78)
	at eu.chargetime.ocpp.Session$CommunicatorEventHandler.onCallResult(Session.java:117)
	at eu.chargetime.ocpp.Communicator$EventHandler.receivedMessage(Communicator.java:234)
	at eu.chargetime.ocpp.WebSocketTransmitter$1.onMessage(WebSocketTransmitter.java:56)
	at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:312)
	at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:368)
	at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:157)
	at org.java_websocket.client.WebSocketClient.interruptableRun(WebSocketClient.java:230)
	at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:188)
	at java.lang.Thread.run(Unknown Source)

It seems like the client isnt able to parse a Calendar object. If i dont transmit the calendar, all is fine.
My test Calendar Object which causes the exception:

Calendar calendar = Calendar.getInstance();
calendar.set(2018, 1, 1, 1, 1, 1);

Can you confirm this behavour?

Why PropertyConstraintException must be a checked Exception?

Hello there,

I would like to ask you what is the reasoning for having the PropertyConstraintException to be a checked Exception. It's more similar to default Java IllegalArgumentException which is unchecked and it does not require special constructs to handle them.

Thank you in advance

SOAP Message element order is different with OCA OCPP_CentralSystemService_1.6.wsdl

Hello

 I use your library to test with OCA testing tools face some issue and share to you.

 SOAP message element order doesn't same as OCPP_CentralSystemService_1.6.wsdl

 We must set element order in model file

 for example:

`@XmlRootElement
@XmlType(propOrder = { "connectorId", "status", "errorCode", "info", "timestamp", "vendorId", "vendorErrorCode"})

public class StatusNotificationRequest implements Request {}`

Refactor downcast of message types in higher level components

As I mentioned in #93, we downcast to check. This creates direct dependencies from higher level entities to lower level entities.

Here is an example where we downcast to check if it's an instance of a 3rd part library, thereby creating a hard dependency to that 3rd part library. In this case an XML component, and since XML is being replaced by json in the OCPP standard, this dependency is unfortunate:

                if (payload instanceof Document) {
                    logger.trace("Receive a message: {}", SugarUtil.docToString((Document) payload));
                } else {
                    logger.trace("Receive a message: {}", message);
                }

I have written a short guide to Visitor pattern, that may be a good solution for this issue:
https://github.com/ChargeTimeEU/Java-OCA-OCPP/wiki/Example-of-visitor-pattern-(In-C%23,-oh-my)

Any ideas and/or better approaches?

Is anyone of for a challenge?

Basic stuff doesn't work

There is a diff with a testing code: https://pastebin.com/1Xmm8dTj

For JSON please set isJson = true in both client and server runners.
For SOAP isJson = false.

JSON: can't connect to the server, have an error:
10:43:07.753 [Thread-2] DEBUG eu.chargetime.ocpp.WebSocketTransmitter - WebSocketClient.onClose: code = 1002, message = Invalid status code received: 404 Status line: HTTP/1.1 404 WebSocket Upgrade Failure, host closed = false

SOAP: message parser can't parse documents, it produces a null value in Communicator.java:238.

Possible leak in WebSocketListener

In WebSocketListener the
private HashMap<WebSocket, WebSocketReceiver> sockets;
Is not removed from if you lose a connection / disconnect.

@Override public void onClose(WebSocket webSocket, int i, String s, boolean b) { sockets.get(webSocket).disconnect(); } should remove it from the map. Maybe also check it for every connect unless you missed something? :)

Current status of OCCP implemetation

Hi, Thomas!
You've published a lot of work here. I'm interested in the current status of this project and future plans. What features are already implemented and what features you are planning to implement soon?

Command to simulate a Charge Point

I want to simulate a Charge Point with Java-OCA-OCPP that can receive and respond to JSON messages that are sent over websocket. I have successfully built the libraries inside Java-OCA-OCPP by mvn package command. Now, what command should I use to simulate a Charge Point?

TriggerMessage?

I am unable to find the implementation of this. Work in progress? :) Would you like to have a pull request for this or do you prefer to do it yourself? (noting that the pull request I already submitted isn't accepted) :)

Smart Charging profile

Hello,

It is a great library, thank you for supporting it.
I would like to ask if there is a support for ClearChargingProfile & GetCompositeSchedule messages from the Smart Charging profile. I can see implementation of the SetChargingProfile message, but for the full implementation if the Smart Charging the two messages above would be very important.

Thanks

Unique session?

Since chargers can connect and disconnect etc, maybe it's a better idea to have a GUID instead of int for a session so there's no way you can confuse them?

Suggestion for improvement: SOAP

In order to support existing charging infrastructure it would be great to have JSON & SOAP support.

Best regards
David Huwiler

the example can not run ,the client send msg but the server cont not receiver msg

the example can not run ,the clint send msg but the server cont not receiver msg
for example:

the server:
public static void main(String[] args) {
JSONServerSample jsonServer = new JSONServerSample();
try {
jsonServer.started();
//jsonServer.sendClearCacheRequest();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

the client:
public static void main(String[] args) throws Exception {
JSONClientSample jsonClient = new JSONClientSample();

	try {
    	jsonClient.connect();
    	
    	jsonClient.sendBootNotification();
    	Thread.sleep(100000L);
    	jsonClient.disconnect();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}

Offline behavior

It seems message recovery doesn't work. Try this one, please, but I'm not sure I think as well as you:

  1. Connect to a server.
  2. Send BootNotificatonRequest. It might be done with handlerBootNotificationResponse.
  3. Send StartTransactionRequest. It might be done with handlerStartNotificationResponse.
  4. Disconnect.
  5. Send AuthorizationRequest. It might be failed with NotConnectedException on handlerAuthorizationResponse.
  6. Send StopTransactionRequest. It might be failed with NotConnectedException on handlerStopTransactionResponse.
  7. Connect.
  8. Your program have to send StopTransactionRequest again and might be done with handlerStopTransactionResponse.

Creation of a TestSetup

Dear Thomas ,
Thanks for your great work.
I am new to JAVA and OCPP. I have gone through the readme.md file but not able to get enough information on how to run and create a test setup for client and server.Will you give some tips how to build and create a test setup for client and server.

Thanks and Regards,
Sudhir

Ability to expose /health Rest endpoint

Feature Request
We use the lib in a Spring Boot application and we would like to expose a health endpoint (HTTP/REST based) that gives us an indication if the application is healthy or not.

The challenge
The challenge is that we include the lib in a spring boot 1.5.x app and are not able to expose RestController endpoints through the Spring Web package. I assume the WebSocket-Listener is interfering with exposing Rest-Endpoints.

Maybe it is already possible, but we aren't able to find a solution. In that case a wiki-page would be of great help and solve this issue for us.

What is the bigger context here?
We host the application on ECS in AWS and a dedicated health endpoint is needed for the TargetGroups and ECS Service to recognise the container to be healthy.

ocpp 1.6 - Cannot send TriggerMessageRequest to client

Hi there!,

I am using OCPP 1.6 json server and am trying to send TriggerMessageRequest to the client given its sessionId, I see the server throws an eu.chargetime.ocpp.UnsupportedFeatureException. Why is it not supported? Can it be added?

TriggerMessageRequest triggerMessageRequest = new TriggerMessageRequest(TriggerMessageRequestType.StatusNotification);
triggerMessageRequest.setConnectorId(1);
jsonServer.send(sessionIndex, triggerMessageRequest).whenComplete((confirmation, throwable) -> log.info("{}", confirmation));

Thanks!

Session != Client.connection

Hi Thomas

I think there is a Implementation problem at: JSONServerSample.java at line 124:

    `server.open("localhost", 8887, new ServerEvents() {

        @Override
        public void newSession(int sessionIndex) {

            // sessionIndex is used to send messages.
            System.out.println("New session " + sessionIndex);
        }

        @Override
        public void lostSession(int sessionIndex) {

            System.out.println("Session " + sessionIndex + " lost connection");
        }
    });`

IMHO a client connection to the server is not the same as a Session. I think the client (==chargePoint) stays connected the whole time, but a OCPP-session (chargePoint session with a customer) is just held up during a interaction with one chargePoint customer.

I think the server should have seperate methode like: server.newSession / server.closeSession, without closing the client/server connection...

Do you agree?

Best regards
David

[QUERY] How to use it?

Hello, i am beginner for this domain, before my query i must say one of best implementation i came across for OCPP.
i successfully compile library into my environment, i am struck at how to use it? i took a reference from example and test module but i can't figure out way to pass IP and PORT for server, so can you please enlighten me with details or it would be great if there is any demo application?

Could not connect to a OCPP server.

Dear Sir,
By implementing this library ,I am able to connect Steve Server but not able to connect the certifying agency server.What are the reason? Any security setting are required?

Thanks and Regards
Sudhir

How to retreive Session information from OCPP Clients Requests?

Given a charge box identity how can i retreive the session information/session id from connections existing? Why the api cannot provide session information for SessionEvents callback method handleRequest?

The information of charge box identity besides session id in handleRequest callback will be sinful IMHO! :)

handleTriggerMessageRequest does not support the proper order of operations specified in the spec.

OCPP 1.6 specifies that a TriggerMessage.req must respond with a TriggerMessage.conf before the client send the message that was requested. The ClientRemoteTriggerHandler supports no method of being able to tell that handleTriggerMessageRequest has been called by the JSONAPI, or that it has returned, leaving the programmer unable to know when to send the requested message.

The only solution I can think of is to spawn a thread that sends the message before handleTriggerMessageRequest has returned and delay its execution some arbitrary amount of time. I prefer not to use this solution because it does not guarantee that the confirmation has been sent first. It would be nice to have a way to know that the handler method has run, built into ClientRemoteTriggerProfile.

Exception handling

Hi,
I have implemented a central system service, but can't figure out how I should handle Exceptions that make it impossible to fulfil the request. When a runtime exception is thrown in my ServerCoreProfile, it does not send a response (I am using the SOAP server).

Ocpp1.6 soap header in response message

Seems that the response message from central system has some mix-up with namespaces in the soap header

<cs:chargeBoxIdentity xmlns:cs="urn://Ocpp/Cp/2015/10" env:mustUnderstand="true">Pole200</cs:chargeBoxIdentity>

In the urn there should be “Cs” as central system instead of “Cp” of charge pole. I could make a fix PR.

B.r. Antti

DataTransfer maximum payload

I'm trying to find out how much data I can send with DataTransfer from a charge point to a central system. At the moment it seems that requests are not handled when the payload exceeds 16 kb.

Is it intended behavior, or should it be possible to send larger messages with DataTransfer. And if so, what's the maximum size?

Thanks in advance.

Erik

Wrong notification handleStartTransactionRequest at the end of the transaction

I am testing OCA OCPP with charging station Schnider EVlink EVB1A22P4KI.
Currently I am working with OCA OCPP revision ad6905e.
Most of the already implemented features work surprisingly well. Congrats from me!

I only noticed the following bug:
When I start transaction, the station begins charging. I am receiving "Charging" on handleStatusNotificationRequest hook. So far so good.

When I stop the transaction (either by stop transaction command or just by unplugging the cable) I receive final handleStartTransactionRequest ?!?
Then after this notification I am receiving Available status.

My expectation is that at this moment I should reveive: handleStopTransactionRequest
And this is important for me, because stop notification contains meter ending value.
Instead start notification always gives mi 0 meter starting value.

Please check it this is a bug on your side.
It can also be an EVlink bug but to me it is barely possible.

BR,
Alexander Tzvetanov
Appladesign LLC

ChargingProfile with RemoteStartTransactionRequest problem

I'm trying to set chargingProfile on RemoteStartTransactionRequest, but it returns CallErrorException. It works fine when sending the request without the chargingProFile.

This is the code for chargingProfile:

ChargingSchedulePeriod[] chargingSchedulePeriod = new ChargingSchedulePeriod[1];
chargingSchedulePeriod[0] = new ChargingSchedulePeriod(1, 32);
ChargingSchedule chargingSchedule = new ChargingSchedule(ChargingRateUnitType.A, chargingSchedulePeriod);

ChargingProfile chargingProfile = new ChargingProfile();
chargingProfile.setChargingSchedule(chargingSchedule);
chargingProfile.setStackLevel(1);
chargingProfile.setChargingProfileId(1);
chargingProfile.setChargingProfilePurpose(ChargingProfilePurposeType.ChargePointMaxProfile);
chargingProfile.setChargingProfileKind(ChargingProfileKindType.Recurring);

request.setChargingProfile(chargingProfile);

And the exception:

eu.chargetime.ocpp.CallErrorException
at eu.chargetime.ocpp.Server$1.handleError(Server.java:111)
    at eu.chargetime.ocpp.Session$CommunicatorEventHandler.onError(Session.java:211)
    at eu.chargetime.ocpp.Communicator$EventHandler.receivedMessage(Communicator.java:250)
    at eu.chargetime.ocpp.WebSocketReceiver.relay(WebSocketReceiver.java:44)
    at eu.chargetime.ocpp.WebSocketListener$1.onMessage(WebSocketListener.java:121)
    at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:569)
    at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:696)
    at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:367)
    at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:212)
    at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:906)

The message from Communicator.java:250
OccurenceConstraintViolation - Payload for Action is syntactically correct but at least one of the fields violates occurence constraints

JSON DateTime parsing is too strict

JSONCommunicator.CalendarDeserializer only accepts DateTime strings with time zone ID given as 'Z', however I couldn't find anything in the 1.6 specs that requires this (UTC is merely recommended according to §3.13). Parsing the string with ZonedDateTime#parse should be fine.

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.