SolarEdgeAPI

solaredge_interface.api.SolarEdgeAPI #

[view source] #

SolarEdgeAPI #

class SolarEdgeAPI()
[view source] #

This class implements Python3 interfaces to the documented SolarEdge API end-points. Refer to se_monitoring_api.pdf for more details on the SolarEdge API.

__init__ #

 | def __init__(api_key, datetime_response=False, pandas_response=False)
[view source] #

To call the SolarEdge API you need a valid api_key which can be obtained from your SolarEdge account.

parameters

  • api_key (str) required - a valid api_key from https://monitoring.solaredge.com
  • datetime_response (bool) default: False - if True then parse all fields with a date or datetime string and convert them into timezone aware Python datetime objects.
  • pandas_response (bool) default: False - if True then parse response data and flatten into Pandas DataFrame and make available in the .pandas response attribute

get_accounts #

 | def get_accounts(size=100, start_index=0, search_text="", sort_property="", sort_order="ASC")
[view source] #

Returns a list of sub-accounts (if available) that are accessible by the api_key with an ability to search and filter the results.

NB: api_key that do not have access to sub-accounts will return a “not authorized” response.

parameters

  • size (int) default: 100 - The maximum number of accounts returned by this call. The maximum number of accounts that can be returned by this call is 100. If you have more than 100 accounts, just request another 100 accounts with startIndex=100 which will fetch accounts 100-199.
  • start_index (int) default: 0 - The first account index to be returned in the results.
  • search_text (str) default: - The search text for accounts. Searchable accounts properties: Name, Notes, Email, Country, State, City, Zip, Full address
  • sort_property (str) default: - A sorting option for this account list, based on one of its properties. Available sort properties: Name, country, city, Address, zip, fax, phone, notes
  • sort_order (str) default: ASC - Sort order for the sort property. Allowed values are ASC (ascending) and DESC (descending)

Uses Least-Recently-Used caching strategy to reduce calls to API backend and speed re-occurring function calls.

get_sites #

 | def get_sites(size=100, start_index=0, search_text="", sort_property="", sort_order="ASC", status="Active,Pending")
[view source] #

Returns the sites accessible by the api_key with an ability to search and filter.

parameters

  • size (int) default: 100 - The maximum number of sites returned by this call. The maximum number of sites that can be returned by this call is 100. If you have more than 100 sites, just request another 100 sites with startIndex=100 which will fetch sites 100-199.
  • start_index (int) default: 0 - The first site index to be returned in the results.
  • search_text (str) default: - The search text for sites. Searchable site properties: Name, Notes, Address, City, Zip code, Full address, Country
  • sort_property (str) default: - A sorting option for this site list, based on one of its properties. Available sort properties: Name, Country, State, City, Address, Zip, Status, PeakPower, InstallationDate, Amount, MaxSeverity, CreationTime
  • sort_order (str) default: ASC - Sort order for the sort property. Allowed values are ASC (ascending) and DESC (descending)
  • status (str) default: Active,Pending - Select the sites to be included in the list by their status: Active, Pending, Disabled, All.

Uses Least-Recently-Used caching strategy to reduce calls to API backend and speed re-occurring function calls.

get_site_details #

 | def get_site_details(site_id)
[view source] #

Returns site details for site_id such as name, location, status, etc.

parameters

  • site_id (int) required - The site identifier to retrieve data for.

Uses Least-Recently-Used caching strategy to reduce calls to API backend and speed re-occurring function calls.

get_site_timezone #

 | def get_site_timezone(site_id, tempfile_cache_use=True)
[view source] #

Returns site timezone for site_id - returns from local tempfile cache to prevent repeated requests. This function is provided as a convenience.

parameters

  • site_id (int) required - The site identifier to retrieve data for.

Uses Least-Recently-Used caching strategy to reduce calls to API backend and speed re-occurring function calls.

get_site_data_period #

 | def get_site_data_period(site_id)
[view source] #

Returns the start-date and end-date of energy production at the site(s).

parameters

  • site_id (int or list) required - The site identifier(s) to retrieve data for, may be provided as a single int value or a list of int values to retrieve data in “bulk-mode”

Uses Least-Recently-Used caching strategy to reduce calls to API backend and speed re-occurring function calls.

get_site_energy #

 | def get_site_energy(site_id, start_date, end_date, time_unit="DAY")
[view source] #

Returns the site(s) energy measurements.

NB: the time input parameters required are date values in the format YYYY-MM-DD not full timestamp values.

parameters

  • site_id (int or list) required - The site identifier(s) to retrieve data for, may be provided as a single int value or a list of int values to retrieve data in “bulk-mode”
  • start_date (str) required - must be in format YYYY-MM-DD
  • end_date (str) required - must be in format YYYY-MM-DD
  • time_unit (str) default: DAY - Permitted values are: QUARTER_OF_AN_HOUR, HOUR, DAY, WEEK, MONTH, YEAR

get_site_time_frame_energy #

 | def get_site_time_frame_energy(site_id, start_date, end_date)
[view source] #

Return the site(s) total energy produced for a given date period.

NB: the time input parameters required are date values in the format YYYY-MM-DD not full timestamp values.

parameters

  • site_id (int or list) required - The site identifier(s) to retrieve data for, may be provided as a single int value or a list of int values to retrieve data in “bulk-mode”
  • start_date (str) required - must be in format YYYY-MM-DD
  • end_date (str) required - must be in format YYYY-MM-DD

get_site_overview #

 | def get_site_overview(site_id)
[view source] #

Return the site(s) overview data.

parameters

  • site_id (int or list) required - The site identifier(s) to retrieve data for, may be provided as a single int value or a list of int values to retrieve data in “bulk-mode”

get_site_power #

 | def get_site_power(site_id, start_time, end_time)
[view source] #

Return the site(s) power measurements in 15 minute resolution.

parameters

  • site_id (int or list) required - The site identifier(s) to retrieve data for, may be provided as a single int value or a list of int values to retrieve data in “bulk-mode”
  • start_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • end_time (str) required - must be in format YYYY-MM-DD hh:mm:ss

get_site_power_details #

 | def get_site_power_details(site_id, start_time, end_time, meters=None)
[view source] #

Detailed site power measurements from meters such as consumption, export (feed-in), import (purchase), etc. Calculated meter readings (also referred to as “virtual meters”), such as self-consumption, are calculated using the data measured by the meter and the inverters.

parameters

  • site_id (int) required - The site identifier to retrieve data for.
  • start_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • end_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • meters (str) default: - If this value is omitted all meter readings are returned. The following values are permitted separated by comma: Production, Consumption, SelfConsumption, FeedIn, Purchased

get_site_energy_details #

 | def get_site_energy_details(site_id, start_time, end_time, meters=None, time_unit="DAY")
[view source] #

Detailed site energy measurements from meters such as consumption, export (feed-in), import (purchase), etc. Calculated meter readings (also referred to as “virtual meters”), such as self-consumption, are calculated using the data measured by the meter and the inverters.

parameters

  • site_id (int) required - The site identifier to retrieve data for.
  • start_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • end_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • meters (str) default: None - If this value is omitted all meter readings are returned. The following values are permitted separated by comma: Production, Consumption, SelfConsumption, FeedIn, Purchased
  • time_unit (str) default: DAY - Permitted values are: QUARTER_OF_AN_HOUR, HOUR, DAY, WEEK, MONTH, YEAR

get_site_current_power_flow #

 | def get_site_current_power_flow(site_id)
[view source] #

Provides the current power flow between all elements of the site including PV array, storage (battery), loads (consumption) and grid.

parameters

  • site_id (int) required - The site identifier to retrieve data for.

get_site_storage_data #

 | def get_site_storage_data(site_id, start_time, end_time, serials=None)
[view source] #

Get detailed storage information from batteries:the state of energy, power and lifetime energy.

parameters

  • site_id (int) required - The site identifier to retrieve data for.
  • start_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • end_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • serials (list) default: None - Return data only for specific battery serial numbers; If omitted, the response includes all the batteries at the site.

get_site_environmental_benefits #

 | def get_site_environmental_benefits(site_id, system_units=None)
[view source] #

Get all environmental benefits based on site energy production:CO2 emissions saved, equivalent trees planted, and light bulbs powered for a day.

parameters

  • site_id (int) required - The site identifier to retrieve data for.
  • system_units (str) default: None - The system units used when returning gas emission savings. Valid values: Metrics, Imperial note these values are case sensitive. If system_units is not specified, the user system units are used.

get_site_inventory #

 | def get_site_inventory(site_id)
[view source] #

Get the inventory of SolarEdge equipment at the site, including inverters/SMIs, batteries, meters, gateways and sensors.

parameters

  • site_id (int) required - The site identifier to retrieve data for.

Uses Least-Recently-Used caching strategy to reduce calls to API backend and speed re-occurring function calls.

get_site_equipment_data #

 | def get_site_equipment_data(site_id, start_time, end_time, serial_number)
[view source] #

Get specific inverter data for a given timeframe.

parameters

  • site_id (int) required - The site identifier to retrieve data for.
  • start_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • end_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • serial_number (str) required - The inverter short serial number, eg 12345678-90

get_site_equipment_change_log #

 | def get_site_equipment_change_log(site_id, serial_number)
[view source] #

Returns a list of equipment component replacements ordered by date. This method is applicable to inverters, optimizers, batteries and gateways.

parameters

  • site_id (int) required - The site identifier to retrieve data for.
  • serial_number (str) required - Inverter, battery, optimizer or gateway short serial number.

get_site_meters #

 | def get_site_meters(site_id, start_time, end_time, meters=None)
[view source] #

Returns for each meter on site its lifetime energy reading, metadata and the device to which it is connected.

parameters

  • site_id (int) required - The site identifier to retrieve data for.
  • start_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • end_time (str) required - must be in format YYYY-MM-DD hh:mm:ss
  • meters (str ot list) default: None - Select specific meters only. If this value is omitted, all meter readings are returned. Valid values: Production, Consumption, FeedIn, Purchased.

get_site_equipment_sensors #

 | def get_site_equipment_sensors(site_id)
[view source] #

Returns a list of all the sensors in the site, and the device to which they are connected.

parameters

  • site_id (int) required - The site identifier to retrieve data for.

get_version_current #

 | def get_version_current()
[view source] #

Return the most updated version number in <major.minor.revision> format.

get_version_supported #

 | def get_version_supported()
[view source] #

Return a list of supported version numbers in <major.minor.revision> format