Skip to main content

solaredge-influxdb

A Python application that fetches solar energy data from the SolarEdge API and stores it in InfluxDB.

Features

  • Retrieves real-time and historical energy data from SolarEdge inverters
  • Automatically calculates sunrise/sunset times to optimize API calls during daylight hours
  • Stores data in InfluxDB for time-series analysis and visualization
  • Supports multiple data types: inverters, meters, and equipment
  • Timezone-aware data collection
  • Docker support for easy deployment

Prerequisites

  • Python 3.11+
  • InfluxDB instance (local or cloud)
  • SolarEdge API key
  • Latitude and longitude of your solar installation

Installation

Using Poetry

git clone https://github.com/yfredrix/solaredge-influxdb.git
cd solaredge-influxdb
poetry install

Using pip

pip install solaredge-influxdb

Using Docker

docker build -t solaredge-influxdb .
docker run -e API_KEY=<your_api_key> -e LATITUDE=<latitude> -e LONGITUDE=<longitude> solaredge-influxdb

Configuration

Configuration is managed through environment variables and/or a config.toml file.

Environment Variables

  • API_KEY - Your SolarEdge API key (required)
  • LATITUDE - Latitude of your solar installation (default: 52.3676)
  • LONGITUDE - Longitude of your solar installation (default: 4.9041)
  • INFLUXDB_URL - InfluxDB connection URL (configured in config.toml)
  • INFLUXDB_TOKEN - InfluxDB authentication token (configured in config.toml)

Configuration File

Create a solaredge_influxdb/config.toml file:

[influxdb]
url = "http://localhost:8086"
token = "your-influxdb-token"
org = "your-org"
bucket = "solaredge"

Usage

Running the Application

python -m solaredge_influxdb

Running with Custom Parameters

from solaredge_influxdb.app import app

app(
    api_key="your-api-key",
    latitude=52.3676,
    longitude=4.9041,
    timezone_str="Europe/Amsterdam",
    timewindow=15,  # Data collection interval in minutes
    force=False  # Force collection regardless of daylight
)

Force Mode

Use force=True to collect data regardless of sunrise/sunset times:

API_KEY=<key> python -m solaredge_influxdb --force

Data Collection

The application automatically:

  1. Calculates local sunrise and sunset times
  2. Only collects data during daylight hours (with configurable buffer time)
  3. Fetches equipment data, meters, and energy metrics from SolarEdge
  4. Stores the data in InfluxDB with timestamps

Testing

Run the test suite:

poetry run pytest

With coverage:

poetry run pytest --cov=solaredge_influxdb

Project Structure

solaredge_influxdb/
├── __init__.py
├── __main__.py
├── app.py              # Main application logic
├── config.toml         # Configuration file
├── influxdb/           # InfluxDB client and utilities
│   ├── __init__.py
│   └── client.py
└── solaredge/          # SolarEdge API client and data models
    ├── __init__.py
    ├── client.py
    ├── equipment.py
    ├── meters.py
    ├── models.py
    └── site.py

Requirements

  • Python 3.11+
  • requests >= 2.31.0
  • influxdb-client >= 1.40.0
  • pydantic >= 2.6.1
  • loguru >= 0.7.2
  • pytz >= 2024.1
  • astral >= 3.2

License

See LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a pull request.

Support

For issues and questions, please open an issue on the GitHub repository. Uploading data from Solar Edge API towards Influxdb on a regular interval of 5 minutes to prevent rate limiting

Usage

Run the application with:

python -m solaredge_influxdb

Available CLI options:

  • --config-path: Path to the configuration file.
  • --latitude: Latitude of the solar panels.
  • --longitude: Longitude of the solar panels.
  • --api-key: API key for the SolarEdge API.
  • --timewindow: Optional time window in minutes used for the technical-data lookback window.
  • --force: Collect data even outside the daylight window.

Examples:

python -m solaredge_influxdb --config-path ./solaredge_influxdb/config.toml --timewindow 15
python -m solaredge_influxdb --force

By default, the application skips data collection outside the configured daylight window. Use --force to collect data even after sundown.

Metadata

Release files for solaredge-influxdb 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solaredge-influxdb 2.0.0
File Size Uploaded Provenance Actions
solaredge_influxdb-2.0.0.tar.gz 23.0 kB With provenance Details for solaredge_influxdb-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for solaredge-influxdb 2.0.0
File Interpreter ABI Platform Actions
solaredge_influxdb-2.0.0-py3-none-any.whl Python 3 none any Details for solaredge_influxdb-2.0.0-py3-none-any.whl

Total release size: 48.2 kB

Release files / solaredge_influxdb-2.0.0.tar.gz

Download URL solaredge_influxdb-2.0.0.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9cf2454f045cd4ff1f8f43df862a9b2316db09b5ecfb64474a1ce8fc1860c491
BLAKE2b-256 checksum
How to use checksums
da366246a65c218f328ccec0c8e2e9ae60c6a8fa38054f0c2f605a77211c6aae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Release files / solaredge_influxdb-2.0.0-py3-none-any.whl

Download URL solaredge_influxdb-2.0.0-py3-none-any.whl
Size 25.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8768a7f1e428ee7cc1a623cdcdd80a178b96d4ba5acceb46e6df794a60eeab10
BLAKE2b-256 checksum
How to use checksums
63de0281fdf1222e4c3befe44b3552dc4e232667da50a3208efc652af06a7a43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Security for solaredge-influxdb 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for solaredge_influxdb-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page