emqx/apps/emqx_gateway_ocpp
Thales Macedo Garitezi 19f3b030f9 chore: preparing to run common tests / eunit with mix 2024-07-02 09:45:45 -03:00
..
include fix(ocpp): avoid an error log in handling dnsteeam messages 2024-04-17 17:48:19 +08:00
priv/schemas feat: port the ocpp gateway from version 4 2023-11-03 16:51:21 +08:00
src feat(authn): add connection expire based on authn data 2024-04-30 17:04:55 +03:00
test feat(authn): add connection expire based on authn data 2024-04-30 17:04:55 +03:00
.gitignore feat: port the ocpp gateway from version 4 2023-11-03 16:51:21 +08:00
BSL.txt chore: update BSL license change date 2024-01-29 16:47:31 +01:00
README-cn.md feat: port the ocpp gateway from version 4 2023-11-03 16:51:21 +08:00
README.md feat: port the ocpp gateway from version 4 2023-11-03 16:51:21 +08:00
mix.exs chore: preparing to run common tests / eunit with mix 2024-07-02 09:45:45 -03:00
rebar.config chore: upgrade to jesse 1.8.0 for draft-06 as default version 2024-03-19 14:47:11 +01:00

README.md

emqx-ocpp

OCPP-J 1.6 Gateway for EMQX that implement the Central System for OCPP-J protocol.

Treat Charge Point as Client of EMQX

In EMQX 4.x, OCPP-J Gateway implement as a protocol Plugin and protocol Module (enterprise only).

All Charge Point connected to OCPP-J Gateway will be treat as a normal Client (like MQTT Client) in EMQX, you can manage it in Dashboard/HTTP-API/CLI by charge point identity.

The Client Info mapping in OCPP-J Gateway:

  • Client ID: presented by charge point identity.
  • Username: parsed by the username field for HTTP basic authentication.
  • Password: parsed by the password field for HTTP basic authentication.

Charge Point Authentication

As mentioned in the ocpp-j-1.6 specification, Charge Point can use HTTP Basic for authentication. OCPP-J Gateway extracts the username/password from it and fetches an approval through EMQX's authentication hooks.

That is, the OCPP-J Gateway uses EMQX's authentication plugin to authorize the Charge Point login.

Message exchanging among Charge Point, EMQX (Central System) and Third-services

                                +----------------+  upstream publish  +---------+
+--------------+   Req/Resp     | OCPP-J Gateway | -----------------> | Third   |
| Charge Point | <------------> | over           |     over Topic     | Service |
+--------------+   over ws/wss  | EMQX           | <----------------- |         |
                                +----------------+  dnstream publish  +---------+

Charge Point and OCPP-J Gateway communicate through the specifications defined by OCPP-J. It is mainly based on Websocket or Websocket TLS.

The OCPP-J Gateway publishes all Charge point messages through EMQX, which are called Up Stream. It consists of two parts:

  • Topic: the default topic structure is ocpp/${clientid}/up/${type}/${action}/${id}

    • ${clientid}: charge point identity.
    • ${type}: enum with request, response, error
    • ${action}: enum all message type name defined ocpp 1.6 edtion 2. i.e: BootNotification.
    • ${id}: unique message id parsed by OCPP-J message
  • Payload: JSON string defined ocpp 1.6 edtion 2. i.e:

    {"chargePointVendor":"vendor1","chargePointModel":"model1"}
    

The OCPP-J Gateway receives commands from external services by subscribing to EMQX topics and routing them down to the Charge Point in the format defined by OCPP-J, which are called Down Stream. It consists of two parts:

  • Topic: the default topic structure is ocpp/${clientid}/dn/${type}/${action}/${id}

    • The values of these variables are the same as for upstream.
    • To receive such messages, OCPP-J Gateway will add a subscription ocpp/${clientid}/dn/+/+/+ for each Charge point client.
  • Payload: JSON string defined ocpp 1.6 edtion 2. i.e:

    {"currentTime": "2022-06-21T14:20:39+00:00", "interval": 300, "status": "Accepted"}
    

Message Re-transmission

TODO

ocpp.awaiting_timeout = 30s

ocpp.retry_interval = 30s

Message Format Checking

TODO

#ocpp.message_format_checking = all

#ocpp.json_schema_dir = ${application_priv}/schemas

#ocpp.json_schema_id_prefix = urn:OCPP:1.6:2019:12:

Management and Observability

Manage Clients

Observe the messaging state