Module to wrap the Carbon Aware API which could be used to collect the information to calculate the delay.
We are planning to support multiple APIs to get the information needed to calculate the delay.
The Account can be created with a POST request (watttime.org/api-documentation). With the visitor plan you are allowed to query information for the CAISO_NORTH (California) region.
curl -X POST --location "https://api.watttime.org/register" \
-H "Content-Type: application/json" \
-d "{\"username\": \"<myWattTimeUsername>\",
\"password\": \"<myWattTimePassword>\",
\"email\": \"<myEmailAddress>\"}"
Start the carbon aware SDK locally which acts as a proxy to the WattTime-API:
Run Docker image:
Note: Replace <myWattTimeUsername>
and <myWattTimePassword>
with your individual credentials in the following command.
docker run -it --rm -p 8090:80 \
-e DataSources__EmissionsDataSource="WattTime" \
-e DataSources__ForecastDataSource="WattTime" \
-e DataSources__Configurations__WattTime__Type="WattTime" \
-e DataSources__Configurations__WattTime__Username="<myWattTimeUsername>" \
-e DataSources__Configurations__WattTime__Password="<myWattTimePassword>" \
ghcr.io/green-software-foundation/carbon-aware-sdk
Test the API with curl -s "http://localhost:8090/emissions/forecasts/current?location=westus"
.
This should return a lengthy JSON response.
Congratulations 🎉 - the API is now running locally.
Run the container locally and open
http://localhost:8090/api/v1/swagger.yaml