Skip to content

Latest commit

 

History

History
202 lines (159 loc) · 9.24 KB

README.md

File metadata and controls

202 lines (159 loc) · 9.24 KB

enlighten

The Enlighten Systems API is a JSON-based API that provides access to performance data for a PV system. By using the Enlighten Systems API, you agree to the Enphase Energy API License Agreement.

Please note that the Enlighten Systems API does not provide performance data at a panel or microinverter level.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 2.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >=3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/NathanBaulch/EnphaseOpenAPI.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/NathanBaulch/EnphaseOpenAPI.git)

Then import the package:

import enlighten

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import enlighten

Getting Started

Please follow the installation procedure and then run the following:

import time
import enlighten
from pprint import pprint
from enlighten.api import default_api
from enlighten.model.client_error import ClientError
from enlighten.model.conflict_error import ConflictError
from enlighten.model.connection_type import ConnectionType
from enlighten.model.consumption_lifetime_response import ConsumptionLifetimeResponse
from enlighten.model.consumption_stats_response import ConsumptionStatsResponse
from enlighten.model.energy_lifetime_response import EnergyLifetimeResponse
from enlighten.model.envoys_response import EnvoysResponse
from enlighten.model.inventory_response import InventoryResponse
from enlighten.model.inverters_summary_by_envoy_or_site_response import InvertersSummaryByEnvoyOrSiteResponse
from enlighten.model.monthly_production_response import MonthlyProductionResponse
from enlighten.model.not_found_error import NotFoundError
from enlighten.model.production_meter_readings_response import ProductionMeterReadingsResponse
from enlighten.model.rgm_stats_response import RgmStatsResponse
from enlighten.model.search_system_id_response import SearchSystemIdResponse
from enlighten.model.server_error import ServerError
from enlighten.model.stats_response import StatsResponse
from enlighten.model.status import Status
from enlighten.model.summary_response import SummaryResponse
from enlighten.model.systems_response import SystemsResponse
from enlighten.model.unprocessable_entity_error import UnprocessableEntityError
# Defining the host is optional and defaults to https://api.enphaseenergy.com/api/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = enlighten.Configuration(
    host = "https://api.enphaseenergy.com/api/v2"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'


# Enter a context with an instance of the API client
with enlighten.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = default_api.DefaultApi(api_client)
    user_id = "4d6a51330a" # str | 
    system_id = 66 # int | 
    start_date = dateutil_parser('Fri Jul 01 10:00:00 AEST 2016').date() # date | The date on which to start the time series. Defaults to the system's operational date. (optional)
    end_date = dateutil_parser('Sun Jul 31 10:00:00 AEST 2016').date() # date | The last date to include in the time series. Defaults to yesterday or the last day the system reported, whichever is earlier. (optional)

    try:
        api_response = api_instance.consumption_lifetime(user_id, system_id, start_date=start_date, end_date=end_date)
        pprint(api_response)
    except enlighten.ApiException as e:
        print("Exception when calling DefaultApi->consumption_lifetime: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.enphaseenergy.com/api/v2

Class Method HTTP request Description
DefaultApi consumption_lifetime GET /systems/{system_id}/consumption_lifetime
DefaultApi consumption_stats GET /systems/{system_id}/consumption_stats
DefaultApi energy_lifetime GET /systems/{system_id}/energy_lifetime
DefaultApi envoys GET /systems/{system_id}/envoys
DefaultApi inventory GET /systems/{system_id}/inventory
DefaultApi inverters_summary_by_envoy_or_site GET /systems/inverters_summary_by_envoy_or_site
DefaultApi monthly_production GET /systems/{system_id}/monthly_production
DefaultApi production_meter_readings GET /systems/{system_id}/production_meter_readings
DefaultApi rgm_stats GET /systems/{system_id}/rgm_stats
DefaultApi search_system_id GET /systems/search_system_id
DefaultApi stats GET /systems/{system_id}/stats
DefaultApi summary GET /systems/{system_id}/summary
DefaultApi systems GET /systems

Documentation For Models

Documentation For Authorization

ApiKey

  • Type: API key
  • API key parameter name: key
  • Location: URL query string

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in enlighten.apis and enlighten.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from enlighten.api.default_api import DefaultApi
  • from enlighten.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import enlighten
from enlighten.apis import *
from enlighten.models import *