Skip to content

How to start? Any help needed #82

@asp2403

Description

@asp2403

Hello!
I'm new to OCPP and I have significant difficulties to start diving in subject, any help will be highly appropriated.
I need to write a kind of monitoring tool which should connect to charging station via OCPP and get a set of parameters from it. For example, max charging power, current charging percentage etc.
I use online OCPP charging station emulator (https://cs.ocpp-css.com/ocpp (login: demo, password: demo), https://github.com/apostoldevel/ocpp-cs) to test my development.
I was able to connect to the station and pass through the authorization. But I don't know what to do next. How to get parameters?
Here is my code based on your tutorial (I use java).

private static void testOcppConnection() throws ConnectException {
        final var chargePointId = "EFACECQCTEST";
        ChargePointOperations connection = ApiFactory.Companion.ocpp16ConnectionToCSMS(chargePointId,
                "ws://ws.ocpp-css.com/ocpp",
                TransportEnum.WEBSOCKET,
                null,
                null,
                Collections.emptyList(),
                new OcppCallbacks());

        connection.connect();
        final var idTag = "demo";
        var authResponse = connection.authorize(new RequestMetadata(chargePointId, null), new AuthorizeReq(idTag)).getResponse();
        if (authResponse.getIdTagInfo().getStatus() ==  AuthorizationStatus.Accepted) {
            log.info("Auth accepted");
            var transactionResponse = connection.startTransaction(new RequestMetadata(chargePointId, null), new StartTransactionReq(1, idTag, 0,
                    Instant.Companion.fromEpochSeconds(java.time.Instant.now().getEpochSecond(), 0), null)).getResponse();
            var transactionId = transactionResponse.getTransactionId();
            log.info("Start transaction: {}", transactionId);
            log.info("{}", transactionResponse.getIdTagInfo());
            //What to do next???
        } else {
            log.info("Auth rejected");
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions