🏗️ Build Real Apps — app8.5
Developer CourseModule 8: Build Real Appsapp8.5
Hands-on30 min

Hands-on: Build Your First Full App

🏗️ Module 8: Build Real Apps

Hands-on: Build Your First Full App

Time to build. You're going to create a Carbon-Tracked Battery Optimizer — an app that combines 3+ primitives into something a real employer would pay for.

What You're Building

An automated system that:

  1. Reads grid prices to find the best charge/discharge windows
  2. Dispatches battery commands at optimal times
  3. Creates carbon attestations for every action
  4. Verifies the entire chain for audit readiness

Step 1: Provision Your Sandbox

curl -s -X POST https://app.energyatit.com/api/v1/sandbox/provision \
  -H "Authorization: Bearer $TOKEN" | jq '.'
curl.exe --% -X POST -H "Authorization: Bearer $env:TOKEN" "https://app.energyatit.com/api/v1/sandbox/provision" | ConvertFrom-Json | ConvertTo-Json -Depth 10

This gives you a sandbox environment with simulated sites, assets, and grid connections.

Step 2: The Full Script

from energyatit import EnergyAtItClient
import time

client = EnergyAtItClient(token="your_token")

# 1. Read grid prices
prices = client.get_grid_prices(region="UAE")
current_price = prices['current_price_kwh']
print(f"Current price: {current_price} AED/kWh")

# 2. Decision logic: charge if cheap, discharge if expensive
if current_price < 0.25:
    print("Price is low — charging battery")
    result = client.dispatch_command(
        asset_id=1,
        command="charge",
        target_kw=100,
        duration_minutes=60
    )
    action = "charge"
elif current_price > 0.35:
    print("Price is high — discharging battery")
    result = client.dispatch_command(
        asset_id=1,
        command="discharge",
        target_kw=100,
        duration_minutes=60
    )
    action = "discharge"
else:
    print("Price is moderate — holding")
    action = "hold"

# 3. Create carbon attestation for the action
if action != "hold":
    record = client.create_carbon_record(
        meter_id="METER-001",
        facility_id="YOUR_FACILITY_UUID",
        timestamp=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
        kwh=100.0
    )
    print(f"Carbon record created: {record['id']}")

# 4. Verify the chain
verification = client.verify_carbon_chain(meter_id="METER-001")
print(f"Chain valid: {verification['chain_valid']}")
print(f"Total records: {verification['record_count']}")

What Makes This Portfolio-Worthy

This is not a toy. This script:

  • Makes economic decisions based on real-time data
  • Executes physical commands on battery hardware
  • Creates cryptographic proof of every action
  • Maintains an auditable chain that passes compliance checks

When you show this to a hiring manager at Khazna or TAQA, you're not showing them code. You're showing them a production-ready system that solves a real problem.

Open Hands-on Lab

Complete the exercise in the Developer Hub.

Launch

Log in to track your progress and earn certifications.