Skip to content

Add new custom API connector

Morten Trab edited this page Apr 27, 2022 · 4 revisions

If you should want to make a new API connector, please take a look in the connectors directory to see how they are made.

Should the connector be of public interest, please create a Pull Request with the connector to have this included in the default repo.

IMPORTANT!
   Class constructor name is required to be Connector and be defined in a file named __init__.py in a directory with a unique name.

Attributes used

Attribute name Type Purpose Description
SOURCE_NAME str Required The name used for attribution
REGIONS dict Required The regions supported for this connector
EXTRA_REGIONS dict Optional Extra regions to add to the default REGIONS in const.py (Same format used in both places)
EXTRA_CURRENCIES dict Optional Extra representations of currencies not already found in CURRENCY_LIST in in const.py (Same format used in both places)

Required functions

Function name Result type Description
async_get_spotprices None Fetch the spotprices from API and store in local variable

Required properties

NOTE: Remember to decorate the properties with property
NOTE: The resulting prices for today and tomorrow are expected to be returned in EUR/MWh

Property name Result type Description
today list Returns a list of named tuples using INTERVAL from const.py for todays prices
tomorrow list Returns a list of named tuples using INTERVAL from const.py for tomorrows prices