ourenergy / ea-api
A wrapper for the Electricity Authority's Electricity Market Information API
Installs: 4 506
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- ext-json: *
- nyholm/psr7: ^1.0
- php-http/client-common: ^2.0
- php-http/discovery: ^1.0
Requires (Dev)
- php-http/guzzle6-adapter: ^2.0
- php-http/mock-client: ^1.4
- phpunit/phpunit: ^7.5
README
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 pricesrtd
- 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);