k-ko/discovergy-oauth1

Inexogy (former Discovergy) OAUTH 1.0 API client

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/k-ko/discovergy-oauth1

v5.0.1 2025-12-17 16:43 UTC

This package is auto-updated.

Last update: 2025-12-17 17:09:53 UTC


README

Former Discovergy

PHP classes to establish a OAuth1 session and access for Inexogy API.

Basic usage

use Exception;
use Inexogy\API1 as InexogyAPI;

try {
    $api = new InexogyAPI(
        // Required parameters
        $client,     // Your own application identifier
        $identifier, // Login for the Inexogy portal, mostly your email address
        $secret
    );

    // Use cache, system temp dir.
    $api->setCache(true);
    // Use your own cache dir.
    $api->setCache('/path/to/your/cache/dir');
    // If cache is used, default TTL is 1 day

    // Cache for 1 hour
    $api->setTTL(3600);

    // Authorize
    $api->init();
} catch (Exception $e) {
    die($e->getMessage());
}

The API class authorizes at the API and tries up to 5 times in case of an error.

With the $api instance you can now query the data.

At the moment the GET endpoints are implemented (via __call()):

Metadata

  • /devices
  • /field_names

Measurements

  • /readings
  • /last_reading
  • /statistics
  • /load_profile
  • /raw_load_profile

Disaggregation

  • /disaggregation
  • /activities

Website Access Code

  • /website_access_code

Virtual meters

  • /virtual_meters

Naming convention is: endpoint /snake_case must be called as getCamelCase().

getMeters() is separate, with lazy load and caching in file.

All methods expect the same required (and optional) paramters as described in the API docs.

So the call have to be

$last_reading = $api->getMeter('YOUR-METER-ID')->getLastReading();

With optional paramters a call would be

For example the endpoint /readings expect a resolution.

$readings = $api->getMeter('YOUR-METER-ID')->getReadings([ 'resolution' => $resolution, 'from' => $from ]);