EVerest / everest-demo

EVerest demo: Dockerized demo with software in the loop simulation
Apache License 2.0
11 stars 13 forks source link

Add general citrine support #58

Closed ChrisWeissmann closed 2 weeks ago

ChrisWeissmann commented 1 month ago

feat: add general citrine support with own device-model. Run bash command with argument -c.

Testing done: Used local branch to test before pushing to remote ./demo-iso15118-2-ac-plus-ocpp.sh -2 -c -r $(pwd) -b feature/add-citrine-support-signedoff

[+] Running 5/5
 ✔ Network citrineos-csms_default          Created                                                                                                                                                            0.0s
 ✔ Container citrineos-csms-ocpp-db-1      Healthy                                                                                                                                                           22.6s
 ✔ Container citrineos-csms-amqp-broker-1  Healthy                                                                                                                                                           22.6s
 ✔ Container citrineos-csms-directus-1     Healthy                                                                                                                                                           22.6s
 ✔ Container citrineos-csms-citrine-1      Healthy                                                                                                                                                           22.5s

Adding charger successfully:

Adding a charger to CitrineOS
Adding new station...
{"data":{"id":"cp001","isOnline":null,"locationId":2,"createdAt":"2024-06-10T15:10:18.175Z","updatedAt":"2024-06-10T15:10:18.176Z"}}{"data":{"id":"cp001","isOnline":null,"locationId":2,"createdAt":"2024-06-10T15:10:18.175Z","updatedAt":"2024-06-10T15:10:18.176Z"}}
Add cp001 password to citrine...
[+] Running 4/4
 ✔ Network everest-ac-demo_default          Created                                                                                                                                                           0.0s
 ✔ Container everest-ac-demo-mqtt-server-1  Healthy                                                                                                                                                           1.1s
 ✔ Container everest-ac-demo-nodered-1      Healthy                                                                                                                                                          31.0s
 ✔ Container everest-ac-demo-manager-1      Healthy
2024-06-10 15:13:05.314829 [INFO] ocpp:OCPP201     :: Received BootNotificationResponse: {
    "currentTime": "2024-06-10T15:13:05.306Z",
    "interval": 60,
    "status": "Accepted"
}
thanaParis commented 3 weeks ago

@shankari can we close https://github.com/EVerest/everest-demo/pull/53 in favor of this PR? Hoping we can merge this soon!

louisg1337 commented 3 weeks ago

Thank you guys for getting this over to us. I took some time to try out the new demo script and almost everything worked as expected. Here are the steps I took and the results I saw.

  1. Cloned repo + checked out branch.
    git clone https://github.com/ChrisWeissmann/everest-demo.git
    git checkout -b feature/add-citrine-support-signedoff origin/feature/add-citrine-support-signedoff      
  2. Ran the demo script.
    bash demo-iso15118-2-ac-plus-ocpp.sh -2 -c -r $(pwd) -b feature/add-citrine-support-signedoff     
  3. Observed all of the following (same as @ChrisWeissmann above).
    • Citrine containers start successfully ✅
    • Charger and password set successfully ✅
    • EVerest containers loaded properly ✅
    • BootNotificationResponse returned accepted ✅
  4. Went to localhost:8080/docs and sent a setChargingProfile API request.
    • Message was successfully sent to EVerest as it was in the OCPP logs and returned a Not Implemented. ✅
  5. Went to localhost:1880/ui and tried to start a charging session.
    • Unfortunately this didn't work as it seems like we aren't adding any authorization token to Citrine. Whenever I tried swiping the RFID to authorize the transaction, I get this message in return. ❌
      2024-06-17 22:49:02.926657 [INFO] token_provider_  :: Publishing new dummy token: {"id_token":{"value":"DEADBEEF","type":"ISO14443"},"authorization_type":"RFID","prevalidated":false,"connectors":[1]}
      2024-06-17 22:49:02.931590 [INFO] auth:Auth        :: Received new token: {
      "authorization_type": "RFID",
      "connectors": [
          1
       ],
      "id_token": {
          "type": "ISO14443",
          "value": "DEADBEEF"
       },
      "prevalidated": false
      }
      2024-06-17 22:49:02.942580 [INFO] ocpp:OCPP201     :: Found invalid entry in AuthCache: Sending new request
      2024-06-17 22:49:03.076192 [INFO] auth:Auth        :: Result for token: DEADBEEF: REJECTED

Let me know if I did something wrong somewhere along the line that would get 5 working. Other than that one issue, it all looked great. We really appreciate all the work that was put into getting this PR together!

EDIT:

I forgot to check this before, but MaEVe doesn't work with this new script. There are a few changes that need to be made to make it work in this new script, all of which I am working on getting into the review.

shankari commented 3 weeks ago

@thanaParis @ChrisWeissmann please see comment from @louisg1337

thanaParis commented 3 weeks ago

@louisg1337 the issues with maeve have been fixed! the add-charger.sh script was expanded to add-charger-and-rfid-card.sh and now adds an idToken to CitrineOS with value 'DEADBEEF' and type 'ISO14443'.

shankari commented 3 weeks ago

@louisg1337 in the absence of github actions, can you please try to rerun this for both MaEVe and Citrine? I can then merge this. @mukuflash03 for an example of what the lack of GH actions is doing 😦

louisg1337 commented 3 weeks ago

@louisg1337 the issues with maeve have been fixed! the add-charger.sh script was expanded to add-charger-and-rfid-card.sh and now adds an idToken to CitrineOS with value 'DEADBEEF' and type 'ISO14443'.

I can confirm everything works as expected now. I tested both Citrine and MaEVe and they both posted Accepted and worked in the SIL demo. Thank you @thanaParis and @ChrisWeissmann for fixing that for us!