ourenergy/ea-api

A wrapper for the Electricity Authority's Electricity Market Information API

0.4.2 2021-04-11 21:38 UTC

This package is auto-updated.

Last update: 2024-04-12 04:37:47 UTC


README

Build Status Latest Stable Version

Electricity Market Information API

A PHP wrapper for the Electricity Authority's EMI API. Supports PHP 7.1+.

You must have an active subscription key for the API you wish you use.

Requires a valid HTTPlug-compatible client, like php-http/guzzle6-adapter.

Installation

composer require ourenergy/ea-api

Prices

Retrieves five-minute pricing data. Client type can be one of the following;

  • rtp - Real-time prices
  • rtd - Real-time dispatch

Get the latest prices

use OurEnergy\Emi\Prices\Factories\ClientFactory;

$subscriptionKey = "your subscription key";

$client = ClientFactory::create("rtp", $subscriptionKey);

$prices = $client->getPrices();

print_r($prices);

Get prices within a date range

$prices = $client->getPrices(
    new DateTime("2019-01-01 00:00:00"),
    new DateTime("2019-01-01 00:30:00")
);

print_r($prices);

Subscribe to push updates

$serviceName = "Your service";
$callbackUrl = "http://yourwebsite.com";

$client->subscribe($serviceName, $callbackUrl);

Unsubscribe from push updates

$client->unsubscribe($callbackUrl);

Get a list of current subscriptions

$subscriptions = $client->getSubscriptions();

print_r($subscriptions);

ICP connection data

Provides methods to get data on Installation Control Points.

Look up an ICP number

use OurEnergy\Emi\Icp\Factories\ClientFactory;

$subscriptionKey = "your subscription key";

$client = ClientFactory::create($subscriptionKey);

$icp = $client->getById("0000143418TRD9F");

echo $icp->getNetwork()->getParticipantId();

Look up a list of ICP numbers

$icps = $client->getByIdList([
    "0000143418TRD9F",
    "0000130040TR3DB"
]);

print_r($icps);

Search by address

$icps = $client->search("260", "Tinakori");

print_r($icps);