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
| Command | What It Does | Typical Devices |
|---|---|---|
charge | Store energy | Battery (BESS) |
discharge | Release energy | Battery (BESS) |
reduce | Lower consumption | HVAC, lighting |
curtail | Limit output | Solar inverter |
shed_load | Cut non-critical loads | Any controllable load |
restore | Return to normal | Any 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
- API validates the command and checks RBAC permissions
- Command is created with status
pending - Protocol executor translates to device-native command (Modbus write, BACnet command, etc.)
- Device acknowledges → status moves to
acknowledged - Device executes → status moves to
executed - Read-back verifies the device state →
completedorfailed
Log in to track your progress and earn certifications.