Crate solar_api

source ·
Expand description

Solar API

Rust library for accessing the Solar Edge API. This library uses the API documentation found here

API Key and Site ID

To access the data of your installation, you need to get an API key. You can get this from the SolardEdge Monitoring Portal. Log in with your SolarEdge Account, go to the Admin section, Site Access tab and activate API access. Mark the checkbox and you will see the API Key and Site ID

Rate limited

Please be aware that the API is rate limited, i.e. it will block requests after reaching a maximum of requests in an hour. It will be available again after that hour. Also note that the measurements seem to be limited to one per fifteen minutes. You can consider scheduling a read of data ±15 minutes after the timestamp of last read measurement. For example you can use a duration of 15m 10s:

let next_update = last_updated_datetime + Duration::seconds(15 * 60 + 10);

There is a convenience method to help with this:

let site_overview: Overview = overview(api_key, site_id);
let (next_update, duration_from_now) = site_overview.estimated_next_update();

// wait duration_from_now or set timeout at next_update before
// getting power or energy data

Structs

Enums

  • Possible errors that this lib can return. The underlying errors are included, either being [request::Error``] or [serde_json::Error`]

Functions

  • Return the energy production start and end dates of the site
  • Displays the site details, such as name, location, status, etc.
  • Return the site energy measurements. Usage limitation: This API is limited to one year when using time_unit=TimeUnit::Day (i.e., daily resolution) and to one month when using time_unit=TimeUnit::QuarterOfAnHour or time_unit=TimeUnit::Hour. This means that the period between period.end_timeandperiod.start_time` should not exceed one year or one month respectively. If the period is longer, the system will generate error
  • List all sites of customer. Each Site has an id that can be used to retrieve detailled information using for example energy
  • Display the site overview data.
  • Return the site power measurements in 15 minutes resolution. This API is limited to one-month period. This means that the period between end_datetime and start_datetime should not exceed one month. If the period is longer, the system will generate error .