- Notifications
You must be signed in to change notification settings - Fork24
Python module to access PV systems in Sunny Portal
License
erijo/sunnyportal-py
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Python module to access PV systems inSunny Portal.
The scriptsunnyportal2pvoutput can be used to senddata toPVOutput. It uses a config file to store thecredentials for Sunny Portal and theAPI Key and System Id for PVOutput.
- Clone or download the repository.
- Enter the directory and run:
PYTHONPATH=. ./bin/sunnyportal2pvoutput --dry-run sunnyportal.config
- Enter the requested information and verify that the script is able to connect to Sunny Portal.
- The information is saved in sunnyportal.config and can be edited/deleted if you misstype anything.
- Once it works, replace --dry-run with e.g. --output to upload the last seven days output data to pvoutput or --status to upload data for the current day.
- Add --quiet to silence the output.
$ PYTHONPATH=. ./bin/sunnyportal2pvoutput sunnyportal.config --helpusage: sunnyportal2pvoutput [-h] [-s] [-o] [-c] [-p DAYS_PAST] [-q] [-n] configConnect Sunny Portal to PVoutput.orgpositional arguments: config Configuration file to useoptional arguments: -h, --help show thishelp message andexit -s, --status Report status(es) -o, --output Report output(s) -c, --consumption Report consumption -p DAYS_PAST, --days-past DAYS_PAST number of DAYSin the past to go back -- default: 0 (today only) -q, --quiet Silence output -n, --dry-run Don't send any data
The scriptsunnyportal2file can be used to save data fromSunny Portal to file/database.It uses the same config file as insunnyportal2pvoutput to store the credentialsfor Sunny Portal. It will extract the fields (min, mean and max production) whichare available in unit watt asnumpy.uint32 along with corresponding timestampsand aggregate them into apandas DataFrame from which it will save to file withthe format specified. One file will be created for each plant your Sunny Portalaccount has access to.
- Clone or download the repository.
- Enter the directory and run:
PYTHONPATH=. ./bin/sunnyportal2file sunnyportal.config --format csv
(change --format if you prefer a different format) - Enter the requested information and verify that a file was created with the format you specified with the expected content
- Once it works, you can specify a different start date with --start-date, and end date with --end-date (both defaults to yesterday)
- If a data file already exists, it will only download new data and append to previously created data file (can override --start-date)
- Use --include-filter if you only want to download data for a specific plant
- Add --quiet to silence the output.
$ PYTHONPATH=. ./bin/sunnyportal2file -husage: sunnyportal2file [-h] -f {json,csv,pickle,feather,parquet,excel,sqlite} [-s START_DATE] [-e END_DATE] [-i INCLUDE_FILTER] [-q] configSave information from Sunny Portal to filepositional arguments: config Configuration file to useoptional arguments: -h, --help show thishelp message andexit -f {json,csv,pickle,feather,parquet,excel,sqlite}, --format {json,csv,pickle,feather,parquet,excel,sqlite} Formatfor which the data is to be saved -s START_DATE, --start-date START_DATE The start date of data to be savedin the format YYYY-MM-DD (default yesterday) -e END_DATE, --end-date END_DATE The end date of data to be savedin the format YYYY-MM-DD (default yesterday) -i INCLUDE_FILTER, --include-filter INCLUDE_FILTER A string used to filter which plants to include (default includes all plants) -q, --quiet Silence output