Git Product home page Git Product logo

aws-samples / aws-ocpp-gateway Goto Github PK

View Code? Open in Web Editor NEW
63.0 3.0 22.0 3.42 MB

This solution demonstrates how the OCPP Gateway acts as a proxy between OCPP and MQTT, enabling integration with AWS IoT Core and downstream CPO services built on AWS.

Home Page: https://aws.amazon.com/blogs/iot/building-an-ocpp-compliant-electric-vehicle-charge-point-operator-solution-using-aws-iot-core/

License: MIT No Attribution

JavaScript 2.67% Python 34.89% TypeScript 59.81% Dockerfile 1.37% Shell 1.27%
aws cpo ev-charging iot iot-core ocpp ecs-fargate ev

aws-ocpp-gateway's People

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

Watchers

 avatar  avatar  avatar

aws-ocpp-gateway's Issues

Question: Using this gateway for production?

Hello,

I am building a CSMS server on aws and wanted to evaluate using this gateway in a production environment. I am a little confused with how to architect this (as my understanding with a few AWS services are at a novice level).

  1. I will need to extend the message processor in the gateway code to support different topics other than heartbeat, bootnotification & statusNotification, right? Including all actions under ocpp 1.6 and 2.0.1 ? Or do we just create rules in in AWS IoT to route certain messages to a DynamoDb table?
  2. Essentially this gateway should be extended such that all incoming messages are routed to DyanamoDb and there we can have Dynamodb streams to act on relevant/interesting topics OR would you suggest the message processor to route relevant topics (like startTransation) to an appropriate AWS service (responsible for handling it) OR should all the messages be pushed to SQS and then my AWS service subscribe to relevant topic to act on it?
  3. To what extent is the ocpp library used here? How do we leverage it fully with the ocpp gateway?
  4. Why would you recommend going for such a solution instead of building our own server?

CreateKeysAndCertificate fails when deploying

I followed the documentation to deploy the stack to this point:

image

Here it keeps failing with this error:

15:27:55 | CREATE_FAILED        | Custom::AWS                                 | CreateKeysAndCertificate4D276FB5
Response object is too long.

15:28:02 | DELETE_FAILED        | Custom::AWS                                 | CreateKeysAndCertificate4D276FB5
Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certifi
cateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certif
icateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)


 ❌  AwsOcppGatewayStack failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [CreateKeysAndCertificate4D276FB5]. ): Response object is too long., Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)
    at FullCloudFormationDeployment.monitorDeployment (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:380:10236)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async deployStack2 (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:145458)
    at async /Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:128776
    at async run (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:126782)

 ❌ Deployment failed: Error: Stack Deployments Failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [CreateKeysAndCertificate4D276FB5]. ): Response object is too long., Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)
    at deployStacks (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:129083)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async CdkToolkit.deploy (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:383:147507)
    at async exec4 (/Users/martinseubert/.npm/_npx/e72b144743208263/node_modules/aws-cdk/lib/index.js:438:51799)

Stack Deployments Failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_FAILED (The following resource(s) failed to delete: [CreateKeysAndCertificate4D276FB5]. ): Response object is too long., Received response status [FAILED] from custom resource. Message returned: 2 validation errors detected: Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must satisfy regular expression pattern: (0x)?[a-fA-F0-9]+; Value 'AwsOcppGatewayStack-CreateKeysAndCertificate4D276FB5-4OE0BIJZDROY' at 'certificateId' failed to satisfy constraint: Member must have length less than or equal to 64 (RequestId: 083d3d06-5e9a-420a-9f49-abd4f86d192e)

Any idea what I am doing wrong? All steps (incl. bootstrapping) before worked out fine.
I am trying to deploy to eu-central-1 btw.

nodejs runtime error for Lambda during deployment

Current version is failing with Lambda runtime error during deployment and rolls back changes. Local nodejs is 20.x:

11:12:25 AM | CREATE_FAILED | AWS::Lambda::Function | AWS679f53fac002430...7982bd22872D164C4C
Resource handler returned message: "The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs20.x)
while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 8aae1b26-9a56-4240-9764-1738caec8371)" (RequestToken: ad03482d-062b-841f-6bc0-ef6b6ff4b793, HandlerErrorC
ode: InvalidRequest)

No module named RDPS

I tried to simulate a CP in Simulating CP connectivity step 9.
When running python3 simulate.py --url {websocket URL generated from the AWS OCPP Stack} --cp-id CP1 I get:
ERROR:root:VirtualChargePoint1: Waited 30s for response on .......

It turns out there is a missing import in the lambda function called: AwsOcppGatewayStack-OCPPMessageProcessor....
[ERROR] Runtime.ImportModuleError: Unable to import module 'message_processor': No module named 'rpds.rpds'

I tried adding rpds to the requirements.txt file and deploying it trough AWS, but it did not resolve the issue.

The program keeps reporting 400 errors

Hi,

When I changed the log level of the program to INFO, the program continued to output 400 errors. But no requests were actually made to access the server, and the errors were very frequent, close to once a second.

image

Thanks

Service/Service (ServiceD69D759B) Resource timed out waiting for completion (RequestToken: 236aecf9-3036-3527-ad2e-213c52aed71e)

Our company has deployed the iot service based on the mqtt protocol before, and now the charging pile needs to support ocpp. I tried it according to the process you wrote, but something went wrong, please help me to take a look

When the following code is executed, an error is reported

npx cdk deploy

and the following is the error log.

AwsOcppGatewayStack | 10:19:35 | CREATE_FAILED        | AWS::ECS::Service                           | Service/Service (ServiceD69D759B) Resource timed out waiting for completion (RequestToken: 236aecf9-3036-3527-ad2e-213c52aed71e)

 ❌  AwsOcppGatewayStack failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource timed out waiting for completion (Requ
estToken: 236aecf9-3036-3527-ad2e-213c52aed71e)
    at FullCloudFormationDeployment.monitorDeployment (E:\MyAndroidProject\GitHub\aws-ocpp-gateway\node_modules\aws-cdk\lib\index.js:380:10236)
    at runMicrotasks (<anonymous>)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async deployStack2 (E:\MyAndroidProject\GitHub\aws-ocpp-gateway\node_modules\aws-cdk\lib\index.js:383:145775)
    at async E:\MyAndroidProject\GitHub\aws-ocpp-gateway\node_modules\aws-cdk\lib\index.js:383:128776
    at async run (E:\MyAndroidProject\GitHub\aws-ocpp-gateway\node_modules\aws-cdk\lib\index.js:383:126782)

 ❌ Deployment failed: Error: Stack Deployments Failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource timed out waitig for completion (RequestToken: 236aecf9-3036-3527-ad2e-213c52aed71e)
ng for completion (RequestToken: 236aecf9-3036-3527-ad2e-213c52aed71e)
    at deployStacks (E:\MyAndroidProject\GitHub\aws-ocpp-gateway\node_modules\aws-cdk\lib\index.js:383:129083)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async CdkToolkit.deploy (E:\MyAndroidProject\GitHub\aws-ocpp-gateway\node_modules\aws-cdk\lib\index.js:383:147824)
    at async exec4 (E:\MyAndroidProject\GitHub\aws-ocpp-gateway\node_modules\aws-cdk\lib\index.js:438:51984)

Stack Deployments Failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource timed out waiting for completion (RequestToken: 236aecf9-3036-3527-ad2e-213c52aed71e)

This is my current operating environment
System: Windows 10
docker: 20.10.17
npx: 8.11.0
cdk: 2.84.0
nodejs: 16.16.0
Operating environment: visual studio code terminal

Deployment gets failed

I am trying to deploy but every time stack fails while creating the ECS service. I am not getting an elaborative error. It just says resource timed out while waiting for completion.

Error: Stack Deployments Failed: Error: The stack named AwsOcppGatewayStack failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource timed out waiting for completion

Can someone please help?

Error received in the gateway container whilst trying to connect.

Simulator returns the following error whilst trying to connect.

ERROR:root:CP1: received 1011 (internal error); then sent 1011 (internal error)

Gateway Container is showing the following Log output.

| Successfully set IOT certificates |
| Starting the gateway server |
| We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt |
| Exception ignored in: <function Client.del at 0xffff92890040> |
| Traceback (most recent call last): |
| File "/opt/ocpp-gateway/lib64/python3.10/site-packages/paho/mqtt/client.py", line 874, in del |
| self._reset_sockets() |
| File "/opt/ocpp-gateway/lib64/python3.10/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets |
| self._sock_close() |
| File "/opt/ocpp-gateway/lib64/python3.10/site-packages/paho/mqtt/client.py", line 1119, in _sock_close |
| if not self._sock: |
| AttributeError: 'Client' object has no attribute '_sock' |
| ERROR:websockets.server:connection handler failed |
| Traceback (most recent call last): |
| File "/opt/ocpp-gateway/lib64/python3.10/site-packages/websockets/legacy/server.py", line 236, in handler |
| await self.ws_handler(self) |
| File "/opt/ocpp-gateway/lib64/python3.10/site-packages/websockets/legacy/server.py", line 1175, in _ws_handler |
| return await cast( |
| File "/opt/ocpp-gateway/server.py", line 33, in handler |
| async with gateway.Gateway(charge_point_id, websocket) as iot_connection: |
| File "/opt/ocpp-gateway/gateway.py", line 37, in init |
| super().init( |
| File "/opt/ocpp-gateway/lib64/python3.10/site-packages/asyncio_mqtt/client.py", line 298, in init |
| self._client: mqtt.Client = mqtt.Client( |
| TypeError: Client.init() missing 1 required positional argument: 'callback_api_version' |

Deployment fails.

The error message is:
/bin/sh: line 1: /opt/ocpp-gateway/run-server.sh: Permission denied

After looking at #44 and #79 made sure the run-server.sh is LF terminated and not CRLF terminated. That did not help.

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.