Code Monkey home page Code Monkey logo

solaredge-interface's Introduction

SolarEdge Interface

PyPi Python Versions Build Status Read the Docs License

The SolarEdge Interface provides both a command-line interface, and a Python module interface to interact with the SolarEdge API service.

Features

  • All (documented) SolarEdge API endpoints are implemented with multisite support for endpoints that provide multisite queries.
  • Response data for all endpoints are available as a Python-dict structure; a Pandas-DataFrame or; as raw-JSON.
  • The command-line interface output can be formatted as a CSV; as a Pandas style JSON structure or; as plain-JSON.
  • Timestamps can be returned as datetime values with their respective site timezones applied. Doing so is the default behaviour, however this can be disabled if required.
  • Configuration via environment variables or config file is possible, thus making it safer to manage your API key value(s).
  • Decent debug logging to help detect and discover problems should they arise.
  • Easy installation using PyPI pip
  • Plenty of documentation and examples - https://solaredge-interface.readthedocs.io

Installation

user@computer:~$ pip3 install solaredge-interface

Command Line Usage

For example, obtain the current power flow at site 1234567. This assumes the API_KEY has been set using the SOLAREDGE_API_KEY environment variable; alternatively use the --config command parameter to load a configuration file. Response data in CSV format for all sub-commands can be achieved by adding --format csv

user@computer:~$ solaredge-interface site_current_power_flow 1234567
{
  "siteCurrentPowerFlow": {
    "updateRefreshRate": 3,
    "unit": "kW",
    "connections": [
      {
        "from": "GRID",
        "to": "Load"
      }
    ],
    "GRID": {
      "status": "Active",
      "currentPower": 0.7
    },
    "LOAD": {
      "status": "Active",
      "currentPower": 0.7
    },
    "PV": {
      "status": "Idle",
      "currentPower": 0.0
    }
  }
}

Plenty more command-line examples available here.

Python Module Usage

Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from solaredge_interface.api.SolarEdgeAPI import SolarEdgeAPI
>>> api = SolarEdgeAPI(api_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', datetime_response=True, pandas_response=True)
>>> response = api.get_site_current_power_flow(1234567)
>>> response.data
{'siteCurrentPowerFlow': {'updateRefreshRate': 3, 'unit': 'kW', 'connections': [{'from': 'GRID', 'to': 'Load'}], 'GRID': {'status': 'Active', 'currentPower': 0.7}, 'LOAD': {'status': 'Active', 'currentPower': 0.7}, 'PV': {'status': 'Idle', 'currentPower': 0.0}}}
>>>

Additional Python-module examples are available in the python-modules pages.

History

This project started as a fork from EnergieID which was renamed to solaredge-interface because it was heavily re-worked and extended in a way that is not compatible with previous forks.

Project


Copyright © 2021 Nicholas de Jong

solaredge-interface's People

Contributors

ndejong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

solaredge-interface's Issues

some readouts missing depending on arguments

Depending on the start and endtime some rows are missing.
manually downloading the data gives complete data. Values are Ok.
Here is an example.
Example 1 complete Day
Example 2 only the hours were the data is missing.

sTime = "2021-04-28 00:00:00"
eTime = "2021-04-29 00:00:00"
meter = api.get_site_power_details(siteid, sTime, eTime).pandas

,Consumption,Production,FeedIn,Purchased,SelfConsumption
2021-04-28 00:00:00+02:00,414.87054,269.2262,0.0,414.87054,0.0
2021-04-28 02:30:00+02:00,292.0685,269.2262,0.0,292.0685,0.0
2021-04-28 02:45:00+02:00,239.43077,0.0,0.0,239.43077,0.0
2021-04-28 03:00:00+02:00,214.84138,0.0,0.0,214.84138,0.0
2021-04-28 03:15:00+02:00,234.83218,0.0,0.0,234.83218,0.0
.....

sTime = "2021-04-28 00:00:00"
eTime = "2021-04-28 03:00:00"
meter = api.get_site_power_details(siteid, sTime, eTime).pandas

,SelfConsumption,Production,Purchased,Consumption,FeedIn
2021-04-28 00:00:00+02:00,0.0,0.0,414.87054,414.87054,0.0
2021-04-28 00:30:00+02:00,0.0,0.0,235.65666,235.65666,0.0
2021-04-28 00:45:00+02:00,0.0,0.0,247.18236,247.18236,0.0
2021-04-28 01:00:00+02:00,0.0,0.0,269.16855,269.16855,0.0
2021-04-28 01:15:00+02:00,0.0,0.0,282.6468,282.6468,0.0
2021-04-28 01:30:00+02:00,0.0,0.0,220.07762,220.07762,0.0
2021-04-28 01:45:00+02:00,0.0,0.0,196.75935,196.75935,0.0
2021-04-28 02:00:00+02:00,0.0,0.0,295.37402,295.37402,0.0
2021-04-28 02:15:00+02:00,0.0,0.0,372.43823,372.43823,0.0
2021-04-28 02:30:00+02:00,0.0,0.0,292.0685,292.0685,0.0
2021-04-28 02:45:00+02:00,0.0,0.0,239.43077,239.43077,0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.