Modules
A module is one thing a community’s API can do. A community switches on only the modules it needs, and can switch on the same module more than once, for example a tariff for consumption and another for injection.
| Module | What it does | Takes a source |
|---|---|---|
members |
Lists the community’s members, verifies their activation codes and serves their contracts | Yes, a member source |
tariff |
Serves energy prices as a time series | Yes, a price source |
production |
Serves energy production as a time series | Yes, a production source |
simultaneity |
Serves how much production is consumed at the same time | Yes, a ratio source |
directive |
Serves a five-step signal, from -- to ++, telling members when to use energy |
Yes, a directive source |
billing |
Calculates energy costs from meter data and a contract | No |
timeseries |
Serves any time series, such as a solar forecast | Yes, any time series source |
Settings every module has
Section titled “Settings every module has”| Field | What it is |
|---|---|
type |
The module, such as tariff |
name |
Lowercase letters, digits, - and _; default if left out. It is part of the module’s address, so it must be unique among modules of the same type. |
display_name |
A name for people; the name if left out |
description |
What this module is for; the module’s own description if left out |
In the console, these are the fields at the top of a module’s form. The examples in these docs each show one module, ready to paste into the console’s YAML view:
type: tariffname: entsoedisplay_name: Day-ahead pricessource: type: entsoe_day_ahead country_code: BE api_key: { type: secret, name: entsoe_key }In a settings file, each module is an entry of the modules list:
modules: - type: tariff name: entsoe # …Where a module is served
Section titled “Where a module is served”Each module is served at /{type}/{name}/{version}, for example /tariff/entsoe/v1. The version is v1 for every module except billing, which is at v2.
Every Cofy API also serves interactive API documentation at /docs, its OpenAPI description at /openapi.json, and a health check at /health.
Time series modules
Section titled “Time series modules”The tariff, production, simultaneity, directive and timeseries modules all serve a time series. How to ask them for a period, the formats they serve and how they cache are described once, on the time series page.