{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/evcc/json-schema/evcc-grid-sessions-schema.json",
  "title": "GridSessions",
  "description": "Grid limitation sessions",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/evcc-openapi.yaml#/components/schemas/GridSessions",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "$ref": "#/$defs/Id"
      },
      "created": {
        "$ref": "#/$defs/Timestamp"
      },
      "finished": {
        "$ref": "#/$defs/Timestamp"
      },
      "type": {
        "type": "string",
        "enum": [
          "consumption",
          "feedin"
        ],
        "description": "Type of grid limitation event"
      },
      "gridPower": {
        "type": "number",
        "description": "Grid power in watts"
      },
      "limitPower": {
        "type": "number",
        "description": "Limitation power in watts"
      },
      "chargeDuration": {
        "type": "number",
        "description": "Duration of active charging"
      },
      "solarPercentage": {
        "type": "number",
        "description": "Solar percentage of the session"
      },
      "price": {
        "type": "number",
        "description": "Total price of the session"
      },
      "pricePerKWh": {
        "type": "number",
        "description": "Average price per kWh"
      },
      "co2PerKWh": {
        "type": "number",
        "description": "Average CO₂ emissions per kWh"
      }
    }
  },
  "$defs": {
    "Id": {
      "description": "Loadpoint index starting at 1.",
      "type": "integer",
      "minimum": 1
    },
    "Timestamp": {
      "description": "Timestamp in RFC3339 format",
      "type": "string",
      "format": "date-time"
    }
  }
}