{"id":30754921,"url":"https://github.com/monta-app/library-ocpp","last_synced_at":"2026-01-21T22:02:59.053Z","repository":{"id":255609928,"uuid":"852955703","full_name":"monta-app/library-ocpp","owner":"monta-app","description":"Monta's OCPP Library built using Kotlin","archived":false,"fork":false,"pushed_at":"2026-01-17T18:07:54.000Z","size":344,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":12,"default_branch":"main","last_synced_at":"2026-01-17T18:28:52.548Z","etag":null,"topics":["emobility","kotlin","kotlin-library","ocpp","ocpp16j","ocpp201"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monta-app.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-05T18:10:05.000Z","updated_at":"2026-01-16T15:58:52.000Z","dependencies_parsed_at":"2026-01-07T19:00:32.746Z","dependency_job_id":null,"html_url":"https://github.com/monta-app/library-ocpp","commit_stats":null,"previous_names":["monta-app/library-ocpp"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/monta-app/library-ocpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monta-app%2Flibrary-ocpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monta-app%2Flibrary-ocpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monta-app%2Flibrary-ocpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monta-app%2Flibrary-ocpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monta-app","download_url":"https://codeload.github.com/monta-app/library-ocpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monta-app%2Flibrary-ocpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28644700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emobility","kotlin","kotlin-library","ocpp","ocpp16j","ocpp201"],"created_at":"2025-09-04T10:01:18.276Z","updated_at":"2026-01-21T22:02:59.024Z","avatar_url":"https://github.com/monta-app.png","language":"Kotlin","funding_links":[],"categories":["Tools and Resources"],"sub_categories":["OCPP"],"readme":"# OCPP Library\n\n### Setup\n\nAdd jitpack to your repositories section in your gradle or maven build file\n\n```kotlin\nrepositories {\n    maven(\"https://jitpack.io\")\n}\n```\n\nOCPP V16\n\n```kotlin\ndependencies {\n    implementation(\"com.monta.library.ocpp:core:\u003cversion\u003e\")\n    implementation(\"com.monta.library.ocpp:v16:\u003cversion\u003e\")\n}\n```\n\nOCPP V201\n\n```kotlin\ndependencies {\n    implementation(\"com.monta.library.ocpp:core:\u003cversion\u003e\")\n    implementation(\"com.monta.library.ocpp:v201:\u003cversion\u003e\")\n}\n```\n\n## OCPP Message Direction\n\nThe OCPP protocol is an RPC framework with a **request-response** protocol\n\nThe *synchronicity* of the protocol is well described in OCPP-J-1.6 in chapter *4.1.1 Synchronicity*\n\nIn summary this describes that there can always only be one message in flight, in either direction.\n\n### General Design Idea\n\nThe library should be seen as a library. I.e. it is a passive component.\n\n* if any thread pools should be used, they should be passed in from the outside when creating an instance of the\n  library.\n* if any logging framework should be used it should also be passed in from the outside.\n\n### Technology\n\n* Use a simple JSON parsing library\n  like [Moshi](https://github.com/square/moshi) ([guide](https://www.baeldung.com/java-json-moshi))\n\n### Messages Initiated by the **charge point**\n\n**Chapter 4 of the OCPP-1.6 specification**\n\nThe library should be usable both in a blocking and an asynchronous way for messages initiated by the charge point.\n\n```kotlin\n/**\n * A blocking core profile implementation. Today such an interface is found\n * in `com.monta.ocpp.profiles.core.CoreProfileListener`\n */\nCoreProfileListenerSync {\n    /**\n     * @throws OCPPCallErrorException on unable to handle authorize\n     */\n    override fun authorize(\n        request: AuthorizeRequest\n    ): AuthorizeConfirmation\n}\n\n/**\n * An callback based core profile implementation\n */\nCoreProfileListenerASync {\n    override fun authorize(\n        request: AuthorizeRequest,\n        onError: (CallError) -\u003e Unit,\n        onSuccess: (AuthorizeConfirmation) -\u003e Unit\n    )\n}\n```\n\nFor both scenarios we need to figure out how to handle timeouts in our own code.\n\nThe implementation in the library should be relatively straight forward\n\n1. Parse the incoming message into a Kotlin type\n2. Find the profile that should handle it - if not supported, send a CallError to the charge point\n3. Call the profile and let it handle e.g. the `Authorize`\n4. When the library gets the `AuthorizeConfirmation` format it to a json string and send it back on the same WS\n   connection it was received on\n\n### Messages Initiated by the **OCPP Server**\n\n**Chapter 5 of the OCPP-1.6 specification**\n\nThe library should be usable both in a blocking and an asynchronous way for messages initiated by the OCPP server.\n\n```kotlin\n/**\n * A blocking core profile implementation. Today such an implementation is found\n * in `com.monta.ocpp.service.ChargePointConnection`\n */\nCoreProfileSync {\n    /**\n     * @throws OCPPCallErrorException on unable to handle reset\n     */\n    override fun reset(\n        request: ResetRequest\n    ): Future\u003cResetConfirmation\u003e\n}\n\n/**\n * A callback core profile implementation. Maybe this can be implemented in a generic way\n * using `java.util.concurrent.CompletionStage`?\n */\nCoreProfileASync {\n    /**\n     * `onSuccess` will be called by the OCPP library when a response is received from the\n     * charge point.\n     * `onError` will be called by the OCPP library if an error or no response is received\n     * from the charge point\n     */\n    override fun reset(\n        request: ResetRequest,\n        onSuccess: (ResetConfirmation) -\u003e Unit,\n        onError: (CallError) -\u003e Unit\n    )\n}\n```\n\nMessages initiated by us and sent to the charge point is a little bit more difficult.\n\n1. The message should be send to an object that contains the WS session\n2. Format the message to a OCPP json string\n3. Send it over the WS connection\n4. Synchronize so that when we receive the response object, we can parse it and either unblock the waiting thread or\n   call the callback objects\n\nA rough blocking implementation of this is today in `com.monta.ocpp.service.ChargePointConnection` which implements\n`CoreProfile`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonta-app%2Flibrary-ocpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonta-app%2Flibrary-ocpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonta-app%2Flibrary-ocpp/lists"}