francoishill / Firepuma.EskomLoadShedding

A project to parse and represent Eskom loadshedding schedules (South Africa)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firepuma.EskomLoadShedding

A project to parse and represent Eskom (South Africa) loadshedding stages and schedules.

Note: This project currently only contains code to process the City of Cape Town loadshedding schedules and stages and is still a work in progress.

Deploy

Deploy the FunctionApp/FunctionApp.csproj project as an Azure Function.

See .github/workflows/deploy-function-app.yml for an example for deploying via Github actions, or visit the documentation.

Development

Open the Firepuma.EskomLoadShedding.sln solution file. FunctionApp/Api/* contains the http triggers (API endpoints of the Azure Function). Tests project contains the unit tests.

GetLoadsheddingCalendar API endpoint

This endpoint renders the loadshedding events as an ICalendar (internet calendar or ical for short) for the given customerType and areaNumber. The default startDaysAgo and endInDays values can be overwritten with query params.

Code for generating the calendar lives in FunctionApp/Infrastructure/Formatters/VCalendarOutputFormatter.cs and is implicitly used when creating a new new OkVCalendarObjectResult.

GetLoadsheddingSlots API endpoint

This endpoint responds with an array of time ranges for the given customerType, stage, areaNumber and date.

[
	{
		"start": "04:00:00",
		"end": "06:30:00"
	},
	{
		"start": "20:00:00",
		"end": "22:30:00"
	}
]

Source of information

City of Cape Town

Eskom

About

A project to parse and represent Eskom loadshedding schedules (South Africa)

License:MIT License


Languages

Language:C# 100.0%