Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪠 Plumb through notify_charging_limit as a NOP #1

Open
wants to merge 1 commit into
base: set_charging_profile
Choose a base branch
from

Conversation

shankari
Copy link

So that we can finish testing the EVerest changes in EVerest/everest-demo#101 end-to-end

I have not yet plumbed through the changes to clear_charging_limit but they should be fairly simple, and I can leave them as an exercise for @Abby-Wheelis

Outline of changes:

  • add notify_charging_limit to the CallMap, and have it redirect to the notify_charging_limit_handler
  • add a handler for the notify_charging_limit
  • add classes for the request and response that we can use in the handler

Testing done:
Without this change:
EVerest/everest-demo#101 (comment)

With this change:

2025-01-27 02:36:16.234166 [INFO] ocpp:OCPP201     :: Received internal set_charging_limit: for 1 with purpose 15
2025-01-27 02:36:16.234471 [INFO] ocpp:OCPP201     :: SHANKARI: Invoking validate_and_add_profile with 1 and source EMS
2025-01-27 02:36:16.234598 [INFO] evse_manager_1:  :: set_max_current (14, 2025-01-27 02:36:26.094000000) called
2025-01-27 02:36:16.234517 [INFO] ocpp:OCPP201     :: SHANKARI: invoked validate_profile for evse_id: 1 and profile {
    "chargingProfileKind": "Absolute",
    "chargingProfilePurpose": "ChargingStationExternalConstraints",
    "chargingSchedule": [
        {
            "chargingRateUnit": "A",
            "chargingSchedulePeriod": [
                {
                    "limit": 15.0,
                    "startPeriod": 0
                }
            ],
            "duration": 86400,
            "id": 0,
            "startSchedule": "2025-01-27T02:36:16.234Z"
        }
    ],
    "id": 398,
    "stackLevel": 10
}
2025-01-27 02:36:16.234902 [INFO] ocpp:OCPP201     :: SHANKARI: after validating file request source
2025-01-27 02:36:16.234926 [INFO] ocpp:OCPP201     :: SHANKARI: after validating conflicting external constraints
2025-01-27 02:36:16.235939 [INFO] ocpp:OCPP201     :: SHANKARI: before validating by purpose
2025-01-27 02:36:16.235974 [INFO] ocpp:OCPP201     :: SHANKARI: should return valid here!
2025-01-27 02:36:16.235986 [INFO] ocpp:OCPP201     :: SHANKARI: result for 1 is Valid
2025-01-27 02:36:16.236010 [INFO] ocpp:OCPP201     :: SHANKARI: Modifying database
2025-01-27 02:36:16.243501 [INFO] ocpp:OCPP201     :: Returning from on_charging_limit_set with 1 and status Accepted
{"type":2,"action":"NotifyChargingLimit","id":"feda7835-c7d5-4717-8df6-79cdc5b17e9c","request":{"chargingLimit":{"chargingLimitSource":"EMS"},"chargingSchedule":[{"chargingRateUnit":"A","chargingSchedulePeriod":[{"limit":15.0,"startPeriod":0}],"duration":86400,"id":0,"startSchedule":"2025-01-27T02:36:16.234Z"}],"evseId":1}}

{"type":3,"action":"NotifyChargingLimit","id":"feda7835-c7d5-4717-8df6-79cdc5b17e9c","response":{}}

So that we can finish testing the EVerest changes in
EVerest/everest-demo#101
end-to-end

I have not yet plumbed through the changes to `clear_charging_limit`
but they should be fairly simple, and I can leave them as an exercise for
@Abby-Wheelis

Outline of changes:
- add `notify_charging_limit` to the `CallMap`, and have it redirect to the
  `notify_charging_limit_handler`
- add a handler for the `notify_charging_limit`
- add classes for the request and response that we can use in the handler

Testing done:
Without this change:
EVerest/everest-demo#101 (comment)

With this change:

```
2025-01-27 02:36:16.234166 [INFO] ocpp:OCPP201     :: Received internal set_charging_limit: for 1 with purpose 15
2025-01-27 02:36:16.234471 [INFO] ocpp:OCPP201     :: SHANKARI: Invoking validate_and_add_profile with 1 and source EMS
2025-01-27 02:36:16.234598 [INFO] evse_manager_1:  :: set_max_current (14, 2025-01-27 02:36:26.094000000) called
2025-01-27 02:36:16.234517 [INFO] ocpp:OCPP201     :: SHANKARI: invoked validate_profile for evse_id: 1 and profile {
    "chargingProfileKind": "Absolute",
    "chargingProfilePurpose": "ChargingStationExternalConstraints",
    "chargingSchedule": [
        {
            "chargingRateUnit": "A",
            "chargingSchedulePeriod": [
                {
                    "limit": 15.0,
                    "startPeriod": 0
                }
            ],
            "duration": 86400,
            "id": 0,
            "startSchedule": "2025-01-27T02:36:16.234Z"
        }
    ],
    "id": 398,
    "stackLevel": 10
}
2025-01-27 02:36:16.234902 [INFO] ocpp:OCPP201     :: SHANKARI: after validating file request source
2025-01-27 02:36:16.234926 [INFO] ocpp:OCPP201     :: SHANKARI: after validating conflicting external constraints
2025-01-27 02:36:16.235939 [INFO] ocpp:OCPP201     :: SHANKARI: before validating by purpose
2025-01-27 02:36:16.235974 [INFO] ocpp:OCPP201     :: SHANKARI: should return valid here!
2025-01-27 02:36:16.235986 [INFO] ocpp:OCPP201     :: SHANKARI: result for 1 is Valid
2025-01-27 02:36:16.236010 [INFO] ocpp:OCPP201     :: SHANKARI: Modifying database
2025-01-27 02:36:16.243501 [INFO] ocpp:OCPP201     :: Returning from on_charging_limit_set with 1 and status Accepted
```

```
{"type":2,"action":"NotifyChargingLimit","id":"feda7835-c7d5-4717-8df6-79cdc5b17e9c","request":{"chargingLimit":{"chargingLimitSource":"EMS"},"chargingSchedule":[{"chargingRateUnit":"A","chargingSchedulePeriod":[{"limit":15.0,"startPeriod":0}],"duration":86400,"id":0,"startSchedule":"2025-01-27T02:36:16.234Z"}],"evseId":1}}

{"type":3,"action":"NotifyChargingLimit","id":"feda7835-c7d5-4717-8df6-79cdc5b17e9c","response":{}}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant