🚀 Dispatch & Control — app3.2
Developer CourseModule 3: Dispatch & Controlapp3.2
Reading10 min

grid.dispatch() — One Command to Control Any Device

🚀 Module 3: Dispatch & Control

grid.dispatch() — One Command to Control Any Device

The dispatch primitive sends a command to any energy device through a unified API. Battery, HVAC, EV charger — same endpoint, same format.

The API Call

# Dispatch: charge battery (asset 1) at 50kW for 30 minutes
curl -X POST -H "Authorization: $EAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "asset_id": 1,
    "command": "charge",
    "target_kw": 50,
    "duration_minutes": 30
  }' \
  https://app.energyatit.com/api/v1/dispatch
# Dispatch: charge battery (asset 1) at 50kW for 30 minutes
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": 30}" "https://app.energyatit.com/api/v1/dispatch"

Available Commands

CommandWhat It DoesTypical Devices
chargeStore energyBattery (BESS)
dischargeRelease energyBattery (BESS)
reduceLower consumptionHVAC, lighting
curtailLimit outputSolar inverter
shed_loadCut non-critical loadsAny controllable load
restoreReturn to normalAny device

The Python SDK Way

from energyatit import EnergyAtItClient
import os

client = EnergyAtItClient(api_key=os.environ["EAT_KEY"])

# Dispatch: discharge battery at 100kW for 60 minutes
result = client.dispatch.send(
    asset_id=1,
    command="discharge",
    target_kw=100,
    duration_minutes=60
)
print(f"Command ID: {result['id']}")
print(f"Status: {result['status']}")  # "pending"

What Happens Behind the Scenes

  1. API validates the command and checks RBAC permissions
  2. Command is created with status pending
  3. Protocol executor translates to device-native command (Modbus write, BACnet command, etc.)
  4. Device acknowledges → status moves to acknowledged
  5. Device executes → status moves to executed
  6. Read-back verifies the device state → completed or failed

Log in to track your progress and earn certifications.