> ## Documentation Index
> Fetch the complete documentation index at: https://dynamo-csms.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Smart Charging and Dynamic Load Balancing

> Set a site's maximum power limit, choose a load balancing strategy, view real-time power allocation across chargers, and trigger manual rebalancing.

Smart charging prevents a site from exceeding its grid connection capacity by continuously distributing available power across all active chargers. When a driver plugs in or unplugs, the system automatically recalculates how much power each charger should draw — no manual intervention required.

This guide shows you how to configure smart charging for a site, inspect the current allocation, and trigger a manual rebalance when needed.

<Note>
  Smart charging requires at least one charge point to be linked to the site and in an `Available` or `Charging` OCPP state before you configure it. Complete charge point commissioning first.
</Note>

## Set the site load configuration

Define the maximum power the site can draw and the strategy the scheduler should use to distribute it.

```bash theme={null}
curl -X PUT https://api.dynamo-csms.com/api/v1/smart-charging/sites/site_01HXMNOPQR34567890/config \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "max_power_kw": 100,
    "strategy": "equal",
    "min_charge_rate_kw": 3.7,
    "reserve_kw": 10
  }'
```

Response:

```json theme={null}
{
  "site_id": "site_01HXMNOPQR34567890",
  "max_power_kw": 100,
  "strategy": "equal",
  "min_charge_rate_kw": 3.7,
  "reserve_kw": 10,
  "updated_at": "2026-05-01T12:00:00Z"
}
```

### Strategy options

| Strategy                  | Description                                                             |
| ------------------------- | ----------------------------------------------------------------------- |
| `equal`                   | Divide available power equally across all active sessions               |
| `first_come_first_served` | Earlier sessions get full power; remaining power goes to later sessions |
| `priority`                | Distribute power according to per-charger priority weights you define   |
| `max_throughput`          | Maximise total energy delivered across the site                         |

The `reserve_kw` field keeps a buffer of grid headroom for non-EV loads (lighting, HVAC, etc.) so the EV chargers never consume the full `max_power_kw` allowance.

## Retrieve the current load configuration

```bash theme={null}
curl -X GET https://api.dynamo-csms.com/api/v1/smart-charging/sites/site_01HXMNOPQR34567890/config \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Response:

```json theme={null}
{
  "site_id": "site_01HXMNOPQR34567890",
  "max_power_kw": 100,
  "strategy": "equal",
  "min_charge_rate_kw": 3.7,
  "reserve_kw": 10,
  "updated_at": "2026-05-01T12:00:00Z"
}
```

## View the current power allocation

Check how power is currently distributed across all chargers at the site. This reflects the live OCPP charging profiles that have been pushed to each charge point.

```bash theme={null}
curl -X GET https://api.dynamo-csms.com/api/v1/smart-charging/sites/site_01HXMNOPQR34567890/allocation \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Response:

```json theme={null}
{
  "site_id": "site_01HXMNOPQR34567890",
  "total_capacity_kw": 100,
  "reserved_kw": 10,
  "available_kw": 90,
  "allocated_kw": 66,
  "idle_kw": 24,
  "chargers": [
    {
      "charge_point_id": "cp_01HX5P2QRSTUVWXYZ0",
      "connector_id": 1,
      "status": "Charging",
      "allocated_kw": 22,
      "actual_draw_kw": 19.4,
      "session_id": "ses_01HXGHIJKL23456789"
    },
    {
      "charge_point_id": "cp_01HX5P2RSTUVWXYZ1",
      "connector_id": 1,
      "status": "Charging",
      "allocated_kw": 22,
      "actual_draw_kw": 21.8,
      "session_id": "ses_01HXOPQRST89012345"
    },
    {
      "charge_point_id": "cp_01HX5P2RSTUVWXYZ2",
      "connector_id": 1,
      "status": "Charging",
      "allocated_kw": 22,
      "actual_draw_kw": 22.0,
      "session_id": "ses_01HXUVWXYZ90123456"
    },
    {
      "charge_point_id": "cp_01HX5P2RSTUVWXYZ3",
      "connector_id": 1,
      "status": "Available",
      "allocated_kw": 0,
      "actual_draw_kw": 0,
      "session_id": null
    }
  ],
  "calculated_at": "2026-05-01T12:05:30Z"
}
```

The `allocated_kw` is the limit pushed to the charger via an OCPP `SetChargingProfile` command. `actual_draw_kw` is the real-time meter value reported back by the charger.

## View allocation history

Retrieve historical allocation snapshots to analyse load patterns over time.

```bash theme={null}
curl -X GET "https://api.dynamo-csms.com/api/v1/smart-charging/sites/site_01HXMNOPQR34567890/allocation/history?from=2026-05-01T00:00:00Z&to=2026-05-01T12:00:00Z&interval=15m" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Response:

```json theme={null}
{
  "site_id": "site_01HXMNOPQR34567890",
  "interval": "15m",
  "snapshots": [
    {
      "timestamp": "2026-05-01T08:00:00Z",
      "allocated_kw": 44,
      "actual_draw_kw": 41.2,
      "active_sessions": 2
    },
    {
      "timestamp": "2026-05-01T08:15:00Z",
      "allocated_kw": 66,
      "actual_draw_kw": 63.2,
      "active_sessions": 3
    }
  ]
}
```

## Trigger a manual rebalance

The scheduler rebalances automatically when sessions start or end. Use the manual rebalance endpoint if you need to force an immediate recalculation — for example, after changing the site's `max_power_kw` or `strategy`.

```bash theme={null}
curl -X POST https://api.dynamo-csms.com/api/v1/smart-charging/sites/site_01HXMNOPQR34567890/rebalance \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Manual config update — increased site capacity to 100 kW"
  }'
```

Response:

```json theme={null}
{
  "site_id": "site_01HXMNOPQR34567890",
  "rebalance_id": "reb_01HXABCDEFGH1234567",
  "status": "completed",
  "chargers_updated": 3,
  "triggered_at": "2026-05-01T12:07:00Z",
  "completed_at": "2026-05-01T12:07:02Z"
}
```

`chargers_updated` shows how many chargers received a new `SetChargingProfile` OCPP command as a result of the rebalance.

<Warning>
  Triggering frequent manual rebalances can cause rapid oscillation in charge rates, which may be noticeable to drivers. Reserve manual rebalancing for configuration changes rather than routine operations.
</Warning>
