Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inverter data and component/inventory queries #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Solaredge

API wrapper for Solaredge monitoring service.

See https://www.solaredge.com/sites/default/files/se_monitoring_api.pdf
See <https://www.solaredge.com/sites/default/files/se_monitoring_api.pdf>

## Create a new connection by supplying your Solaredge API key

```
s = solaredge.Solaredge("APIKEY")
```

## API Requests
11 API requests are supported. The methods return the parsed JSON response as a dict.

14 API requests are supported. The methods return the parsed JSON response as a dict.

```
def get_list(self, size=100, startIndex=0, searchText="", sortProperty="", sortOrder='ASC', status='Active,Pending'):
Expand All @@ -33,8 +36,15 @@ def get_energyDetails(self, site_id, startTime, endTime, meters=None, timeUnit="
def get_currentPowerFlow(self, site_id):

def get_storageData(self, site_id, startTime, endTime, serials=None):

get_componentList(self, site_id):

get_inventory(self, site_id):

def get_invertorDetails(self, site_id, invertor_id, startTime, endTime):
```

## TODO
* Add support for bulk requests
* Add API documentation

- Add support for bulk requests
- Add API documentation
32 changes: 32 additions & 0 deletions solaredge/solaredge.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,38 @@ def get_storageData(self, site_id, startTime, endTime, serials=None):
r.raise_for_status()
return r.json()

def get_componentList(self, site_id):
url = urljoin(BASEURL, "equipment", site_id, "list")
params = {
'api_key': self.token
}

r = requests.get(url, params)
r.raise_for_status()
return r.json()

def get_inventory(self, site_id):
url = urljoin(BASEURL, "site", site_id, "inventory")
params = {
'api_key': self.token
}

r = requests.get(url, params)
r.raise_for_status()
return r.json()

def get_inverterDetails(self, site_id, inverter_id, startTime, endTime):
url = urljoin(BASEURL, "equipment", site_id, inverter_id, "data")
params = {
'api_key': self.token,
'startTime': startTime,
'endTime': endTime,
}

r = requests.get(url, params)
r.raise_for_status()
return r.json()


def urljoin(*parts):
"""
Expand Down