File: README.md

package info (click to toggle)
sunweg 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 416 kB
  • sloc: python: 1,016; makefile: 7; sh: 5
file content (45 lines) | stat: -rw-r--r-- 1,531 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# SunWeg

[![Python build](https://github.com/rokam/sunweg/actions/workflows/python-build.yml/badge.svg)](https://github.com/rokam/sunweg/actions/workflows/python-build.yml)
![Python tests](https://raw.githubusercontent.com/rokam/sunweg/badges/tests.svg)
![Python coverage](https://raw.githubusercontent.com/rokam/sunweg/badges/coverage.svg)
![Python fake8](https://raw.githubusercontent.com/rokam/sunweg/badges/flake8.svg)

Python lib for WEG solar energy platform, [SunWEG.net](https://sunweg.net/)

## Usage

### Retrieve token
You need to use devtools from your browser to retrieve the token. In most of them, you can open devtools by pressing F12.
Inside the network tab, you need to check the preserve logs and then do a login.

You can find the token in the request header of various XHR requests, for example:
![Devtools with a request with a token](img/image.png)

It will be available in the X-Auth-Token-Update header.

### Code sample
``` python
from sunweg.api import APIHelper

api = APIHelper(token='your token here')
plants = api.listPlants()
for plant in plants:
    print(plant)
    for inverter in plant.inverters:
        print(inverter)
        for phase in inverter.phases:
            print(phase)
        for mppt in inverter.mppts:
            print(mppt)
            for string in mppt.strings:
                print(string)
```

## Documentation

Check the [DOCs](https://github.com/rokam/sunweg/blob/main/docs/index.md) for API documentation.

## Contribute

Feel free to send issues and pull requests.