Skip to main content

API Module

The api package provides the core API endpoints for the system.

Building Management

Endpoints for building-level data.

Get Building Consumption

GET /consumption

Retrieves the total energy consumption of the building, averaged over a specified duration.

Parameters

NameTypeInDescription
durationintegerqueryDuration in seconds to compute the average consumption. Default: 60, Minimum: 10

Responses

Status CodeDescription
200Successful response with total consumption data.
400Bad request, if the duration is not an integer.
500Internal server error.

Get GRAP Values

GET /grap

Retrieves the Grid Response and Protection (GRAP) state and limit values.

Responses

Status CodeDescription
200Successful response with GRAP values.
500Internal server error.

Device Management

Endpoints for device management.

Adjust Device Setpoint

POST /setpoint/{device_id}

Adjusts the setpoint of a specific device.

Parameters

NameTypeInDescription
device_idstringpathID of the device.
setpointnumberqueryThe desired setpoint value.

Responses

Status CodeDescription
200Setpoint successfully applied.
404Device not found.

Schedule Device Dispatches

POST /schedule/{priority}

Schedules setpoint dispatches for multiple devices with a given priority.

Parameters

NameTypeInDescription
priorityintegerpathPriority level (0-100). Higher values indicate higher priority.
dispatchesobjectbodyA dictionary of device IDs to a dictionary of datetime-setpoint pairs. See example in the original docstring.

Responses

Status CodeDescription
200Schedule saved successfully.
400Invalid priority value.

Get Device List

GET /

Retrieves the list of all controllable devices.

Responses

Status CodeDescription
200Successful response with the list of devices.
500Internal server error.

Get Device State

GET /state/{device_id}

Retrieves the current state of a specific device.

Parameters

NameTypeInDescription
device_idstringpathID of the device.
fieldstringqueryOptional field of the state to read.

Responses

Status CodeDescription
200Successful response with the device state.
404Device not found.

Data Management

Endpoints for retrieving forecast, historic, and preferences data.

Get Forecast Data

GET /forecast/{forecast_type}

Retrieves forecast data for non-controllable loads.

Parameters

NameTypeInDescription
forecast_typestringpathThe type of forecast data to retrieve.
startdatetimequeryThe start timestamp for the forecast data.
stopdatetimequeryThe stop timestamp for the forecast data.

Responses

Status CodeDescription
200Successful response with forecast data.
404Forecast type not found.

Get Historical Data

GET /historic/{historic_type}

Retrieves historical data for various device types.

Parameters

NameTypeInDescription
historic_typestringpathThe type of historical data to retrieve.
startdatetimequeryThe start timestamp for the historical data.
stopdatetimequeryThe stop timestamp for the historical data.
device_idstringqueryDevice ID, if applicable.

Responses

Status CodeDescription
200Successful response with historical data.
400Bad request, if device_id is required but not provided.
404Historical type not found.

Get Preferences Data

GET /preferences/{preferences_type}

Retrieves user preferences data.

Parameters

NameTypeInDescription
preferences_typestringpathThe type of preferences data to retrieve.
device_idstringqueryDevice ID.
startdatetimequeryStart timestamp.
stopdatetimequeryStop timestamp.
sampling_in_minutesintegerquerySampling interval in minutes. Default: 10.

Responses

Status CodeDescription
200Successful response with preferences data.
204No content found for the given parameters.
400Bad request (e.g., time range > 7 days).
404No data found for the given preferences type.

Get Weather Forecast Data

GET /weather/forecast/{variable}

Retrieves weather forecast data.

Parameters

NameTypeInDescription
variablestringpathThe weather variable to retrieve.
startdatetimequeryThe start timestamp for the forecast data.
stopdatetimequeryThe stop timestamp for the forecast data.

Responses

Status CodeDescription
200Successful response with weather forecast data.
400Bad request (e.g., start time in the past).
500Internal server error.

Get Weather Historic Data

GET /weather/historic/{variable}

Retrieves weather historic data.

Parameters

NameTypeInDescription
variablestringpathThe weather variable to retrieve.
startdatetimequeryThe start timestamp for the historic data.
stopdatetimequeryThe stop timestamp for the historic data.

Responses

Status CodeDescription
200Successful response with weather historic data.
400Bad request (e.g., start time in the future).
500Internal server error.