solar-api

Crates.iosolar-api
lib.rssolar-api
version0.1.3
sourcesrc
created_at2023-11-09 16:41:27.399852
updated_at2023-12-04 09:26:10.358773
descriptionRust library for accessing the SolarEdge Monitoring API
homepage
repositoryhttps://github.com/lrbalt/solar-api
max_upload_size
id1030277
size70,376
Reinier Balt (lrbalt)

documentation

https://docs.rs/solar-api

README

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();

Please note that sometimes the API is a bit later. The duration_from_now can be negative then and you have to wait a bit more like in the example below. Please note that checked_add is needed here to handle adding negative duration_from_now.

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

let next = Instant::now()
    .checked_add(Duration::from_secs(duration_from_now as u64))
    .unwrap_or(Instant::now() + Duration::from_secs(30));

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

Using the example in this crate

The example will call several API methods. To run it, use

cargo run --example use_api -- <API_KEY> <SITE_ID>

To see the http request and response use

RUST_LOG=solar_api=trace cargo run --example use_api -- <API_KEY> <SITE_ID>

Status

  • Site Data API
    • Site List
    • Site Details
    • Site Data: Start and End Dates
    • Site Data: Bulk Version
    • Site Energy
    • Site Energy: Bulk Version
    • Site Energy – Time Period
    • Site Energy – Time Period: Bulk Version
    • Site Power
    • [ ]Site Power: Bulk version
    • Site Overview
    • Site Overview: Bulk Version
    • Site Power - Detailed
    • Site Energy - Detailed
    • Site Power Flow
    • Storage Information
    • Site Image
    • Site Environmental Benefits
    • Installer Logo Image
  • Site Equipment API
    • Components List
    • Inventory
    • Inverter Technical Data
    • Equipment Change Log
  • Account List API
  • Meters API
    • Get Meters Data
  • Sensors API
    • Get Sensor List
    • Get Sensor Data
  • Data Types
    • Time Unit
    • Site Status
    • Site Type
Commit count: 9

cargo fmt