🚀 Dispatch & Control — app3.5
Developer CourseModule 3: Dispatch & Controlapp3.5
Hands-on20 min

Hands-on: Charge and Discharge a Battery

🚀 Module 3: Dispatch & Control

Hands-on: Charge and Discharge a Battery

Open your terminal. You are going to dispatch real commands to a sandbox battery.

Setup

export EAT_KEY="eat_test_YOUR_KEY_HERE"

# Verify you can reach the API
curl -s -o /dev/null -w "HTTP %{http_code}\n" \
  -H "Authorization: $EAT_KEY" \
  https://app.energyatit.com/api/v1/sites
$env:EAT_KEY = "eat_test_YOUR_KEY_HERE"

# Verify you can reach the API
curl.exe -H "Authorization: $env:EAT_KEY" "https://app.energyatit.com/api/v1/sites"

Exercise 1: Read Battery State Before

# Check current battery SOC
curl -s -H "Authorization: $EAT_KEY" \
  https://app.energyatit.com/api/v1/grid-connections/1/readings | python3 -m json.tool
# Check current battery SOC
curl.exe -H "Authorization: $env:EAT_KEY" "https://app.energyatit.com/api/v1/grid-connections/1/readings" | ConvertFrom-Json | ConvertTo-Json -Depth 10

Note the soc_pct value.

Exercise 2: Charge the Battery

curl -X POST -H "Authorization: $EAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset_id": 1, "command": "charge", "target_kw": 50, "duration_minutes": 10}' \
  https://app.energyatit.com/api/v1/dispatch | python3 -m json.tool
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"asset_id": 1, "command": "charge", "target_kw": 50, "duration_minutes": 10}" "https://app.energyatit.com/api/v1/dispatch" | ConvertFrom-Json | ConvertTo-Json -Depth 10

Exercise 3: Check Dispatch History

curl -s -H "Authorization: $EAT_KEY" \
  https://app.energyatit.com/api/v1/dispatch/history/1 | python3 -m json.tool
curl.exe -H "Authorization: $env:EAT_KEY" "https://app.energyatit.com/api/v1/dispatch/history/1" | ConvertFrom-Json | ConvertTo-Json -Depth 10

Exercise 4: Discharge the Battery

curl -X POST -H "Authorization: $EAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset_id": 1, "command": "discharge", "target_kw": 75, "duration_minutes": 15}' \
  https://app.energyatit.com/api/v1/dispatch | python3 -m json.tool
curl.exe -H "Authorization: $env:EAT_KEY" "https://app.energyatit.com/api/v1/dispatch/history/1" | ConvertFrom-Json | ConvertTo-Json -Depth 10

Exercise 5: Generate a Settlement

curl -X POST -H "Authorization: $EAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"site_id": 1, "period_start": "2026-02-01", "period_end": "2026-02-28"}' \
  https://app.energyatit.com/api/v1/settlements | python3 -m json.tool
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"site_id": 1, "period_start": "2026-02-01", "period_end": "2026-02-28"}" "https://app.energyatit.com/api/v1/settlements" | ConvertFrom-Json | ConvertTo-Json -Depth 10

Verification

You have completed this lab if you: charged a battery, discharged a battery, checked the dispatch history showing both commands, and generated a settlement.

Open Hands-on Lab

Complete the exercise in the Developer Hub.

Launch

Log in to track your progress and earn certifications.